Skip to contentSkip to conversation

v3.8-rc: fix for MM ASID code in BE mode

PATCH New Ben Dooks 3 participants 7 messages Feb 10, 2013 – Feb 11, 2013 Arm (32-bit)

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH v2 1/1 v3.8-rc: fix for MM ASID code in BE mode

This is a pair of patches to fix the ASID allocation in BE mode, and probably should be merged as soon as possible.

This is a n

Also available at:

git://git.baserock.org/delta/linux baserock/bjdooks/arm-fix-asid

[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

author
#1 lore raw

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
index 09c5233..bcaaa8d 100644
@@ -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
index 6d98c13..78f520b 100644
@@ -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
index 7b56386..50bf1da 100644
@@ -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
author
#2 lore raw

PATCH 2/2 ARM: mm: mm->context.id fix for big-endian

In reply to Ben Dooks

Since the new ASID code in [b5466f8728527a05a493cc4abe9e6f034a1bbaab] was changed to use 64bit operations it has broken the BE operation due to an issue with the MM code accessing sub-fields of mm->context.id.

When running in BE mode we see the values in mm->context.id are stored with the highest value first, so the LDR in the arch/arm/mm/proc-macros.S reads the wrong part of this field. To resolve this, change the LDR in the mmid macro to load from +4.

---
 arch/arm/mm/context.c     |    3 +++
 arch/arm/mm/proc-macros.S |    5 +++++
 2 files changed, 8 insertions(+)
arch/arm/mm/context.c +3 -0
index bc4a5e9..7a05111 100644
@@ -34,6 +34,9 @@
  * The ASID is used to tag entries in the CPU caches and TLBs.
  * The context ID is used by debuggers and trace logic, and
  * should be unique within all running processes.
+ *
+ * In big endian operation, the two 32 bit words are swapped if accesed by
+ * non 64-bit operations.
  */
 #define ASID_FIRST_VERSION	(1ULL << ASID_BITS)
 #define NUM_USER_ASIDS		(ASID_FIRST_VERSION - 1)
arch/arm/mm/proc-macros.S +5 -0
index eb6aa73..f9a0aa7 100644
@@ -38,9 +38,14 @@
 
 /*
  * mmid - get context id from mm pointer (mm->context.id)
+ * note, this field is 64bit, so in big-endian the two words are swapped too.
  */
 	.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
author
#3 lore raw

PATCH 2/2 ARM: mm: mm->context.id fix for big-endian

Quoted 4 lines · Ben Dooks

Since the new ASID code in [b5466f8728527a05a493cc4abe9e6f034a1bbaab] was changed to use 64bit operations it has broken the BE operation due
to an issue with the MM code accessing sub-fields of mm->context.id.

Fixed the ref, new patch pushed to git.

#4 lore raw

PATCH 2/2 ARM: mm: mm->context.id fix for big-endian

Quoted 6 lines · Ben Dooks
Quoted 3 lines · Ben Dooks

Since the new ASID code in [b5466f8728527a05a493cc4abe9e6f034a1bbaab] was changed to use 64bit operations it has broken the BE operation due to an issue with the MM code accessing sub-fields of mm->context.id.

Fixed the ref, new patch pushed to git.

No you haven't.

"Since the new ASID code in b5466f872 (ARM: mm: remove IPI broadcasting on ASID rollover)..."

is the correct way to refer to another patch by commit ID - both the ID _and_ its summary line. You can use a short ID but it's a good idea to add a few additional characters to avoid future hash clashes.

author
#5 lore raw

PATCH 2/2 ARM: mm: mm->context.id fix for big-endian

Quoted 8 lines · Russell King - ARM Linux
Quoted 6 lines · Ben Dooks
Quoted 3 lines · Ben Dooks

Since the new ASID code in [b5466f8728527a05a493cc4abe9e6f034a1bbaab] was changed to use 64bit operations it has broken the BE operation due to an issue with the MM code accessing sub-fields of mm->context.id.

Fixed the ref, new patch pushed to git.

Quoted 8 lines

No you haven't.

"Since the new ASID code in b5466f872 (ARM: mm: remove IPI broadcasting on ASID rollover)..."

is the correct way to refer to another patch by commit ID - both the ID _and_ its summary line. You can use a short ID but it's a good idea to add a few additional characters to avoid future hash clashes.

My repo is showing:

Since the new ASID code in b5466f8728527a05a493cc4abe9e6f034a1bbaab ("ARM: mm: remove IPI broadcasting on ASID rollover") was changed to use 64bit operations it has broken the BE operation due to an issue with the MM code accessing sub-fields of mm->context.id.

Would you like the commit-id shortened?
Is there anything else before this pair can be pulled?

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#6 lore raw

PATCH 2/2 ARM: mm: mm->context.id fix for big-endian

Quoted 20 lines · Ben Dooks
Quoted 8 lines · Russell King - ARM Linux
Quoted 6 lines · Ben Dooks
Quoted 3 lines · Ben Dooks

Since the new ASID code in [b5466f8728527a05a493cc4abe9e6f034a1bbaab] was changed to use 64bit operations it has broken the BE operation due to an issue with the MM code accessing sub-fields of mm->context.id.

Fixed the ref, new patch pushed to git.

Quoted 8 lines

No you haven't.

"Since the new ASID code in b5466f872 (ARM: mm: remove IPI broadcasting on ASID rollover)..."

is the correct way to refer to another patch by commit ID - both the ID _and_ its summary line. You can use a short ID but it's a good idea to add a few additional characters to avoid future hash clashes.

My repo is showing:

Quoted 7 lines

Since the new ASID code in b5466f8728527a05a493cc4abe9e6f034a1bbaab ("ARM: mm: remove IPI broadcasting on ASID rollover") was changed to use 64bit operations it has broken the BE operation due to an issue with the MM code accessing sub-fields of mm->context.id.

Would you like the commit-id shortened?
Is there anything else before this pair can be pulled?

You can add my acked-by if you like:

Given that these are two small patches without any dependencies, it's probably easier to stick them in the patch system (which will also resolve any confusion about the form of the final commits).

Cheers,

Will