]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: nv: Plumb handling of AT S1* traps from EL2
authorMarc Zyngier <maz@kernel.org>
Wed, 19 Jun 2024 07:14:45 +0000 (08:14 +0100)
committerMarc Zyngier <maz@kernel.org>
Fri, 30 Aug 2024 11:04:20 +0000 (12:04 +0100)
Hooray, we're done. Plug the AT traps into the system instruction
table, and let it rip.

Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/sys_regs.c

index e7e5e0df119e9ea1d7ca8764f8090336f301b4b8..9f3cf82e5231b63648198c9d80c2fa984d1beb64 100644 (file)
@@ -2803,6 +2803,36 @@ static const struct sys_reg_desc sys_reg_descs[] = {
        EL2_REG(SP_EL2, NULL, reset_unknown, 0),
 };
 
+static bool handle_at_s1e01(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
+                           const struct sys_reg_desc *r)
+{
+       u32 op = sys_insn(p->Op0, p->Op1, p->CRn, p->CRm, p->Op2);
+
+       __kvm_at_s1e01(vcpu, op, p->regval);
+
+       return true;
+}
+
+static bool handle_at_s1e2(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
+                          const struct sys_reg_desc *r)
+{
+       u32 op = sys_insn(p->Op0, p->Op1, p->CRn, p->CRm, p->Op2);
+
+       __kvm_at_s1e2(vcpu, op, p->regval);
+
+       return true;
+}
+
+static bool handle_at_s12(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
+                         const struct sys_reg_desc *r)
+{
+       u32 op = sys_insn(p->Op0, p->Op1, p->CRn, p->CRm, p->Op2);
+
+       __kvm_at_s12(vcpu, op, p->regval);
+
+       return true;
+}
+
 static bool kvm_supported_tlbi_s12_op(struct kvm_vcpu *vpcu, u32 instr)
 {
        struct kvm *kvm = vpcu->kvm;
@@ -3065,6 +3095,14 @@ static struct sys_reg_desc sys_insn_descs[] = {
        { SYS_DESC(SYS_DC_ISW), access_dcsw },
        { SYS_DESC(SYS_DC_IGSW), access_dcgsw },
        { SYS_DESC(SYS_DC_IGDSW), access_dcgsw },
+
+       SYS_INSN(AT_S1E1R, handle_at_s1e01),
+       SYS_INSN(AT_S1E1W, handle_at_s1e01),
+       SYS_INSN(AT_S1E0R, handle_at_s1e01),
+       SYS_INSN(AT_S1E0W, handle_at_s1e01),
+       SYS_INSN(AT_S1E1RP, handle_at_s1e01),
+       SYS_INSN(AT_S1E1WP, handle_at_s1e01),
+
        { SYS_DESC(SYS_DC_CSW), access_dcsw },
        { SYS_DESC(SYS_DC_CGSW), access_dcgsw },
        { SYS_DESC(SYS_DC_CGDSW), access_dcgsw },
@@ -3144,6 +3182,13 @@ static struct sys_reg_desc sys_insn_descs[] = {
        SYS_INSN(TLBI_VALE1NXS, handle_tlbi_el1),
        SYS_INSN(TLBI_VAALE1NXS, handle_tlbi_el1),
 
+       SYS_INSN(AT_S1E2R, handle_at_s1e2),
+       SYS_INSN(AT_S1E2W, handle_at_s1e2),
+       SYS_INSN(AT_S12E1R, handle_at_s12),
+       SYS_INSN(AT_S12E1W, handle_at_s12),
+       SYS_INSN(AT_S12E0R, handle_at_s12),
+       SYS_INSN(AT_S12E0W, handle_at_s12),
+
        SYS_INSN(TLBI_IPAS2E1IS, handle_ipas2e1is),
        SYS_INSN(TLBI_RIPAS2E1IS, handle_ripas2e1is),
        SYS_INSN(TLBI_IPAS2LE1IS, handle_ipas2e1is),