Merge tag 'kvmarm-fixes-5.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 28 Jan 2022 12:45:15 +0000 (07:45 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 28 Jan 2022 12:45:15 +0000 (07:45 -0500)
KVM/arm64 fixes for 5.17, take #1

- Correctly update the shadow register on exception injection when
  running in nVHE mode

- Correctly use the mm_ops indirection when performing cache invalidation
  from the page-table walker

- Restrict the vgic-v3 workaround for SEIS to the two known broken
  implementations

1  2 
arch/arm64/kvm/vgic/vgic-v3.c

@@@ -542,13 -542,13 +542,13 @@@ int vgic_v3_map_resources(struct kvm *k
        struct vgic_dist *dist = &kvm->arch.vgic;
        struct kvm_vcpu *vcpu;
        int ret = 0;
 -      int c;
 +      unsigned long c;
  
        kvm_for_each_vcpu(c, vcpu, kvm) {
                struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
  
                if (IS_VGIC_ADDR_UNDEF(vgic_cpu->rd_iodev.base_addr)) {
 -                      kvm_debug("vcpu %d redistributor base not set\n", c);
 +                      kvm_debug("vcpu %ld redistributor base not set\n", c);
                        return -ENXIO;
                }
        }
@@@ -609,6 -609,18 +609,18 @@@ static int __init early_gicv4_enable(ch
  }
  early_param("kvm-arm.vgic_v4_enable", early_gicv4_enable);
  
+ static const struct midr_range broken_seis[] = {
+       MIDR_ALL_VERSIONS(MIDR_APPLE_M1_ICESTORM),
+       MIDR_ALL_VERSIONS(MIDR_APPLE_M1_FIRESTORM),
+       {},
+ };
+ static bool vgic_v3_broken_seis(void)
+ {
+       return ((kvm_vgic_global_state.ich_vtr_el2 & ICH_VTR_SEIS_MASK) &&
+               is_midr_in_range_list(read_cpuid_id(), broken_seis));
+ }
  /**
   * vgic_v3_probe - probe for a VGICv3 compatible interrupt controller
   * @info:     pointer to the GIC description
@@@ -676,9 -688,10 +688,10 @@@ int vgic_v3_probe(const struct gic_kvm_
                group1_trap = true;
        }
  
-       if (kvm_vgic_global_state.ich_vtr_el2 & ICH_VTR_SEIS_MASK) {
-               kvm_info("GICv3 with locally generated SEI\n");
+       if (vgic_v3_broken_seis()) {
+               kvm_info("GICv3 with broken locally generated SEI\n");
  
+               kvm_vgic_global_state.ich_vtr_el2 &= ~ICH_VTR_SEIS_MASK;
                group0_trap = true;
                group1_trap = true;
                if (ich_vtr_el2 & ICH_VTR_TDS_MASK)