[Android-virt] [PATCH] ARM: KVM: upgrade shareability to the inner domain in stage2 translation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On an SMP host, it is important that a write from a VCPU running on a
given CPU is observable from the same VCPU after being migrated to
another CPU.

Failure to do so could result in horrible things happening when
running a UP guest on a SMP host.

Set the shareability to "inner-shareable" in the stage2 translation
tables to upgrade the guest shareability.

Signed-off-by: Marc Zyngier <marc.zyngier at arm.com>
---
Pushed to my kvm-arm-mm-3.4-rc7 branch

 arch/arm/include/asm/pgtable-3level.h |    1 +
 arch/arm/include/asm/pgtable.h        |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
index 6dc5331..4e19b86 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
@@ -107,6 +107,7 @@
 /*
  * 2-nd stage PTE definitions for LPAE.
  */
+#define L_PTE2_SHARED		L_PTE_SHARED
 #define L_PTE2_READ		(_AT(pteval_t, 1) << 6)	/* HAP[0] */
 #define L_PTE2_WRITE		(_AT(pteval_t, 1) << 7)	/* HAP[1] */
 #define L_PTE2_NORM_WB		(_AT(pteval_t, 3) << 4)	/* MemAttr[3:2] */
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index 2561a8b..fffc01f 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -86,7 +86,7 @@ extern pgprot_t		pgprot_guest;
 #define PAGE_HYP		_MOD_PROT(pgprot_kernel, L_PTE_USER)
 #define PAGE_KVM_GUEST		_MOD_PROT(pgprot_guest, L_PTE2_READ | \
 					  L_PTE2_WRITE | L_PTE2_NORM_WB | \
-					  L_PTE2_INNER_WB)
+					  L_PTE2_INNER_WB | L_PTE2_SHARED)
 
 #define __PAGE_NONE		__pgprot(_L_PTE_DEFAULT | L_PTE_RDONLY | L_PTE_XN)
 #define __PAGE_SHARED		__pgprot(_L_PTE_DEFAULT | L_PTE_USER | L_PTE_XN)
-- 
1.7.10.1





[Index of Archives]     [Linux KVM]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux