Merge tag 'kvmarm-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmar...
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Jan 2022 15:42:19 +0000 (10:42 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 7 Jan 2022 15:42:19 +0000 (10:42 -0500)
KVM/arm64 updates for Linux 5.16

- Simplification of the 'vcpu first run' by integrating it into
  KVM's 'pid change' flow

- Refactoring of the FP and SVE state tracking, also leading to
  a simpler state and less shared data between EL1 and EL2 in
  the nVHE case

- Tidy up the header file usage for the nvhe hyp object

- New HYP unsharing mechanism, finally allowing pages to be
  unmapped from the Stage-1 EL2 page-tables

- Various pKVM cleanups around refcounting and sharing

- A couple of vgic fixes for bugs that would trigger once
  the vcpu xarray rework is merged, but not sooner

- Add minimal support for ARMv8.7's PMU extension

- Rework kvm_pgtable initialisation ahead of the NV work

- New selftest for IRQ injection

- Teach selftests about the lack of default IPA space and
  page sizes

- Expand sysreg selftest to deal with Pointer Authentication

- The usual bunch of cleanups and doc update

19 files changed:
1  2 
arch/arm64/include/asm/kvm_emulate.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/Makefile
arch/arm64/kvm/arm.c
arch/arm64/kvm/hyp/include/hyp/switch.h
arch/arm64/kvm/hyp/nvhe/switch.c
arch/arm64/kvm/hyp/vhe/switch.c
arch/arm64/kvm/mmu.c
arch/arm64/kvm/pmu-emul.c
arch/arm64/kvm/psci.c
arch/arm64/kvm/reset.c
arch/arm64/kvm/vgic/vgic-init.c
arch/arm64/kvm/vgic/vgic-mmio-v3.c
arch/arm64/kvm/vgic/vgic-v3.c
include/linux/kvm_host.h
tools/testing/selftests/kvm/.gitignore
tools/testing/selftests/kvm/Makefile
tools/testing/selftests/kvm/include/kvm_util.h
tools/testing/selftests/kvm/lib/kvm_util.c

Simple merge
Simple merge
@@@ -10,10 -10,12 +10,10 @@@ include $(srctree)/virt/kvm/Makefile.kv
  obj-$(CONFIG_KVM) += kvm.o
  obj-$(CONFIG_KVM) += hyp/
  
 -kvm-y := $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o $(KVM)/eventfd.o \
 -       $(KVM)/vfio.o $(KVM)/irqchip.o $(KVM)/binary_stats.o \
 -       arm.o mmu.o mmio.o psci.o perf.o hypercalls.o pvtime.o \
 +kvm-y += arm.o mmu.o mmio.o psci.o perf.o hypercalls.o pvtime.o \
         inject_fault.o va_layout.o handle_exit.o \
         guest.o debug.o reset.o sys_regs.o \
-        vgic-sys-reg-v3.o fpsimd.o pmu.o \
+        vgic-sys-reg-v3.o fpsimd.o pmu.o pkvm.o \
         arch_timer.o trng.o\
         vgic/vgic.o vgic/vgic-init.o \
         vgic/vgic-irqfd.o vgic/vgic-v2.o \
@@@ -179,7 -181,15 +179,9 @@@ void kvm_arch_destroy_vm(struct kvm *kv
  
        kvm_vgic_destroy(kvm);
  
 -      for (i = 0; i < KVM_MAX_VCPUS; ++i) {
 -              if (kvm->vcpus[i]) {
 -                      kvm_vcpu_destroy(kvm->vcpus[i]);
 -                      kvm->vcpus[i] = NULL;
 -              }
 -      }
 -      atomic_set(&kvm->online_vcpus, 0);
 +      kvm_destroy_vcpus(kvm);
+       kvm_unshare_hyp(kvm, kvm + 1);
  }
  
  int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
@@@ -656,44 -700,6 +677,39 @@@ static void vcpu_req_sleep(struct kvm_v
        smp_rmb();
  }
  
- static int kvm_vcpu_initialized(struct kvm_vcpu *vcpu)
- {
-       return vcpu->arch.target >= 0;
- }
 +/**
 + * kvm_vcpu_wfi - emulate Wait-For-Interrupt behavior
 + * @vcpu:     The VCPU pointer
 + *
 + * Suspend execution of a vCPU until a valid wake event is detected, i.e. until
 + * the vCPU is runnable.  The vCPU may or may not be scheduled out, depending
 + * on when a wake event arrives, e.g. there may already be a pending wake event.
 + */
 +void kvm_vcpu_wfi(struct kvm_vcpu *vcpu)
 +{
 +      /*
 +       * Sync back the state of the GIC CPU interface so that we have
 +       * the latest PMR and group enables. This ensures that
 +       * kvm_arch_vcpu_runnable has up-to-date data to decide whether
 +       * we have pending interrupts, e.g. when determining if the
 +       * vCPU should block.
 +       *
 +       * For the same reason, we want to tell GICv4 that we need
 +       * doorbells to be signalled, should an interrupt become pending.
 +       */
 +      preempt_disable();
 +      kvm_vgic_vmcr_sync(vcpu);
 +      vgic_v4_put(vcpu, true);
 +      preempt_enable();
 +
 +      kvm_vcpu_halt(vcpu);
 +      kvm_clear_request(KVM_REQ_UNHALT, vcpu);
 +
 +      preempt_disable();
 +      vgic_v4_load(vcpu);
 +      preempt_enable();
 +}
 +
  static void check_vcpu_requests(struct kvm_vcpu *vcpu)
  {
        if (kvm_request_pending(vcpu)) {
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge