Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: mediatek: fix secondary CPU boot on Thumb-2 kernels with Clang
@ 2026-07-22 17:24 Akari Tsuyukusa
  2026-07-22 21:03 ` Nick Desaulniers
  0 siblings, 1 reply; 5+ messages in thread
From: Akari Tsuyukusa @ 2026-07-22 17:24 UTC (permalink / raw)
  To: Matthias Brugger, AngeloGioacchino Del Regno, Russell King,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt
  Cc: Yingjoe Chen, moderated list:ARM SUB-ARCHITECTURES,
	open list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support,
	open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b,
	Akari Tsuyukusa, stable

When building with CONFIG_THUMB2_KERNEL=y and Clang, secondary CPUs
fail to come online with "CPU1: failed to come online". The address
written to the jump register has bit 0 set, causing the secondary CPU
to start in Thumb mode.

secondary_startup_arm is ARM-mode code (.arm) and, on a Thumb-2 kernel,
expects to be entered in ARM mode in order to switch to Thumb via the
standard sequence at that label. Starting in Thumb mode causes the CPU
to execute ARM instructions as Thumb, resulting in an immediate crash.

Clear bit 0 of the entry address so the CPU always starts in ARM mode.

Tested on Lenovo YOGA Tablet 10 (Wi-Fi).

Fixes: 0cda07001a94 ("ARM: mediatek: add smp bringup code")
Assisted-by: DeepSeek:deepseek-v4-pro
Cc: stable@vger.kernel.org
Signed-off-by: Akari Tsuyukusa <akkun11.open@gmail.com>
---
 arch/arm/mach-mediatek/platsmp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
index 6b0943d95555..9a7c65fc3ae1 100644
--- a/arch/arm/mach-mediatek/platsmp.c
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -124,7 +124,7 @@ static void __init __mtk_smp_prepare_cpus(unsigned int max_cpus, int trustzone)
 	 * write the address of slave startup address into the system-wide
 	 * jump register
 	 */
-	writel_relaxed(__pa_symbol(secondary_startup_arm),
+	writel_relaxed(__pa_symbol(secondary_startup_arm) & ~1,
 			mtk_smp_base + mtk_smp_info->jump_reg);
 }
 
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-23  9:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22 17:24 [PATCH] arm: mediatek: fix secondary CPU boot on Thumb-2 kernels with Clang Akari Tsuyukusa
2026-07-22 21:03 ` Nick Desaulniers
2026-07-23  4:45   ` Roman Vivchar
2026-07-23  9:15   ` Akari Tsuyukusa
2026-07-23  9:53     ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox