Skip to contentSkip to conversation

ARM: KVM: fix L_PTE_S2_RDWR to actually be Read/Write

PATCH New Marc Zyngier 3 participants 5 messages Apr 12, 2013 – Apr 15, 2013 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: KVM: fix L_PTE_S2_RDWR to actually be Read/Write

Looks like our L_PTE_S2_RDWR definition is slightly wrong, and is actually write only (see ARM ARM Table B3-9, Stage 2 control of access permissions). Didn't make a difference for normal pages, as we OR the flags together, but I'm still wondering how it worked for Stage-2 mapped devices, such as the GIC.

Brown paper bag time, again.

---
 arch/arm/include/asm/pgtable-3level.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/pgtable-3level.h +1 -1
index 6ef8afd..86b8fe3 100644
@@ -111,7 +111,7 @@
 #define L_PTE_S2_MT_WRITETHROUGH (_AT(pteval_t, 0xa) << 2) /* MemAttr[3:0] */
 #define L_PTE_S2_MT_WRITEBACK	 (_AT(pteval_t, 0xf) << 2) /* MemAttr[3:0] */
 #define L_PTE_S2_RDONLY		 (_AT(pteval_t, 1) << 6)   /* HAP[1]   */
-#define L_PTE_S2_RDWR		 (_AT(pteval_t, 2) << 6)   /* HAP[2:1] */
+#define L_PTE_S2_RDWR		 (_AT(pteval_t, 3) << 6)   /* HAP[2:1] */
 
 /*
  * Hyp-mode PL2 PTE definitions for LPAE.
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/1 ARM: KVM: fix L_PTE_S2_RDWR to actually be Read/Write

Quoted 9 lines · Marc Zyngier

Looks like our L_PTE_S2_RDWR definition is slightly wrong, and is actually write only (see ARM ARM Table B3-9, Stage 2 control of access permissions). Didn't make a difference for normal pages, as we OR the flags together, but I'm still wondering how it worked for Stage-2 mapped devices, such as the GIC.

Brown paper bag time, again.

CC stable?

Alex

Quoted 26 lines

---
arch/arm/include/asm/pgtable-3level.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/pgtable-3level.h +1 -1
index 6ef8afd..86b8fe3 100644
@@ -111,7 +111,7 @@
 #define L_PTE_S2_MT_WRITETHROUGH (_AT(pteval_t, 0xa) << 2) /* MemAttr[3:0] */
 #define L_PTE_S2_MT_WRITEBACK	 (_AT(pteval_t, 0xf) << 2) /* MemAttr[3:0] */
 #define L_PTE_S2_RDONLY		 (_AT(pteval_t, 1) << 6)   /* HAP[1]   */
-#define L_PTE_S2_RDWR		 (_AT(pteval_t, 2) << 6)   /* HAP[2:1] */
+#define L_PTE_S2_RDWR		 (_AT(pteval_t, 3) << 6)   /* HAP[2:1] */
 
 /*
 * Hyp-mode PL2 PTE definitions for LPAE.
Signature · 8 lines
1.8.1.4



_______________________________________________
kvmarm mailing list
kvmarm at lists.cs.columbia.edu
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm
#2 lore raw

PATCH 1/1 ARM: KVM: fix L_PTE_S2_RDWR to actually be Read/Write

Quoted 9 lines · Alexander Graf
Quoted 6 lines · Marc Zyngier

Looks like our L_PTE_S2_RDWR definition is slightly wrong, and is actually write only (see ARM ARM Table B3-9, Stage 2 control of access permissions). Didn't make a difference for normal pages, as we OR the flags together, but I'm still wondering how it worked for Stage-2 mapped devices, such as the GIC.

Quoted 5 lines
Quoted 3 lines

Brown paper bag time, again.

CC stable?

Only if this doesn't make it into the final 3.9, which will be the first version with KVM/arm.

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#3 lore raw

PATCH 1/1 ARM: KVM: fix L_PTE_S2_RDWR to actually be Read/Write

Quoted 10 lines · Marc Zyngier
Quoted 9 lines · Alexander Graf
Quoted 6 lines · Marc Zyngier

Looks like our L_PTE_S2_RDWR definition is slightly wrong, and is actually write only (see ARM ARM Table B3-9, Stage 2 control of access permissions). Didn't make a difference for normal pages, as we OR the flags together, but I'm still wondering how it worked for Stage-2 mapped devices, such as the GIC.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Brown paper bag time, again.

CC stable?

Only if this doesn't make it into the final 3.9, which will be the first version with KVM/arm.

Given that we're at rc6, I'd presume that's rather likely if you don't make a fuss about it :)

Alex

#4 lore raw

PATCH 1/1 ARM: KVM: fix L_PTE_S2_RDWR to actually be Read/Write

In reply to Marc Zyngier
Quoted 5 lines · Marc Zyngier

Looks like our L_PTE_S2_RDWR definition is slightly wrong, and is actually write only (see ARM ARM Table B3-9, Stage 2 control of access permissions). Didn't make a difference for normal pages, as we OR the flags together, but I'm still wondering how it worked for Stage-2 mapped devices, such as the GIC.

PAGE_S2_DEVICE uses L_PTE_USER which sets bit 6, so that's why it works.

The define used to be called _WRITE, which is how this creeped in. We should probably change this to be completely independent of L_PTE_USER, I'll cook up a patch.

Quoted 2 lines

Brown paper bag time, again.

thanks

Quoted 28 lines
---
 arch/arm/include/asm/pgtable-3level.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/pgtable-3level.h +1 -2
index 6ef8afd..86b8fe3 100644
@@ -111,7 +111,7 @@
 #define L_PTE_S2_MT_WRITETHROUGH (_AT(pteval_t, 0xa) << 2) /* MemAttr[3:0] */
 #define L_PTE_S2_MT_WRITEBACK   (_AT(pteval_t, 0xf) << 2) /* MemAttr[3:0] */
 #define L_PTE_S2_RDONLY                 (_AT(pteval_t, 1) << 6)   /* HAP[1]   */
-#define L_PTE_S2_RDWR           (_AT(pteval_t, 2) << 6)   /* HAP[2:1] */
+#define L_PTE_S2_RDWR           (_AT(pteval_t, 3) << 6)   /* HAP[2:1] */
 
 /*
  * Hyp-mode PL2 PTE definitions for LPAE.
--

1.8.1.4

_______________________________________________
kvmarm mailing list
kvmarm at lists.cs.columbia.edu
https://lists.cs.columbia.edu/cucslists/listinfo/kvmarm