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> --- 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 e10bb5e..7351eee 100644 --- a/arch/arm/include/asm/pgtable-3level.h +++ b/arch/arm/include/asm/pgtable-3level.h @@ -105,6 +105,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.3