Skip to contentSkip to conversation

xen/arm: Update VTCR to use region size of 2^40 bytes instead of 2^39

PATCH In review Julien Grall 3 participants 4 messages Jun 6, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Update VTCR to use region size of 2^40 bytes instead of 2^39

According to the ARM manual, T0SZ is a 4-bit signed integer. The current value of T0SZ = b1000 which is equal to -7. This is result to a size of 2^39 bytes instead of the desired value 2^40.

---
 xen/arch/arm/mm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/mm.c +2 -2
index d1290cd..7d4e186 100644
@@ -315,9 +315,9 @@ void __cpuinit setup_virt_paging(void)
     /* Setup Stage 2 address translation */
     /* SH0=00, ORGN0=IRGN0=01
      * SL0=01 (Level-1)
-     * T0SZ=(1)1000 = -8 (40 bit physical addresses)
+     * T0SZ=(1)1111 = -8 (40 bit physical addresses)
      */
-    WRITE_SYSREG32(0x80002558, VTCR_EL2); isb();
+    WRITE_SYSREG32(0x8000255f, VTCR_EL2); isb();
 }
 
 /* This needs to be a macro to stop the compiler spilling to the stack
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 2 lines · Julien Grall

According to the ARM manual, T0SZ is a 4-bit signed integer. The current value of T0SZ = b1000 which is equal to -7. This is result

Really? By my count, 4-bit -7 is b1001 and b1000 is indeed -8.

Quoted 12 lines

to a size of 2^39 bytes instead of the desired value 2^40.

---
 xen/arch/arm/mm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/mm.c +0 -0
index d1290cd..7d4e186 100644

xen/arch/arm/mm.c void __cpuinit setup_virt_paging(void) · line 318

Quoted 5 lines
xen/arch/arm/mm.c +1 -1
@@ -315,9 +315,9 @@ void __cpuinit setup_virt_paging(void)
     /* Setup Stage 2 address translation */
     /* SH0=00, ORGN0=IRGN0=01
      * SL0=01 (Level-1)
-     * T0SZ=(1)1000 = -8 (40 bit physical addresses)
+     * T0SZ=(1)1111 = -8 (40 bit physical addresses)

That's certainly wrong: b1111 must be -1.

Tim.

Quoted 14 lines
xen/arch/arm/mm.c +1 -1
      */
-    WRITE_SYSREG32(0x80002558, VTCR_EL2); isb();
+    WRITE_SYSREG32(0x8000255f, VTCR_EL2); isb();
 }
 
 /* This needs to be a macro to stop the compiler spilling to the stack
Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw
Quoted 5 lines · Tim Deegan
Quoted 2 lines · Julien Grall

According to the ARM manual, T0SZ is a 4-bit signed integer. The current value of T0SZ = b1000 which is equal to -7. This is result

Really? By my count, 4-bit -7 is b1001 and b1000 is indeed -8.

Tim is right on this one:

https://en.wikipedia.org/wiki/Two%27s_complement

Quoted 7 lines
Quoted 7 lines

to a size of 2^39 bytes instead of the desired value 2^40.

---
 xen/arch/arm/mm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 12 lines

xen/arch/arm/mm.c void __cpuinit setup_virt_paging(void) · line 318

Quoted 10 lines
xen/arch/arm/mm.c +1 -1
index d1290cd..7d4e186 100644
@@ -315,9 +315,9 @@ void __cpuinit setup_virt_paging(void)
     /* Setup Stage 2 address translation */
     /* SH0=00, ORGN0=IRGN0=01
      * SL0=01 (Level-1)
-     * T0SZ=(1)1000 = -8 (40 bit physical addresses)
+     * T0SZ=(1)1111 = -8 (40 bit physical addresses)

That's certainly wrong: b1111 must be -1.

right

Quoted 15 lines
Quoted 14 lines
xen/arch/arm/mm.c +1 -1
      */
-    WRITE_SYSREG32(0x80002558, VTCR_EL2); isb();
+    WRITE_SYSREG32(0x8000255f, VTCR_EL2); isb();
 }
 
 /* This needs to be a macro to stop the compiler spilling to the stack
Signature · 7 lines
1.7.10.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#3 lore raw
In reply to Tim Deegan
Quoted 5 lines · Tim Deegan
Quoted 2 lines · Julien Grall

According to the ARM manual, T0SZ is a 4-bit signed integer. The current value of T0SZ = b1000 which is equal to -7. This is result

Really? By my count, 4-bit -7 is b1001 and b1000 is indeed -8.

Indeed :/. I don't know why I find this value by hand.

Signature · 1 line
Julien