linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: Fix the secondary_startup function in Big Endian case
@ 2015-08-06 11:27 Gregory CLEMENT
  2015-08-06 13:52 ` Russell King - ARM Linux
  0 siblings, 1 reply; 3+ messages in thread
From: Gregory CLEMENT @ 2015-08-06 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

Since the commit "b2c3e38a5471 ARM: redo TTBR setup code for LPAE",
the setup code had been reworked. As a result the secondary CPUs
failed to come online in Big Endian.

As explained by Russell, the new code expected the value in r4/r5 to
be the least significant 32bits in r4 and the most significant 32bits
in r5. However, in the secondary code, we load this using ldrd, which
on BE reverses that.

This patch swap r4/r5 after the ldrd. It is done using the xor
instructions in order to not use a temporary register.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
 arch/arm/kernel/head.S | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index bd755d97e459..75cbcf34c2e9 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -399,6 +399,9 @@ ENTRY(secondary_startup)
 	sub	lr, r4, r5			@ mmu has been enabled
 	add	r3, r7, lr
 	ldrd	r4, [r3, #0]			@ get secondary_data.pgdir
+ARM_BE8(eor	r4, r4, r5)			@ swap r5 and r4 in BE
+ARM_BE8(eor	r5, r4, r5)			@ it can be done in 3 step
+ARM_BE8(eor	r4, r4, r5)			@ without using an temp reg
 	ldr	r8, [r3, #8]			@ get secondary_data.swapper_pg_dir
 	badr	lr, __enable_mmu		@ return address
 	mov	r13, r12			@ __secondary_switched address
-- 
2.1.0

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

* [PATCH] ARM: Fix the secondary_startup function in Big Endian case
  2015-08-06 11:27 [PATCH] ARM: Fix the secondary_startup function in Big Endian case Gregory CLEMENT
@ 2015-08-06 13:52 ` Russell King - ARM Linux
  2015-08-06 14:01   ` Gregory CLEMENT
  0 siblings, 1 reply; 3+ messages in thread
From: Russell King - ARM Linux @ 2015-08-06 13:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Aug 06, 2015 at 01:27:32PM +0200, Gregory CLEMENT wrote:
> Since the commit "b2c3e38a5471 ARM: redo TTBR setup code for LPAE",
> the setup code had been reworked. As a result the secondary CPUs
> failed to come online in Big Endian.
> 
> As explained by Russell, the new code expected the value in r4/r5 to
> be the least significant 32bits in r4 and the most significant 32bits
> in r5. However, in the secondary code, we load this using ldrd, which
> on BE reverses that.
> 
> This patch swap r4/r5 after the ldrd. It is done using the xor
> instructions in order to not use a temporary register.

Patch looks good to me, thanks.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

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

* [PATCH] ARM: Fix the secondary_startup function in Big Endian case
  2015-08-06 13:52 ` Russell King - ARM Linux
@ 2015-08-06 14:01   ` Gregory CLEMENT
  0 siblings, 0 replies; 3+ messages in thread
From: Gregory CLEMENT @ 2015-08-06 14:01 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/08/2015 15:52, Russell King - ARM Linux wrote:
> On Thu, Aug 06, 2015 at 01:27:32PM +0200, Gregory CLEMENT wrote:
>> Since the commit "b2c3e38a5471 ARM: redo TTBR setup code for LPAE",
>> the setup code had been reworked. As a result the secondary CPUs
>> failed to come online in Big Endian.
>>
>> As explained by Russell, the new code expected the value in r4/r5 to
>> be the least significant 32bits in r4 and the most significant 32bits
>> in r5. However, in the secondary code, we load this using ldrd, which
>> on BE reverses that.
>>
>> This patch swap r4/r5 after the ldrd. It is done using the xor
>> instructions in order to not use a temporary register.
> 
> Patch looks good to me, thanks.
> 
So I am going to submit it to your patch system and in the same
time I will fix the typo in my comment:

- @ it can be done in 3 step
- @ without using an temp reg
+ @ it can be done in 3 steps
+ @ without using a temp reg.


Thanks,

Gregory


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

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

end of thread, other threads:[~2015-08-06 14:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-06 11:27 [PATCH] ARM: Fix the secondary_startup function in Big Endian case Gregory CLEMENT
2015-08-06 13:52 ` Russell King - ARM Linux
2015-08-06 14:01   ` Gregory CLEMENT

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