Skip to content

Commit 2441418

Browse files
author
Marc Zyngier
committed
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 <[email protected]>
1 parent d6a01a2 commit 2441418

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arch/arm64/kvm/nested.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,14 @@ int kvm_init_nv_sysregs(struct kvm *kvm)
11781178
if (!kvm_has_feat(kvm, ID_AA64PFR0_EL1, AMU, V1P1))
11791179
res0 |= ~(res0 | res1);
11801180
set_sysreg_masks(kvm, HAFGRTR_EL2, res0, res1);
1181+
1182+
/* SCTLR_EL1 */
1183+
res0 = SCTLR_EL1_RES0;
1184+
res1 = SCTLR_EL1_RES1;
1185+
if (!kvm_has_feat(kvm, ID_AA64MMFR1_EL1, PAN, PAN3))
1186+
res0 |= SCTLR_EL1_EPAN;
1187+
set_sysreg_masks(kvm, SCTLR_EL1, res0, res1);
1188+
11811189
out:
11821190
mutex_unlock(&kvm->arch.config_lock);
11831191

0 commit comments

Comments
 (0)