In generic_secondary_smp_init(), when switching to the target
hardware thread on Book3E, the entry point for the secondary
thread was loaded into r5 instead of r4.
book3e_start_thread() expects the entry point in r4 and
immediately wipes r5 with MSR_KERNEL, which left r4 pointing
to booting_thread_hwid. This is bad because the started thread
jumps straight into data and traps on an invalid opcode,
hanging the core.
To fix this, load DOTSYM(fsl_secondary_thread_init) into r4
so the secondary thread starts at the real entry point.
Fixes: 2dc0bc1138ee ("powerpc/64e: Fix secondary thread bringup for ELFv2
kernels")
Cc: [email protected] # v6.6+
Signed-off-by: Bradley Morgan <[email protected]>
---
arch/powerpc/kernel/head_64.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index a54f6f9791731..0077ce148a5a6 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -374,7 +374,7 @@ _GLOBAL(generic_secondary_smp_init)
beq 20f
/* start the specified thread */
- LOAD_REG_ADDR(r5, DOTSYM(fsl_secondary_thread_init))
+ LOAD_REG_ADDR(r4, DOTSYM(fsl_secondary_thread_init))
bl book3e_start_thread
/* stop the current thread */
--
2.53.0