Skip to content

Commit 1023355

Browse files
nixiaominggregkh
authored andcommitted
powerpc/85xx: fix timebase sync issue when CONFIG_HOTPLUG_CPU=n
commit c45361a upstream. When CONFIG_SMP=y, timebase synchronization is required when the second kernel is started. arch/powerpc/kernel/smp.c: int __cpu_up(unsigned int cpu, struct task_struct *tidle) { ... if (smp_ops->give_timebase) smp_ops->give_timebase(); ... } void start_secondary(void *unused) { ... if (smp_ops->take_timebase) smp_ops->take_timebase(); ... } When CONFIG_HOTPLUG_CPU=n and CONFIG_KEXEC_CORE=n, smp_85xx_ops.give_timebase is NULL, smp_85xx_ops.take_timebase is NULL, As a result, the timebase is not synchronized. Timebase synchronization does not depend on CONFIG_HOTPLUG_CPU. Fixes: 56f1ba2 ("powerpc/mpc85xx: refactor the PM operations") Cc: stable@vger.kernel.org # v4.6+ Signed-off-by: Xiaoming Ni <nixiaoming@huawei.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20210929033646.39630-3-nixiaoming@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 77d543e commit 1023355

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

arch/powerpc/platforms/85xx/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# Makefile for the PowerPC 85xx linux kernel.
44
#
55
obj-$(CONFIG_SMP) += smp.o
6-
obj-$(CONFIG_FSL_PMC) += mpc85xx_pm_ops.o
6+
ifneq ($(CONFIG_FSL_CORENET_RCPM),y)
7+
obj-$(CONFIG_SMP) += mpc85xx_pm_ops.o
8+
endif
79

810
obj-y += common.o
911

arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
static struct ccsr_guts __iomem *guts;
1919

20+
#ifdef CONFIG_FSL_PMC
2021
static void mpc85xx_irq_mask(int cpu)
2122
{
2223

@@ -49,6 +50,7 @@ static void mpc85xx_cpu_up_prepare(int cpu)
4950
{
5051

5152
}
53+
#endif
5254

5355
static void mpc85xx_freeze_time_base(bool freeze)
5456
{
@@ -76,10 +78,12 @@ static const struct of_device_id mpc85xx_smp_guts_ids[] = {
7678

7779
static const struct fsl_pm_ops mpc85xx_pm_ops = {
7880
.freeze_time_base = mpc85xx_freeze_time_base,
81+
#ifdef CONFIG_FSL_PMC
7982
.irq_mask = mpc85xx_irq_mask,
8083
.irq_unmask = mpc85xx_irq_unmask,
8184
.cpu_die = mpc85xx_cpu_die,
8285
.cpu_up_prepare = mpc85xx_cpu_up_prepare,
86+
#endif
8387
};
8488

8589
int __init mpc85xx_setup_pmc(void)

arch/powerpc/platforms/85xx/smp.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ struct epapr_spin_table {
4040
u32 pir;
4141
};
4242

43-
#ifdef CONFIG_HOTPLUG_CPU
4443
static u64 timebase;
4544
static int tb_req;
4645
static int tb_valid;
@@ -112,6 +111,7 @@ static void mpc85xx_take_timebase(void)
112111
local_irq_restore(flags);
113112
}
114113

114+
#ifdef CONFIG_HOTPLUG_CPU
115115
static void smp_85xx_cpu_offline_self(void)
116116
{
117117
unsigned int cpu = smp_processor_id();
@@ -495,21 +495,21 @@ void __init mpc85xx_smp_init(void)
495495
smp_85xx_ops.probe = NULL;
496496
}
497497

498-
#ifdef CONFIG_HOTPLUG_CPU
499498
#ifdef CONFIG_FSL_CORENET_RCPM
499+
/* Assign a value to qoriq_pm_ops on PPC_E500MC */
500500
fsl_rcpm_init();
501-
#endif
502-
503-
#ifdef CONFIG_FSL_PMC
501+
#else
502+
/* Assign a value to qoriq_pm_ops on !PPC_E500MC */
504503
mpc85xx_setup_pmc();
505504
#endif
506505
if (qoriq_pm_ops) {
507506
smp_85xx_ops.give_timebase = mpc85xx_give_timebase;
508507
smp_85xx_ops.take_timebase = mpc85xx_take_timebase;
508+
#ifdef CONFIG_HOTPLUG_CPU
509509
smp_85xx_ops.cpu_offline_self = smp_85xx_cpu_offline_self;
510510
smp_85xx_ops.cpu_die = qoriq_cpu_kill;
511-
}
512511
#endif
512+
}
513513
smp_ops = &smp_85xx_ops;
514514

515515
#ifdef CONFIG_KEXEC_CORE

0 commit comments

Comments
 (0)