Skip to content

Commit d95bb9e

Browse files
author
Marc Zyngier
committed
KVM: arm64: nv: Make AT+PAN instructions aware of FEAT_PAN3
FEAT_PAN3 added a check for executable permissions to FEAT_PAN2. Add the required SCTLR_ELx.EPAN and descriptor checks to handle this correctly. Reviewed-by: Alexandru Elisei <[email protected]> Signed-off-by: Marc Zyngier <[email protected]>
1 parent 2441418 commit d95bb9e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

arch/arm64/kvm/at.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,21 @@ static u64 compute_par_s1(struct kvm_vcpu *vcpu, struct s1_walk_result *wr,
731731
return par;
732732
}
733733

734+
static bool pan3_enabled(struct kvm_vcpu *vcpu, enum trans_regime regime)
735+
{
736+
u64 sctlr;
737+
738+
if (!kvm_has_feat(vcpu->kvm, ID_AA64MMFR1_EL1, PAN, PAN3))
739+
return false;
740+
741+
if (regime == TR_EL10)
742+
sctlr = vcpu_read_sys_reg(vcpu, SCTLR_EL1);
743+
else
744+
sctlr = vcpu_read_sys_reg(vcpu, SCTLR_EL2);
745+
746+
return sctlr & SCTLR_EL1_EPAN;
747+
}
748+
734749
static u64 handle_at_slow(struct kvm_vcpu *vcpu, u32 op, u64 vaddr)
735750
{
736751
bool perm_fail, ur, uw, ux, pr, pw, px;
@@ -797,7 +812,7 @@ static u64 handle_at_slow(struct kvm_vcpu *vcpu, u32 op, u64 vaddr)
797812
bool pan;
798813

799814
pan = *vcpu_cpsr(vcpu) & PSR_PAN_BIT;
800-
pan &= ur || uw;
815+
pan &= ur || uw || (pan3_enabled(vcpu, wi.regime) && ux);
801816
pw &= !pan;
802817
pr &= !pan;
803818
}

0 commit comments

Comments
 (0)