linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* v3.8-rc issues with big endian
@ 2013-02-09 23:15 Ben Dooks
  2013-02-09 23:15 ` [PATCH 1/2] ARM: mm: replace direct access to mm->context.id with new macro Ben Dooks
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Ben Dooks @ 2013-02-09 23:15 UTC (permalink / raw)
  To: linux-arm-kernel

Whilst debugging with big endian ARM on v3.8-rc I came across a problem
with the new ASID code (commit b5466f8728527a05a493cc4abe9e6f034a1bbaab)
which is causing issues with user-land failing to work.

Since the new ASID code is using 64-bit accesses, the ASID ID is now
being placed in context->id + 4, which means that the assembly mm code
no-longer works.

I also noticed and fixed a couple of places where the new mmid macro was
not being used, so fixed those too.

Tested on a highbank system.

 [PATCH 1/2] ARM: mm: replace direct access to mm->context.id with
 [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian

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

* [PATCH 1/2] ARM: mm: replace direct access to mm->context.id with new macro
  2013-02-09 23:15 v3.8-rc issues with big endian Ben Dooks
@ 2013-02-09 23:15 ` Ben Dooks
  2013-02-09 23:15 ` [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian Ben Dooks
  2013-02-11  4:35 ` v3.8-rc issues with big endian Nicolas Pitre
  2 siblings, 0 replies; 8+ messages in thread
From: Ben Dooks @ 2013-02-09 23:15 UTC (permalink / raw)
  To: linux-arm-kernel

The mmid macro is meant to be used to get the mm->context.id data
from the mm structure, but it seems to have been missed in a cuple
of files.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/mm/proc-v6.S        |    2 +-
 arch/arm/mm/proc-v7-2level.S |    2 +-
 arch/arm/mm/proc-v7-3level.S |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 09c5233..bcaaa8d 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -101,7 +101,7 @@ ENTRY(cpu_v6_dcache_clean_area)
 ENTRY(cpu_v6_switch_mm)
 #ifdef CONFIG_MMU
 	mov	r2, #0
