summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2024-07-15 18:22:19 +0200
committerMarc Zyngier <maz@kernel.org>2024-08-30 13:04:20 +0200
commit2441418f3aadb3f9232431aeb10d89e48a934d94 (patch)
tree51170967051c7433cdd07c8c4e9b774070f8b482 /arch/arm64/kvm
parentKVM: arm64: nv: Add SW walker for AT S1 emulation (diff)
downloadlinux-2441418f3aadb3f9232431aeb10d89e48a934d94.tar.xz
linux-2441418f3aadb3f9232431aeb10d89e48a934d94.zip
KVM: arm64: nv: Sanitise SCTLR_EL1.EPAN according to VM configuration
Ensure that SCTLR_EL1.EPAN is RES0 when FEAT_PAN3 isn't supported. Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r--arch/arm64/kvm/nested.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
index 9c8573493d80..133cc2f9530d 100644
--- a/arch/arm64/kvm/nested.c
+++ b/arch/arm64/kvm/nested.c
@@ -1178,6 +1178,14 @@ int kvm_init_nv_sysregs(struct kvm *kvm)
if (!kvm_has_feat(kvm, ID_AA64PFR0_EL1, AMU, V1P1))
res0 |= ~(res0 | res1);
set_sysreg_masks(kvm, HAFGRTR_EL2, res0, res1);
+
+ /* SCTLR_EL1 */
+ res0 = SCTLR_EL1_RES0;
+ res1 = SCTLR_EL1_RES1;
+ if (!kvm_has_feat(kvm, ID_AA64MMFR1_EL1, PAN, PAN3))
+ res0 |= SCTLR_EL1_EPAN;
+ set_sysreg_masks(kvm, SCTLR_EL1, res0, res1);
+
out:
mutex_unlock(&kvm->arch.config_lock);