CPU logic online/offline was not implemented on arm64 which is essential for cpu hot-plug, so skeleton the logic cpu online/offline to make arm64 code compile when CONFIG_HOTPLUG_CPU was introduced.
It should be fully implemented at later date. Will discuss it with power management team in LCE13.
Signed-off-by: Hanjun Guo hanjun.guo@linaro.org --- arch/arm64/Kconfig | 7 +++++++ arch/arm64/include/asm/smp.h | 3 +++ arch/arm64/kernel/smp.c | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+)
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 9b9cde0..c967b11 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -150,6 +150,13 @@ config NR_CPUS depends on SMP default "4"
+config HOTPLUG_CPU + bool "Support for hot-pluggable CPUs" + depends on SMP && HOTPLUG + help + Say Y here to experiment with turning CPUs off and on. CPUs + can be controlled through /sys/devices/system/cpu. + source kernel/Kconfig.preempt
config HZ diff --git a/arch/arm64/include/asm/smp.h b/arch/arm64/include/asm/smp.h index 4b8023c..95c9f58 100644 --- a/arch/arm64/include/asm/smp.h +++ b/arch/arm64/include/asm/smp.h @@ -63,6 +63,9 @@ extern struct secondary_data secondary_data; extern void secondary_holding_pen(void); extern volatile unsigned long secondary_holding_pen_release;
+extern int __cpu_disable(void); +extern void __cpu_die(unsigned int cpu); + extern void arch_send_call_function_single_ipi(int cpu); extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index fe4ed77..5ec1723 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -257,6 +257,27 @@ static const struct smp_enable_ops * __init smp_get_enable_ops(const char *name) return NULL; }
+#ifdef CONFIG_HOTPLUG_CPU +/* + * __cpu_disable runs on the processor to be shutdown. + */ +int __cpuinit __cpu_disable(void) +{ + pr_info("entered __cpu_disable(), assume always success\n"); + return 0; +} + +/* + * called on the thread which is asking for a CPU to be shutdown - + * waits until shutdown has completed, or it is timed out. + */ +void __cpuinit __cpu_die(unsigned int cpu) +{ + pr_info("entered __cpu_disable(), cpu %d will go away\n", cpu); + return; +} +#endif /* CONFIG_HOTPLUG_CPU */ + /* * Enumerate the possible CPU set from the device tree and build the * cpu logical map array containing MPIDR values related to logical