LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels
@ 2015-01-21 19:48 Stephen Boyd
  2015-01-21 19:48 ` [PATCH 1/2] ARM: Add a secondary_startup that assumes ARM mode Stephen Boyd
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stephen Boyd @ 2015-01-21 19:48 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Kumar Gala

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(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* [PATCH 1/2] ARM: Add a secondary_startup that assumes ARM mode
  2015-01-21 19:48 [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels Stephen Boyd
@ 2015-01-21 19:48 ` Stephen Boyd
  2015-01-21 19:48 ` [PATCH 2/2] ARM: qcom: Use secondary_startup_arm() Stephen Boyd
  2015-01-28 20:22 ` [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels Stephen Boyd
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2015-01-21 19:48 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Kumar Gala

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.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/kernel/head.S | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 664eee8c4a26..22bb6d54e90d 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -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
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* [PATCH 2/2] ARM: qcom: Use secondary_startup_arm()
  2015-01-21 19:48 [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels Stephen Boyd
  2015-01-21 19:48 ` [PATCH 1/2] ARM: Add a secondary_startup that assumes ARM mode Stephen Boyd
@ 2015-01-21 19:48 ` Stephen Boyd
  2015-01-28 20:22 ` [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels Stephen Boyd
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2015-01-21 19:48 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Kumar Gala

On 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.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 arch/arm/mach-qcom/platsmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-qcom/platsmp.c b/arch/arm/mach-qcom/platsmp.c
index a692bcb7e7f5..0f8b5147a78f 100644
--- a/arch/arm/mach-qcom/platsmp.c
+++ b/arch/arm/mach-qcom/platsmp.c
@@ -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;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* Re: [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels
  2015-01-21 19:48 [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels Stephen Boyd
  2015-01-21 19:48 ` [PATCH 1/2] ARM: Add a secondary_startup that assumes ARM mode Stephen Boyd
  2015-01-21 19:48 ` [PATCH 2/2] ARM: qcom: Use secondary_startup_arm() Stephen Boyd
@ 2015-01-28 20:22 ` Stephen Boyd
  2015-01-29 15:46   ` Catalin Marinas
  2 siblings, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2015-01-28 20:22 UTC (permalink / raw)
  To: Russell King; +Cc: linux-kernel, linux-arm-msm, linux-arm-kernel, Kumar Gala

On 01/21/15 11:48, Stephen Boyd wrote:
> 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(-)
>

Any comments here? Perhaps I can send this through the patch tracker?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


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

* Re: [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels
  2015-01-28 20:22 ` [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels Stephen Boyd
@ 2015-01-29 15:46   ` Catalin Marinas
  2015-01-29 21:29     ` Stephen Boyd
  0 siblings, 1 reply; 6+ messages in thread
From: Catalin Marinas @ 2015-01-29 15:46 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Russell King, linux-arm-msm, linux-kernel, linux-arm-kernel, Kumar Gala

On Wed, Jan 28, 2015 at 08:22:41PM +0000, Stephen Boyd wrote:
> On 01/21/15 11:48, Stephen Boyd wrote:
> > 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(-)
> 
> Any comments here? Perhaps I can send this through the patch tracker?

FWIW, they look fine to me.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

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

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

* Re: [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels
  2015-01-29 15:46   ` Catalin Marinas
@ 2015-01-29 21:29     ` Stephen Boyd
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2015-01-29 21:29 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Russell King, linux-arm-msm, linux-kernel, linux-arm-kernel, Kumar Gala

On 01/29/15 07:46, Catalin Marinas wrote:
> On Wed, Jan 28, 2015 at 08:22:41PM +0000, Stephen Boyd wrote:
>> On 01/21/15 11:48, Stephen Boyd wrote:
>>> 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(-)
>> Any comments here? Perhaps I can send this through the patch tracker?
> FWIW, they look fine to me.
>
> Acked-by: Catalin Marinas <catalin.marinas@arm.com>
>
> 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.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


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

end of thread, other threads:[~2015-01-29 21:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 19:48 [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels Stephen Boyd
2015-01-21 19:48 ` [PATCH 1/2] ARM: Add a secondary_startup that assumes ARM mode Stephen Boyd
2015-01-21 19:48 ` [PATCH 2/2] ARM: qcom: Use secondary_startup_arm() Stephen Boyd
2015-01-28 20:22 ` [PATCH 0/2] Fix secondary CPU boot for thumb2 kernels Stephen Boyd
2015-01-29 15:46   ` Catalin Marinas
2015-01-29 21:29     ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).