Fix secondary CPU boot for thumb2 kernels
cover Fix secondary CPU boot for thumb2 kernels
Currently I can't boot up secondary CPUs on qcom platforms when I compile the kernel for THUMB2 mode. This is because we always enter the kernel in ARM mode regardless of what mode the kernel is compiled for. This patchset adds a small wrapper to secondary_startup() called secondary_startup_arm() that allows us to switch into THUMB2 mode if we need to. If the kernel is compiled for ARM mode it shouldn't have any effect.
Stephen Boyd (2):
ARM: Add a secondary_startup that assumes ARM mode
ARM: qcom: Use secondary_startup_arm()
arch/arm/kernel/head.S | 7 +++++++ arch/arm/mach-qcom/platsmp.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 1/2 ARM: Add a secondary_startup that assumes ARM mode
Some platforms always enter the kernel in ARM mode even if the kernel is compiled for THUMB2. Add a small wrapper on top of secondary_startup() that switches into THUMB2 mode.
--- arch/arm/kernel/head.S | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/kernel/head.S +7 -0
@@ -346,6 +346,12 @@ __turn_mmu_on_loc: #if defined(CONFIG_SMP) .text +ENTRY(secondary_startup_arm) + .arm + THUMB( adr r9, BSYM(1f) ) @ Kernel is entered in ARM. + THUMB( bx r9 ) @ If this is a Thumb-2 kernel, + THUMB( .thumb ) @ switch to Thumb now. + THUMB(1: ) ENTRY(secondary_startup) /* * Common entry point for secondary CPUs.
@@ -385,6 +391,7 @@ ENTRY(secondary_startup) THUMB( add r12, r10, #PROCINFO_INITFUNC ) THUMB( ret r12 ) ENDPROC(secondary_startup) +ENDPROC(secondary_startup_arm) /* * r6 = &secondary_data
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 2/2 ARM: qcom: Use secondary_startup_arm()
In reply to Stephen BoydOn qcom platforms we always enter the kernel in ARM mode, regardless of the kernel being compiled for THUMB mode. Use secondary_startup_arm() to properly switch the mode to what the kernel expects if required.
--- arch/arm/mach-qcom/platsmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-qcom/platsmp.c +2 -2
@@ -44,7 +44,7 @@#define APCS_SAW2_VCTL 0x14#define APCS_SAW2_2_VCTL 0x1c -extern void secondary_startup (void ); +extern void secondary_startup_arm (void );static DEFINE_SPINLOCK (boot_lock);
@@ -337,7 +337,7 @@ static void __init qcom_smp_prepare_cpus(unsigned int max_cpus) flags |= cold_boot_flags[map]; } -if (scm_set_boot_addr (virt_to_phys (secondary_startup), flags)) { +if (scm_set_boot_addr (virt_to_phys (secondary_startup_arm), flags)) {for_each_present_cpu (cpu) {if (cpu ==smp_processor_id ())continue ;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 8 lines · Stephen Boyd
Currently I can't boot up secondary CPUs on qcom platforms when I compile the kernel for THUMB2 mode. This is because we always enter the kernel in ARM mode regardless of what mode the kernel is compiled for. This patchset adds a small wrapper to
secondary_startup()calledsecondary_startup_arm()that allows us to switch into THUMB2 mode if we need to. If the kernel is compiled for ARM mode it shouldn't have any effect.
Quoted 8 lines
Stephen Boyd (2):
ARM: Add asecondary_startupthat assumes ARM mode
ARM: qcom: Usesecondary_startup_arm()arch/arm/kernel/head.S | 7 +++++++ arch/arm/mach-qcom/platsmp.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-)
Any comments here? Perhaps I can send this through the patch tracker?
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Catalin Marinas
Acked-byQuoted 13 lines · Stephen Boyd
Quoted 12 lines · Stephen Boyd
Currently I can't boot up secondary CPUs on qcom platforms when I compile the kernel for THUMB2 mode. This is because we always enter the kernel in ARM mode regardless of what mode the kernel is compiled for. This patchset adds a small wrapper to
secondary_startup()calledsecondary_startup_arm()that allows us to switch into THUMB2 mode if we need to. If the kernel is compiled for ARM mode it shouldn't have any effect.Stephen Boyd (2):
ARM: Add asecondary_startupthat assumes ARM mode
ARM: qcom: Usesecondary_startup_arm()
Quoted 5 lines
Quoted 3 lines
arch/arm/kernel/head.S | 7 +++++++ arch/arm/mach-qcom/platsmp.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-)Any comments here? Perhaps I can send this through the patch tracker?
FWIW, they look fine to me.
I guess the reason it works fine on other platforms is because the secondary start address we pass to firmware has bit 0 set and this causes the jump to the kernel in Thumb-2 mode.
Catalin
Quoted 17 lines · Catalin Marinas
Quoted 16 lines · Stephen Boyd
Quoted 15 lines · Stephen Boyd
Currently I can't boot up secondary CPUs on qcom platforms when I compile the kernel for THUMB2 mode. This is because we always enter the kernel in ARM mode regardless of what mode the kernel is compiled for. This patchset adds a small wrapper to
secondary_startup()calledsecondary_startup_arm()that allows us to switch into THUMB2 mode if we need to. If the kernel is compiled for ARM mode it shouldn't have any effect.Stephen Boyd (2):
ARM: Add asecondary_startupthat assumes ARM mode
ARM: qcom: Usesecondary_startup_arm()arch/arm/kernel/head.S | 7 +++++++ arch/arm/mach-qcom/platsmp.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-)
Quoted 9 lines
Quoted 1 line
Any comments here? Perhaps I can send this through the patch tracker?
FWIW, they look fine to me.
Acked-by Catalin Marinas <[email protected]>I guess the reason it works fine on other platforms is because the secondary start address we pass to firmware has bit 0 set and this causes the jump to the kernel in Thumb-2 mode.
Thanks. I tried forcing that and it still didn't work so I guess the firmware isn't using interworking branches.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project