From f237941bd14f9d014fcb74b186de3178a5f9de42 Mon Sep 17 00:00:00 2001 From: Abhimanyu Kapur Date: Mon, 10 Feb 2014 00:00:52 -0800 Subject: [PATCH] arm64: smp: Jump back to secondary start kernel for onlined CPUs Add a call to secondary start kernel for cpus which have been onlined via the hotplug path for wfi based hotplug solution where the return path from cpu_die should not return to the idle thread. Update the cpu_die definition with a __ref to allow referencing a __cpuinit call (secondary_start_kernel) from it. Change-Id: I7c083effda3928b562ea0d601833ceb8d5178d43 Signed-off-by: Abhimanyu Kapur --- arch/arm64/kernel/smp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 43f9e4a91972..ae6e7995263b 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -295,7 +295,7 @@ void __cpu_die(unsigned int cpu) * of the other hotplug-cpu capable cores, so presumably coming * out of idle fixes this. */ -void cpu_die(void) +void __ref cpu_die(void) { unsigned int cpu = smp_processor_id(); @@ -313,7 +313,16 @@ void cpu_die(void) */ cpu_ops[cpu]->cpu_die(cpu); - BUG(); + /* + * Do not return to the idle loop - jump back to the secondary + * cpu initialisation. There's some initialisation which needs + * to be repeated to undo the effects of taking the CPU offline. + */ + + asm volatile("mov sp, %0\n" + "mov x29, #0\n" + "b secondary_start_kernel" + : : "r" (task_stack_page(current) + THREAD_START_SP)); } #endif