1. 10 12月, 2021 1 次提交
    • S
      KVM: x86: Ignore sparse banks size for an "all CPUs", non-sparse IPI req · 3244867a
      Sean Christopherson 提交于
      Do not bail early if there are no bits set in the sparse banks for a
      non-sparse, a.k.a. "all CPUs", IPI request.  Per the Hyper-V spec, it is
      legal to have a variable length of '0', e.g. VP_SET's BankContents in
      this case, if the request can be serviced without the extra info.
      
        It is possible that for a given invocation of a hypercall that does
        accept variable sized input headers that all the header input fits
        entirely within the fixed size header. In such cases the variable sized
        input header is zero-sized and the corresponding bits in the hypercall
        input should be set to zero.
      
      Bailing early results in KVM failing to send IPIs to all CPUs as expected
      by the guest.
      
      Fixes: 214ff83d ("KVM: x86: hyperv: implement PV IPI send hypercalls")
      Cc: stable@vger.kernel.org
      Signed-off-by: NSean Christopherson <seanjc@google.com>
      Reviewed-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Message-Id: <20211207220926.718794-2-seanjc@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      3244867a
  2. 08 12月, 2021 2 次提交
    • V
      KVM: nVMX: Implement Enlightened MSR Bitmap feature · 502d2bf5
      Vitaly Kuznetsov 提交于
      Updating MSR bitmap for L2 is not cheap and rearly needed. TLFS for Hyper-V
      offers 'Enlightened MSR Bitmap' feature which allows L1 hypervisor to
      inform L0 when it changes MSR bitmap, this eliminates the need to examine
      L1's MSR bitmap for L2 every time when 'real' MSR bitmap for L2 gets
      constructed.
      
      Use 'vmx->nested.msr_bitmap_changed' flag to implement the feature.
      
      Note, KVM already uses 'Enlightened MSR bitmap' feature when it runs as a
      nested hypervisor on top of Hyper-V. The newly introduced feature is going
      to be used by Hyper-V guests on KVM.
      
      When the feature is enabled for Win10+WSL2, it shaves off around 700 CPU
      cycles from a nested vmexit cost (tight cpuid loop test).
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Message-Id: <20211129094704.326635-5-vkuznets@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      502d2bf5
    • M
      KVM: Use 'unsigned long' as kvm_for_each_vcpu()'s index · 46808a4c
      Marc Zyngier 提交于
      Everywhere we use kvm_for_each_vpcu(), we use an int as the vcpu
      index. Unfortunately, we're about to move rework the iterator,
      which requires this to be upgrade to an unsigned long.
      
      Let's bite the bullet and repaint all of it in one go.
      Signed-off-by: NMarc Zyngier <maz@kernel.org>
      Message-Id: <20211116160403.4074052-7-maz@kernel.org>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      46808a4c
  3. 18 11月, 2021 1 次提交
    • T
      KVM: x86: Assume a 64-bit hypercall for guests with protected state · b5aead00
      Tom Lendacky 提交于
      When processing a hypercall for a guest with protected state, currently
      SEV-ES guests, the guest CS segment register can't be checked to
      determine if the guest is in 64-bit mode. For an SEV-ES guest, it is
      expected that communication between the guest and the hypervisor is
      performed to shared memory using the GHCB. In order to use the GHCB, the
      guest must have been in long mode, otherwise writes by the guest to the
      GHCB would be encrypted and not be able to be comprehended by the
      hypervisor.
      
      Create a new helper function, is_64_bit_hypercall(), that assumes the
      guest is in 64-bit mode when the guest has protected state, and returns
      true, otherwise invoking is_64_bit_mode() to determine the mode. Update
      the hypercall related routines to use is_64_bit_hypercall() instead of
      is_64_bit_mode().
      
      Add a WARN_ON_ONCE() to is_64_bit_mode() to catch occurences of calls to
      this helper function for a guest running with protected state.
      
      Fixes: f1c6366e ("KVM: SVM: Add required changes to support intercepts under SEV-ES")
      Reported-by: NSean Christopherson <seanjc@google.com>
      Signed-off-by: NTom Lendacky <thomas.lendacky@amd.com>
      Message-Id: <e0b20c770c9d0d1403f23d83e785385104211f74.1621878537.git.thomas.lendacky@amd.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      b5aead00
  4. 11 11月, 2021 1 次提交
  5. 22 10月, 2021 1 次提交
  6. 30 9月, 2021 3 次提交
  7. 22 9月, 2021 1 次提交
  8. 21 8月, 2021 1 次提交
    • V
      KVM: x86: hyper-v: Deactivate APICv only when AutoEOI feature is in use · 0f250a64
      Vitaly Kuznetsov 提交于
      APICV_INHIBIT_REASON_HYPERV is currently unconditionally forced upon
      SynIC activation as SynIC's AutoEOI is incompatible with APICv/AVIC. It is,
      however, possible to track whether the feature was actually used by the
      guest and only inhibit APICv/AVIC when needed.
      
      TLFS suggests a dedicated 'HV_DEPRECATING_AEOI_RECOMMENDED' flag to let
      Windows know that AutoEOI feature should be avoided. While it's up to
      KVM userspace to set the flag, KVM can help a bit by exposing global
      APICv/AVIC enablement.
      
      Maxim:
         - always set HV_DEPRECATING_AEOI_RECOMMENDED in kvm_get_hv_cpuid,
           since this feature can be used regardless of AVIC
      
      Paolo:
         - use arch.apicv_update_lock to protect the hv->synic_auto_eoi_used
           instead of atomic ops
      Signed-off-by: NVitaly Kuznetsov <vkuznets@redhat.com>
      Signed-off-by: NMaxim Levitsky <mlevitsk@redhat.com>
      Message-Id: <20210810205251.424103-12-mlevitsk@redhat.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      0f250a64
  9. 13 8月, 2021 1 次提交
  10. 03 8月, 2021 3 次提交
  11. 18 6月, 2021 25 次提交