From: Zwane Mwaikambo This should allow for easier adding of hotplug cpu support for other PPC64 subarchs. The patch is untested but does compile with and without hotplug cpu on pSeries and G5 configs. What can get slightly confusing is the fact that both ppc_md and smp_ops have cpu_die members. Signed-off-by: Zwane Mwaikambo Signed-off-by: Andrew Morton --- 25-akpm/arch/ppc64/kernel/pSeries_smp.c | 9 +++++++-- 25-akpm/arch/ppc64/kernel/smp.c | 16 ++++++++++++++++ 25-akpm/include/asm-ppc64/machdep.h | 2 ++ 3 files changed, 25 insertions(+), 2 deletions(-) diff -puN arch/ppc64/kernel/pSeries_smp.c~ppc64-move-hotplug-cpu-functions-to-smp_ops arch/ppc64/kernel/pSeries_smp.c --- 25/arch/ppc64/kernel/pSeries_smp.c~ppc64-move-hotplug-cpu-functions-to-smp_ops 2005-01-09 23:45:38.686160912 -0800 +++ 25-akpm/arch/ppc64/kernel/pSeries_smp.c 2005-01-09 23:45:38.693159848 -0800 @@ -87,7 +87,7 @@ static int query_cpu_stopped(unsigned in #ifdef CONFIG_HOTPLUG_CPU -int __cpu_disable(void) +int pSeries_cpu_disable(void) { /* FIXME: go put this in a header somewhere */ extern void xics_migrate_irqs_away(void); @@ -103,7 +103,7 @@ int __cpu_disable(void) return 0; } -void __cpu_die(unsigned int cpu) +void pSeries_cpu_die(unsigned int cpu) { int tries; int cpu_status; @@ -352,6 +352,11 @@ void __init smp_init_pSeries(void) else smp_ops = &pSeries_xics_smp_ops; +#ifdef CONFIG_HOTPLUG_CPU + smp_ops->cpu_disable = pSeries_cpu_disable; + smp_ops->cpu_die = pSeries_cpu_die; +#endif + /* Start secondary threads on SMT systems; primary threads * are already in the running state. */ diff -puN arch/ppc64/kernel/smp.c~ppc64-move-hotplug-cpu-functions-to-smp_ops arch/ppc64/kernel/smp.c --- 25/arch/ppc64/kernel/smp.c~ppc64-move-hotplug-cpu-functions-to-smp_ops 2005-01-09 23:45:38.687160760 -0800 +++ 25-akpm/arch/ppc64/kernel/smp.c 2005-01-09 23:45:38.694159696 -0800 @@ -551,3 +551,19 @@ void __init smp_cpus_done(unsigned int m */ cpu_present_map = cpu_possible_map; } + +#ifdef CONFIG_HOTPLUG_CPU +int __cpu_disable(void) +{ + if (smp_ops->cpu_disable) + return smp_ops->cpu_disable(); + + return -ENOSYS; +} + +void __cpu_die(unsigned int cpu) +{ + if (smp_ops->cpu_die) + smp_ops->cpu_die(cpu); +} +#endif diff -puN include/asm-ppc64/machdep.h~ppc64-move-hotplug-cpu-functions-to-smp_ops include/asm-ppc64/machdep.h --- 25/include/asm-ppc64/machdep.h~ppc64-move-hotplug-cpu-functions-to-smp_ops 2005-01-09 23:45:38.689160456 -0800 +++ 25-akpm/include/asm-ppc64/machdep.h 2005-01-09 23:45:38.694159696 -0800 @@ -31,6 +31,8 @@ struct smp_ops_t { void (*late_setup_cpu)(int nr); void (*take_timebase)(void); void (*give_timebase)(void); + int (*cpu_disable)(void); + void (*cpu_die)(unsigned int nr); }; #endif _