Skip to contentSkip to conversation

xen:arm: arm64: Add correct MPIDR_HWID_MASK value for ARM64

PATCH Superseded Wei Chen 2 participants 2 messages May 25, 2016

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wei Chen

author
#0 lore raw

PATCH 3/4 xen:arm: arm64: Add correct MPIDR_HWID_MASK value for ARM64

Current MPIDR_HWID_MASK is using the bit definition of ARM32 MPIDR. This value is not correct while Xen is running on ARM64. Now, we add a correct value for this marco on ARM64. But this value is not a valid 64-bit immediate which can be encoded in mov instruction. So we have to use ldr to load this value to register.

---
 xen/arch/arm/arm64/head.S       | 2 +-
 xen/include/asm-arm/processor.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
xen/arch/arm/arm64/head.S +1 -1
index d5831f2..3090beb 100644
@@ -270,7 +270,7 @@ common_start:
         tbz   x0, _MPIDR_SMP, 1f     /* Multiprocessor extension not supported? */
         tbnz  x0, _MPIDR_UP, 1f      /* Uniprocessor system? */
 
-        mov   x13, #(~MPIDR_HWID_MASK)
+        ldr   x13, =(~MPIDR_HWID_MASK)
         bic   x24, x0, x13           /* Mask out flags to get CPU ID */
 1:
 
xen/include/asm-arm/processor.h +4 -0
index b4cce7e..284ad6a 100644
@@ -18,7 +18,11 @@
 #define MPIDR_SMP           (_AC(1,U) << _MPIDR_SMP)
 #define MPIDR_AFF0_SHIFT    (0)
 #define MPIDR_AFF0_MASK     (_AC(0xff,U) << MPIDR_AFF0_SHIFT)
+#ifdef CONFIG_ARM_64
+#define MPIDR_HWID_MASK     _AC(0xff00ffffff,UL)
+#else
 #define MPIDR_HWID_MASK     _AC(0xffffff,U)
+#endif
 #define MPIDR_INVALID       (~MPIDR_HWID_MASK)
 #define MPIDR_LEVEL_BITS    (8)
 
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#1 lore raw

Hi Wei,

Title: "Fix the MPIDR_HWID_MASK value for ARM64".

Quoted 1 line · Wei Chen

Current MPIDR_HWID_MASK is using the bit definition of ARM32 MPIDR.

s/Current/Currently/

Quoted 1 line

This value is not correct while Xen is running on ARM64.

I think s/while/when/

Quoted 1 line

Now, we add a correct value for this marco on ARM64. But this value

s/marco/macro/

Quoted 2 lines

is not a valid 64-bit immediate which can be encoded in mov instruction. So we have to use ldr to load this value to register.

You need to explain what is the valid value, i.e there is 4 level of affinity whilst AArch32 has only 3. It would be good to mention the spec too.

Quoted 27 lines
---
  xen/arch/arm/arm64/head.S       | 2 +-
  xen/include/asm-arm/processor.h | 4 ++++
  2 files changed, 5 insertions(+), 1 deletion(-)
xen/arch/arm/arm64/head.S +1 -1
index d5831f2..3090beb 100644
@@ -270,7 +270,7 @@ common_start:
          tbz   x0, _MPIDR_SMP, 1f     /* Multiprocessor extension not supported? */
          tbnz  x0, _MPIDR_UP, 1f      /* Uniprocessor system? */
 
-        mov   x13, #(~MPIDR_HWID_MASK)
+        ldr   x13, =(~MPIDR_HWID_MASK)
          bic   x24, x0, x13           /* Mask out flags to get CPU ID */
  1:
 
xen/include/asm-arm/processor.h +0 -0
index b4cce7e..284ad6a 100644
@@ -18,7 +18,11 @@
  #define MPIDR_SMP           (_AC(1,U) << _MPIDR_SMP)

xen/include/asm-arm/processor.h line 28

Quoted 10 lines
xen/include/asm-arm/processor.h +4 -0
  #define MPIDR_AFF0_SHIFT    (0)
  #define MPIDR_AFF0_MASK     (_AC(0xff,U) << MPIDR_AFF0_SHIFT)
+#ifdef CONFIG_ARM_64
+#define MPIDR_HWID_MASK     _AC(0xff00ffffff,UL)
+#else
  #define MPIDR_HWID_MASK     _AC(0xffffff,U)
+#endif
  #define MPIDR_INVALID       (~MPIDR_HWID_MASK)
  #define MPIDR_LEVEL_BITS    (8)
 

Regards,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel