Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 2 Nov 2021 18:24:14 +0000 (11:24 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 2 Nov 2021 18:24:14 +0000 (11:24 -0700)
Pull KVM updates from Paolo Bonzini:
 "ARM:

   - More progress on the protected VM front, now with the full fixed
     feature set as well as the limitation of some hypercalls after
     initialisation.

   - Cleanup of the RAZ/WI sysreg handling, which was pointlessly
     complicated

   - Fixes for the vgic placement in the IPA space, together with a
     bunch of selftests

   - More memcg accounting of the memory allocated on behalf of a guest

   - Timer and vgic selftests

   - Workarounds for the Apple M1 broken vgic implementation

   - KConfig cleanups

   - New kvmarm.mode=none option, for those who really dislike us

  RISC-V:

   - New KVM port.

  x86:

   - New API to control TSC offset from userspace

   - TSC scaling for nested hypervisors on SVM

   - Switch masterclock protection from raw_spin_lock to seqcount

   - Clean up function prototypes in the page fault code and avoid
     repeated memslot lookups

   - Convey the exit reason to userspace on emulation failure

   - Configure time between NX page recovery iterations

   - Expose Predictive Store Forwarding Disable CPUID leaf

   - Allocate page tracking data structures lazily (if the i915 KVM-GT
     functionality is not compiled in)

   - Cleanups, fixes and optimizations for the shadow MMU code

  s390:

   - SIGP Fixes

   - initial preparations for lazy destroy of secure VMs

   - storage key improvements/fixes

   - Log the guest CPNC

  Starting from this release, KVM-PPC patches will come from Michael
  Ellerman's PPC tree"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (227 commits)
  RISC-V: KVM: fix boolreturn.cocci warnings
  RISC-V: KVM: remove unneeded semicolon
  RISC-V: KVM: Fix GPA passed to __kvm_riscv_hfence_gvma_xyz() functions
  RISC-V: KVM: Factor-out FP virtualization into separate sources
  KVM: s390: add debug statement for diag 318 CPNC data
  KVM: s390: pv: properly handle page flags for protected guests
  KVM: s390: Fix handle_sske page fault handling
  KVM: x86: SGX must obey the KVM_INTERNAL_ERROR_EMULATION protocol
  KVM: x86: On emulation failure, convey the exit reason, etc. to userspace
  KVM: x86: Get exit_reason as part of kvm_x86_ops.get_exit_info
  KVM: x86: Clarify the kvm_run.emulation_failure structure layout
  KVM: s390: Add a routine for setting userspace CPU state
  KVM: s390: Simplify SIGP Set Arch handling
  KVM: s390: pv: avoid stalls when making pages secure
  KVM: s390: pv: avoid stalls for kvm_s390_pv_init_vm
  KVM: s390: pv: avoid double free of sida page
  KVM: s390: pv: add macros for UVC CC values
  s390/mm: optimize reset_guest_reference_bit()
  s390/mm: optimize set_guest_storage_key()
  s390/mm: no need for pte_alloc_map_lock() if we know the pmd is present
  ...

17 files changed:
1  2 
Documentation/admin-guide/kernel-parameters.txt
MAINTAINERS
arch/arm64/Kconfig
arch/arm64/include/asm/kvm_asm.h
arch/arm64/include/asm/sysreg.h
arch/arm64/kvm/hyp/include/hyp/switch.h
arch/arm64/kvm/reset.c
arch/powerpc/include/asm/kvm_host.h
arch/riscv/Kconfig
arch/riscv/kernel/asm-offsets.c
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/svm/sev.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/svm/svm.h
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c

diff --cc MAINTAINERS
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -566,3 -561,6 +566,5 @@@ menu "Power management options
  source "kernel/power/Kconfig"
  
  endmenu
 -source "drivers/firmware/Kconfig"
+ source "arch/riscv/kvm/Kconfig"
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -10485,16 -10869,15 +10730,6 @@@ static int sync_regs(struct kvm_vcpu *v
        return 0;
  }
  
- static void fx_init(struct kvm_vcpu *vcpu)
 -void kvm_free_guest_fpu(struct kvm_vcpu *vcpu)
--{
-       /*
-        * Ensure guest xcr0 is valid for loading
-        */
-       vcpu->arch.xcr0 = XFEATURE_MASK_FP;
-       vcpu->arch.cr0 |= X86_CR0_ET;
 -      if (vcpu->arch.guest_fpu) {
 -              kmem_cache_free(x86_fpu_cache, vcpu->arch.guest_fpu);
 -              vcpu->arch.guest_fpu = NULL;
 -      }
--}
 -EXPORT_SYMBOL_GPL(kvm_free_guest_fpu);
--
  int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
  {
        if (kvm_check_tsc_unstable() && atomic_read(&kvm->online_vcpus) != 0)
@@@ -10551,13 -10934,24 +10786,11 @@@ int kvm_arch_vcpu_create(struct kvm_vcp
        if (!alloc_emulate_ctxt(vcpu))
                goto free_wbinvd_dirty_mask;
  
 -      vcpu->arch.user_fpu = kmem_cache_zalloc(x86_fpu_cache,
 -                                              GFP_KERNEL_ACCOUNT);
 -      if (!vcpu->arch.user_fpu) {
 -              pr_err("kvm: failed to allocate userspace's fpu\n");
 -              goto free_emulate_ctxt;
 -      }
 -
 -      vcpu->arch.guest_fpu = kmem_cache_zalloc(x86_fpu_cache,
 -                                               GFP_KERNEL_ACCOUNT);
 -      if (!vcpu->arch.guest_fpu) {
 +      if (!fpu_alloc_guest_fpstate(&vcpu->arch.guest_fpu)) {
                pr_err("kvm: failed to allocate vcpu's fpu\n");
 -              goto free_user_fpu;
 +              goto free_emulate_ctxt;
        }
 -      fpstate_init(&vcpu->arch.guest_fpu->state);
 -      if (boot_cpu_has(X86_FEATURE_XSAVES))
 -              vcpu->arch.guest_fpu->state.xsave.header.xcomp_bv =
 -                      host_xcr0 | XSTATE_COMPACTION_ENABLED;
  
-       fx_init(vcpu);
        vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu);
        vcpu->arch.reserved_gpa_bits = kvm_vcpu_reserved_gpa_bits_raw(vcpu);