-	ldr	r1, [r1, #MM_CONTEXT_ID]	@ get mm->context.id
+	mmid	r1, r1				@ get mm->context.id
 	ALT_SMP(orr	r0, r0, #TTB_FLAGS_SMP)
 	ALT_UP(orr	r0, r0, #TTB_FLAGS_UP)
 	mcr	p15, 0, r2, c7, c5, 6		@ flush BTAC/BTB
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
index 6d98c13..78f520b 100644
--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -40,7 +40,7 @@
 ENTRY(cpu_v7_switch_mm)
 #ifdef CONFIG_MMU
 	mov	r2, #0
-	ldr	r1, [r1, #MM_CONTEXT_ID]	@ get mm->context.id
+	mmid	r1, r1				@ get mm->context.id
 	ALT_SMP(orr	r0, r0, #TTB_FLAGS_SMP)
 	ALT_UP(orr	r0, r0, #TTB_FLAGS_UP)
 #ifdef CONFIG_ARM_ERRATA_430973
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index 7b56386..50bf1da 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -47,7 +47,7 @@
  */
 ENTRY(cpu_v7_switch_mm)
 #ifdef CONFIG_MMU
-	ldr	r1, [r1, #MM_CONTEXT_ID]	@ get mm->context.id
+	mmid	r1, r1				@ get mm->context.id
 	and	r3, r1, #0xff
 	mov	r3, r3, lsl #(48 - 32)		@ ASID
 	mcrr	p15, 0, r0, r3, c2		@ set TTB 0
-- 
1.7.10.4

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

* [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian
  2013-02-09 23:15 v3.8-rc issues with big endian Ben Dooks
  2013-02-09 23:15 ` [PATCH 1/2] ARM: mm: replace direct access to mm->context.id with new macro Ben Dooks
@ 2013-02-09 23:15 ` Ben Dooks
  2013-02-10  1:10   ` Ben Dooks
  2013-02-10 14:14   ` Sergei Shtylyov
  2013-02-11  4:35 ` v3.8-rc issues with big endian Nicolas Pitre
  2 siblings, 2 replies; 8+ messages in thread
From: Ben Dooks @ 2013-02-09 23:15 UTC (permalink / raw)
  To: linux-arm-kernel

Since the new ASID code introduced in b5466f8728527a05a493cc4abe9e6f034a1bbaab
uses 64bit operations, when running in BE mode we see the values in
mm->context.id swapped around as the lowest word is being stored in
mm->context.id + 4, instead of + 0.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/mm/proc-macros.S |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index eb6aa73..5a6a347 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -40,7 +40,11 @@
  * mmid - get context id from mm pointer (mm->context.id)
  */
 	.macro	mmid, rd, rn
+#ifdef __ARMEB__
+	ldr	\rd, [\rn, #MM_CONTEXT_ID + 4 ]
+#else
 	ldr	\rd, [\rn, #MM_CONTEXT_ID]
+#endif
 	.endm
 
 /*
-- 
1.7.10.4

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

* [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian
  2013-02-09 23:15 ` [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian Ben Dooks
@ 2013-02-10  1:10   ` Ben Dooks
  2013-02-10 14:14   ` Sergei Shtylyov
  1 sibling, 0 replies; 8+ messages in thread
From: Ben Dooks @ 2013-02-10  1:10 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/02/2013 23:15, Ben Dooks wrote:
> Since the new ASID code introduced in
> b5466f8728527a05a493cc4abe9e6f034a1bbaab
> uses 64bit operations, when running in BE mode we see the values in
> mm->context.id swapped around as the lowest word is being stored in
> mm->context.id + 4, instead of + 0.

The one thing I have just realised with this is that we are no-longer
going to be storing the mm->context.id data in the sat was a pre the
ASID changes, which could confuse debuggers which assume they can read
the data.

Should we fix this the easy way below, or go and change the code
in arch/arm/mm/context.c to deal with re-arranging the atomic64
accesses when in big-endian mode?

> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
>  arch/arm/mm/proc-macros.S |    4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> index eb6aa73..5a6a347 100644
> --- a/arch/arm/mm/proc-macros.S
> +++ b/arch/arm/mm/proc-macros.S
> @@ -40,7 +40,11 @@
>   * mmid - get context id from mm pointer (mm->context.id)
>   */
>  	.macro	mmid, rd, rn
> +#ifdef __ARMEB__
> +	ldr	\rd, [\rn, #MM_CONTEXT_ID + 4 ]
> +#else
>  	ldr	\rd, [\rn, #MM_CONTEXT_ID]
> +#endif
>  	.endm
>
>  /*

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

* [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian
  2013-02-09 23:15 ` [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian Ben Dooks
  2013-02-10  1:10   ` Ben Dooks
@ 2013-02-10 14:14   ` Sergei Shtylyov
  2013-02-10 14:17     ` Ben Dooks
  1 sibling, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2013-02-10 14:14 UTC (permalink / raw)
  To: linux-arm-kernel

Hello.

On 10-02-2013 3:15, Ben Dooks wrote:

> Since the new ASID code introduced in b5466f8728527a05a493cc4abe9e6f034a1bbaab

    Plase also specify that commit's summary in parens (or however you like).

> uses 64bit operations, when running in BE mode we see the values in
> mm->context.id swapped around as the lowest word is being stored in
> mm->context.id + 4, instead of + 0.

> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

WBR, Sergei

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

* [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian
  2013-02-10 14:14   ` Sergei Shtylyov
@ 2013-02-10 14:17     ` Ben Dooks
  0 siblings, 0 replies; 8+ messages in thread
From: Ben Dooks @ 2013-02-10 14:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/02/2013 14:14, Sergei Shtylyov wrote:
> Hello.
>
> On 10-02-2013 3:15, Ben Dooks wrote:
>
>> Since the new ASID code introduced in 
>> b5466f8728527a05a493cc4abe9e6f034a1bbaab
>
>    Plase also specify that commit's summary in parens (or however you 
> like).
>
>> uses 64bit operations, when running in BE mode we see the values in
>> mm->context.id swapped around as the lowest word is being stored in
>> mm->context.id + 4, instead of + 0.
>
>> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
>
> WBR, Sergei

Thanks, will sort that out and also take into account other feedback 
and
put new patches out today.

-- 
Ben

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

* [PATCH 1/2] ARM: mm: replace direct access to mm->context.id with new macro
  2013-02-10 14:57 [FIX v2] v3.8-rc: fix for MM ASID code in BE mode Ben Dooks
@ 2013-02-10 14:57 ` Ben Dooks
  0 siblings, 0 replies; 8+ messages in thread
From: Ben Dooks @ 2013-02-10 14:57 UTC (permalink / raw)
  To: linux-arm-kernel

The mmid macro is meant to be used to get the mm->context.id data
from the mm structure, but it seems to have been missed in a cuple
of files.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/mm/proc-v6.S        |    2 +-
 arch/arm/mm/proc-v7-2level.S |    2 +-
 arch/arm/mm/proc-v7-3level.S |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 09c5233..bcaaa8d 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -101,7 +101,7 @@ ENTRY(cpu_v6_dcache_clean_area)
 ENTRY(cpu_v6_switch_mm)
 #ifdef CONFIG_MMU
 	mov	r2, #0
-	ldr	r1, [r1, #MM_CONTEXT_ID]	@ get mm->context.id
+	mmid	r1, r1				@ get mm->context.id
 	ALT_SMP(orr	r0, r0, #TTB_FLAGS_SMP)
 	ALT_UP(orr	r0, r0, #TTB_FLAGS_UP)
 	mcr	p15, 0, r2, c7, c5, 6		@ flush BTAC/BTB
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
index 6d98c13..78f520b 100644
--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -40,7 +40,7 @@
 ENTRY(cpu_v7_switch_mm)
 #ifdef CONFIG_MMU
 	mov	r2, #0
-	ldr	r1, [r1, #MM_CONTEXT_ID]	@ get mm->context.id
+	mmid	r1, r1				@ get mm->context.id
 	ALT_SMP(orr	r0, r0, #TTB_FLAGS_SMP)
 	ALT_UP(orr	r0, r0, #TTB_FLAGS_UP)
 #ifdef CONFIG_ARM_ERRATA_430973
diff --git a/arch/arm/mm/proc-v7-3level.S b/arch/arm/mm/proc-v7-3level.S
index 7b56386..50bf1da 100644
--- a/arch/arm/mm/proc-v7-3level.S
+++ b/arch/arm/mm/proc-v7-3level.S
@@ -47,7 +47,7 @@
  */
 ENTRY(cpu_v7_switch_mm)
 #ifdef CONFIG_MMU
-	ldr	r1, [r1, #MM_CONTEXT_ID]	@ get mm->context.id
+	mmid	r1, r1				@ get mm->context.id
 	and	r3, r1, #0xff
 	mov	r3, r3, lsl #(48 - 32)		@ ASID
 	mcrr	p15, 0, r0, r3, c2		@ set TTB 0
-- 
1.7.10.4

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

* v3.8-rc issues with big endian
  2013-02-09 23:15 v3.8-rc issues with big endian Ben Dooks
  2013-02-09 23:15 ` [PATCH 1/2] ARM: mm: replace direct access to mm->context.id with new macro Ben Dooks
  2013-02-09 23:15 ` [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian Ben Dooks
@ 2013-02-11  4:35 ` Nicolas Pitre
  2 siblings, 0 replies; 8+ messages in thread
From: Nicolas Pitre @ 2013-02-11  4:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 9 Feb 2013, Ben Dooks wrote:

> Whilst debugging with big endian ARM on v3.8-rc I came across a problem
> with the new ASID code (commit b5466f8728527a05a493cc4abe9e6f034a1bbaab)
> which is causing issues with user-land failing to work.
> 
> Since the new ASID code is using 64-bit accesses, the ASID ID is now
> being placed in context->id + 4, which means that the assembly mm code
> no-longer works.
> 
> I also noticed and fixed a couple of places where the new mmid macro was
> not being used, so fixed those too.
> 
> Tested on a highbank system.
> 
>  [PATCH 1/2] ARM: mm: replace direct access to mm->context.id with
>  [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian

For both patches:

Acked-by: Nicolas Pitre <nico@linaro.org>



> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

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

end of thread, other threads:[~2013-02-11  4:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-09 23:15 v3.8-rc issues with big endian Ben Dooks
2013-02-09 23:15 ` [PATCH 1/2] ARM: mm: replace direct access to mm->context.id with new macro Ben Dooks
2013-02-09 23:15 ` [PATCH 2/2] ARM: mm: mm->context.id fix for big-endian Ben Dooks
2013-02-10  1:10   ` Ben Dooks
2013-02-10 14:14   ` Sergei Shtylyov
2013-02-10 14:17     ` Ben Dooks
2013-02-11  4:35 ` v3.8-rc issues with big endian Nicolas Pitre
  -- strict thread matches above, loose matches on Subject: below --
2013-02-10 14:57 [FIX v2] v3.8-rc: fix for MM ASID code in BE mode Ben Dooks
2013-02-10 14:57 ` [PATCH 1/2] ARM: mm: replace direct access to mm->context.id with new macro Ben Dooks

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