mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-02 10:43:57 +08:00
powerpc/powermac: Convert to hotplug state machine
Install the callbacks via the state machine. I assume here that the powermac has two CPUs and so only one can go up or down at a time. The variable smp_core99_host_open is here to ensure that we do not try to open or close the i2c host twice if something goes wrong and we invoke the prepare or online callback twice due to rollback. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: rt@linutronix.de Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: linuxppc-dev@lists.ozlabs.org Link: http://lkml.kernel.org/r/20160818125731.27256-16-bigeasy@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
9a20ea4b4c
commit
68e694dcef
@ -852,37 +852,33 @@ static void smp_core99_setup_cpu(int cpu_nr)
|
|||||||
|
|
||||||
#ifdef CONFIG_PPC64
|
#ifdef CONFIG_PPC64
|
||||||
#ifdef CONFIG_HOTPLUG_CPU
|
#ifdef CONFIG_HOTPLUG_CPU
|
||||||
static int smp_core99_cpu_notify(struct notifier_block *self,
|
static unsigned int smp_core99_host_open;
|
||||||
unsigned long action, void *hcpu)
|
|
||||||
|
static int smp_core99_cpu_prepare(unsigned int cpu)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
switch(action & ~CPU_TASKS_FROZEN) {
|
/* Open i2c bus if it was used for tb sync */
|
||||||
case CPU_UP_PREPARE:
|
if (pmac_tb_clock_chip_host && !smp_core99_host_open) {
|
||||||
/* Open i2c bus if it was used for tb sync */
|
rc = pmac_i2c_open(pmac_tb_clock_chip_host, 1);
|
||||||
if (pmac_tb_clock_chip_host) {
|
if (rc) {
|
||||||
rc = pmac_i2c_open(pmac_tb_clock_chip_host, 1);
|
pr_err("Failed to open i2c bus for time sync\n");
|
||||||
if (rc) {
|
return notifier_from_errno(rc);
|
||||||
pr_err("Failed to open i2c bus for time sync\n");
|
|
||||||
return notifier_from_errno(rc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
smp_core99_host_open = 1;
|
||||||
case CPU_ONLINE:
|
|
||||||
case CPU_UP_CANCELED:
|
|
||||||
/* Close i2c bus if it was used for tb sync */
|
|
||||||
if (pmac_tb_clock_chip_host)
|
|
||||||
pmac_i2c_close(pmac_tb_clock_chip_host);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return NOTIFY_OK;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct notifier_block smp_core99_cpu_nb = {
|
static int smp_core99_cpu_online(unsigned int cpu)
|
||||||
.notifier_call = smp_core99_cpu_notify,
|
{
|
||||||
};
|
/* Close i2c bus if it was used for tb sync */
|
||||||
|
if (pmac_tb_clock_chip_host && smp_core99_host_open) {
|
||||||
|
pmac_i2c_close(pmac_tb_clock_chip_host);
|
||||||
|
smp_core99_host_open = 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif /* CONFIG_HOTPLUG_CPU */
|
#endif /* CONFIG_HOTPLUG_CPU */
|
||||||
|
|
||||||
static void __init smp_core99_bringup_done(void)
|
static void __init smp_core99_bringup_done(void)
|
||||||
@ -902,7 +898,11 @@ static void __init smp_core99_bringup_done(void)
|
|||||||
g5_phy_disable_cpu1();
|
g5_phy_disable_cpu1();
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_HOTPLUG_CPU
|
#ifdef CONFIG_HOTPLUG_CPU
|
||||||
register_cpu_notifier(&smp_core99_cpu_nb);
|
cpuhp_setup_state_nocalls(CPUHP_POWERPC_PMAC_PREPARE,
|
||||||
|
"powerpc/pmac:prepare", smp_core99_cpu_prepare,
|
||||||
|
NULL);
|
||||||
|
cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "powerpc/pmac:online",
|
||||||
|
smp_core99_cpu_online, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ppc_md.progress)
|
if (ppc_md.progress)
|
||||||
|
@ -31,6 +31,7 @@ enum cpuhp_state {
|
|||||||
CPUHP_MD_RAID5_PREPARE,
|
CPUHP_MD_RAID5_PREPARE,
|
||||||
CPUHP_RCUTREE_PREP,
|
CPUHP_RCUTREE_PREP,
|
||||||
CPUHP_CPUIDLE_COUPLED_PREPARE,
|
CPUHP_CPUIDLE_COUPLED_PREPARE,
|
||||||
|
CPUHP_POWERPC_PMAC_PREPARE,
|
||||||
CPUHP_NOTIFY_PREPARE,
|
CPUHP_NOTIFY_PREPARE,
|
||||||
CPUHP_TIMERS_DEAD,
|
CPUHP_TIMERS_DEAD,
|
||||||
CPUHP_BRINGUP_CPU,
|
CPUHP_BRINGUP_CPU,
|
||||||
|
Loading…
Reference in New Issue
Block a user