mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bradley Morgan <bradley.morgan@linux.dev>
To: Madhavan Srinivasan <maddy@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	Christophe Leroy <chleroy@kernel.org>
Cc: Ritesh Harjani <ritesh.list@gmail.com>,
	Shrikanth Hegde <sshegde@linux.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Bradley Morgan <bradley.morgan@linux.dev>
Subject: [PATCH 1/2] powerpc/64e: Pass entry point in r4 to book3e_start_thread()
Date: Fri, 20 Nov 2026 17:29:48 +0000	[thread overview]
Message-ID: <20261120172949.3494131-2-bradley.morgan@linux.dev> (raw)
In-Reply-To: <20261120172949.3494131-1-bradley.morgan@linux.dev>

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: stable@vger.kernel.org # v6.6+
Signed-off-by: Bradley Morgan <bradley.morgan@linux.dev>
---
 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


  reply	other threads:[~2026-11-20 17:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 17:29 [PATCH 0/2] powerpc/64: Fix some snafus in head_64.S Bradley Morgan
2026-11-20 17:29 ` Bradley Morgan [this message]
2026-11-20 17:29 ` [PATCH 2/2] powerpc/64: Set r3 to physical CPU ID before kexec_wait on !SMP Bradley Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261120172949.3494131-2-bradley.morgan@linux.dev \
    --to=bradley.morgan@linux.dev \
    --cc=chleroy@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=ritesh.list@gmail.com \
    --cc=sshegde@linux.ibm.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®