Skip to content

Commit 874ae1d

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Handle PIR{,E0}_EL2 traps
Add the FEAT_S1PIE EL2 registers the sysreg descriptor array so that they can be handled as a trap. Access to these registers is conditional based on ID_AA64MMFR3_EL1.S1PIE being advertised. Similarly to other other changes, PIRE0_EL2 is guaranteed to trap thanks to the D22677 update to the architecture. Reviewed-by: Joey Gouly <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent b3ad940 commit 874ae1d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,18 @@ static bool access_rw(struct kvm_vcpu *vcpu,
369369
return true;
370370
}
371371

372+
static bool check_s1pie_access_rw(struct kvm_vcpu *vcpu,
373+
struct sys_reg_params *p,
374+
const struct sys_reg_desc *r)
375+
{
376+
if (!kvm_has_feat(vcpu->kvm, ID_AA64MMFR3_EL1, S1PIE, IMP)) {
377+
kvm_inject_undefined(vcpu);
378+
return false;
379+
}
380+
381+
return access_rw(vcpu, p, r);
382+
}
383+
372384
/*
373385
* See note at ARMv7 ARM B1.14.4 (TL;DR: S/W ops are not easily virtualized).
374386
*/
@@ -2909,6 +2921,8 @@ static const struct sys_reg_desc sys_reg_descs[] = {
29092921
EL2_REG(HPFAR_EL2, access_rw, reset_val, 0),
29102922

29112923
EL2_REG(MAIR_EL2, access_rw, reset_val, 0),
2924+
EL2_REG(PIRE0_EL2, check_s1pie_access_rw, reset_val, 0),
2925+
EL2_REG(PIR_EL2, check_s1pie_access_rw, reset_val, 0),
29122926
EL2_REG(AMAIR_EL2, access_rw, reset_val, 0),
29132927

29142928
EL2_REG(VBAR_EL2, access_rw, reset_val, 0),

0 commit comments

Comments
 (0)