KVM: arm64: Force SCTLR_EL2.WXN when running nVHE
authorMarc Zyngier <maz@kernel.org>
Wed, 10 Mar 2021 13:34:26 +0000 (13:34 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 18 Mar 2021 15:52:06 +0000 (15:52 +0000)
As the EL2 nVHE object is nicely split into sections and that
we already use differenciating permissions for data and code,
we can enable SCTLR_EL2.WXN so that we don't have to worry
about misconfiguration of the page tables.

Flip the WXN bit and get the ball running!

Acked-by: Will Deacon <will@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/include/asm/sysreg.h

index ab24d9e7eef1849acc6e38ead4d360c6d4e59549..70cbb0244e0773aab103fcac6247034bd88aa55d 100644 (file)
 
 #define INIT_SCTLR_EL2_MMU_ON                                          \
        (SCTLR_ELx_M  | SCTLR_ELx_C | SCTLR_ELx_SA | SCTLR_ELx_I |      \
-        SCTLR_ELx_IESB | ENDIAN_SET_EL2 | SCTLR_EL2_RES1)
+        SCTLR_ELx_IESB | SCTLR_ELx_WXN | ENDIAN_SET_EL2 | SCTLR_EL2_RES1)
 
 #define INIT_SCTLR_EL2_MMU_OFF \
        (SCTLR_EL2_RES1 | ENDIAN_SET_EL2)