v3.8-rc issues with big endian
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
PATCH 1/2 ARM: mm: replace direct access to mm->context.id with new macro
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.
--- 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(-)
arch/arm/mm/proc-v6.S +1 -1
@@ -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
arch/arm/mm/proc-v7-2level.S +1 -1
@@ -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
arch/arm/mm/proc-v7-3level.S +1 -1
@@ -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
Signature · 1 line
1.7.10.4
PATCH 2/2 ARM: mm: mm->context.id fix for big-endian
In reply to Ben DooksSince 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.
--- arch/arm/mm/proc-macros.S | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/mm/proc-macros.S +4 -0
@@ -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 /*
Signature · 1 line
1.7.10.4
PATCH 2/2 ARM: mm: mm->context.id fix for big-endian
Quoted 5 lines · Ben Dooks
Since the new ASID code introduced in
b5466f8728527a05a493cc4abe9e6f034a1bbaab
uses 64bit operations, when running in BE mode we see the values inmm->context.idswapped around as the lowest word is being stored inmm->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?
Quoted 21 lines
Signed-off-by Ben Dooks <[email protected]>--- arch/arm/mm/proc-macros.S | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/mm/proc-macros.S +4
-0@@ -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 /*
PATCH 2/2 ARM: mm: mm->context.id fix for big-endian
In reply to Ben DooksHello.
Quoted 1 line · Ben Dooks
Since the new ASID code introduced in
b5466f8728527a05a493cc4abe9e6f034a1bbaab
Plase also specify that commit's summary in parens (or however you like).
Quoted 5 lines
uses 64bit operations, when running in BE mode we see the values in
mm->context.idswapped around as the lowest word is being stored inmm->context.id+ 4, instead of + 0.Signed-off-by Ben Dooks <[email protected]>
WBR, Sergei
PATCH 2/2 ARM: mm: mm->context.id fix for big-endian
Quoted 10 lines · Sergei Shtylyov
Hello.
Quoted 2 lines · Ben Dooks
Since the new ASID code introduced in
b5466f8728527a05a493cc4abe9e6f034a1bbaabPlase also specify that commit's summary in parens (or however you
like).
Quoted 7 lines
Quoted 5 lines
uses 64bit operations, when running in BE mode we see the values in
mm->context.idswapped around as the lowest word is being stored inmm->context.id+ 4, instead of + 0.Signed-off-by Ben Dooks <[email protected]>WBR, Sergei
Thanks, will sort that out and also take into account other feedback and
put new patches out today.
Signature · 1 line
Ben
Nicolas Pitre
Acked-byQuoted 8 lines · Ben Dooks
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.
Quoted 7 lines
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.idwith [PATCH 2/2] ARM: mm:mm->context.idfix for big-endian
For both patches:
Quoted 6 lines
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel