[PATCH] arm: mediatek: fix secondary CPU boot on Thumb-2 kernels with Clang
Akari Tsuyukusa
akkun11.open at gmail.com
Wed Jul 22 10:24:43 PDT 2026
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 at vger.kernel.org
Signed-off-by: Akari Tsuyukusa <akkun11.open at 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
More information about the Linux-mediatek
mailing list