[GIT PULL] KVM: x86: Hyper-V changes for 6.8

From: Sean Christopherson
Date: Thu Jan 04 2024 - 14:33:52 EST


This is essentially Vitaly's series to add CONFIG_KVM_HYPERV, along with a
one-off patch to clean up the range-based TLB flush APIs. While it's not super
obvious that adding CONFIG_KVM_HYPERV is worth the churn, e.g. very few setups
can actually disable CONFIG_KVM_HYPERV in practice, the end result is nice and
at the very least makes it easier for non-HyperV gurus to follow along.

The following changes since commit e9e60c82fe391d04db55a91c733df4a017c28b2f:

selftests/kvm: fix compilation on non-x86_64 platforms (2023-11-21 11:58:25 -0500)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-hyperv-6.8

for you to fetch changes up to 017a99a966f1183e611f0b0fa6bec40160c81813:

KVM: nSVM: Hide more stuff under CONFIG_KVM_HYPERV/CONFIG_HYPERV (2023-12-07 09:35:26 -0800)

----------------------------------------------------------------
KVM x86 Hyper-V changes for 6.8:

- Guard KVM-on-HyperV's range-based TLB flush hooks with an #ifdef on
CONFIG_HYPERV as a minor optimization, and to self-document the code.

- Add CONFIG_KVM_HYPERV to allow disabling KVM support for HyperV "emulation"
at build time.

----------------------------------------------------------------
Sean Christopherson (1):
KVM: x86/mmu: Declare flush_remote_tlbs{_range}() hooks iff HYPERV!=n

Vitaly Kuznetsov (16):
KVM: x86/xen: Remove unneeded xen context from kvm_arch when !CONFIG_KVM_XEN
KVM: x86: Move Hyper-V partition assist page out of Hyper-V emulation context
KVM: VMX: Split off vmx_onhyperv.{ch} from hyperv.{ch}
KVM: x86: Introduce helper to check if auto-EOI is set in Hyper-V SynIC
KVM: x86: Introduce helper to check if vector is set in Hyper-V SynIC
KVM: VMX: Split off hyperv_evmcs.{ch}
KVM: x86: Introduce helper to handle Hyper-V paravirt TLB flush requests
KVM: nVMX: Split off helper for emulating VMCLEAR on Hyper-V eVMCS
KVM: selftests: Make Hyper-V tests explicitly require KVM Hyper-V support
KVM: selftests: Fix vmxon_pa == vmcs12_pa == -1ull nVMX testcase for !eVMCS
KVM: nVMX: Move guest_cpuid_has_evmcs() to hyperv.h
KVM: x86: Make Hyper-V emulation optional
KVM: nVMX: Introduce helpers to check if Hyper-V evmptr12 is valid/set
KVM: nVMX: Introduce accessor to get Hyper-V eVMCS pointer
KVM: nVMX: Hide more stuff under CONFIG_KVM_HYPERV
KVM: nSVM: Hide more stuff under CONFIG_KVM_HYPERV/CONFIG_HYPERV

arch/x86/include/asm/kvm-x86-ops.h | 2 +
arch/x86/include/asm/kvm_host.h | 25 +-
arch/x86/kvm/Kconfig | 14 +
arch/x86/kvm/Makefile | 16 +-
arch/x86/kvm/cpuid.c | 6 +
arch/x86/kvm/hyperv.h | 85 +++-
arch/x86/kvm/irq.c | 2 +
arch/x86/kvm/irq_comm.c | 9 +-
arch/x86/kvm/kvm_onhyperv.h | 20 +
arch/x86/kvm/lapic.c | 5 +-
arch/x86/kvm/mmu/mmu.c | 12 +-
arch/x86/kvm/svm/hyperv.h | 9 +
arch/x86/kvm/svm/nested.c | 30 +-
arch/x86/kvm/svm/svm.h | 2 +
arch/x86/kvm/svm/svm_onhyperv.c | 10 +-
arch/x86/kvm/vmx/hyperv.c | 447 ---------------------
arch/x86/kvm/vmx/hyperv.h | 238 +++--------
arch/x86/kvm/vmx/hyperv_evmcs.c | 315 +++++++++++++++
arch/x86/kvm/vmx/hyperv_evmcs.h | 166 ++++++++
arch/x86/kvm/vmx/nested.c | 149 ++++---
arch/x86/kvm/vmx/nested.h | 3 +-
arch/x86/kvm/vmx/vmx.c | 20 +-
arch/x86/kvm/vmx/vmx.h | 12 +-
arch/x86/kvm/vmx/vmx_onhyperv.c | 36 ++
arch/x86/kvm/vmx/vmx_onhyperv.h | 125 ++++++
arch/x86/kvm/vmx/vmx_ops.h | 2 +-
arch/x86/kvm/x86.c | 66 ++-
tools/testing/selftests/kvm/x86_64/hyperv_clock.c | 2 +
tools/testing/selftests/kvm/x86_64/hyperv_evmcs.c | 5 +-
.../kvm/x86_64/hyperv_extended_hypercalls.c | 2 +
.../testing/selftests/kvm/x86_64/hyperv_features.c | 2 +
tools/testing/selftests/kvm/x86_64/hyperv_ipi.c | 2 +
.../testing/selftests/kvm/x86_64/hyperv_svm_test.c | 1 +
.../selftests/kvm/x86_64/hyperv_tlb_flush.c | 2 +
.../kvm/x86_64/vmx_set_nested_state_test.c | 16 +-
35 files changed, 1091 insertions(+), 767 deletions(-)
create mode 100644 arch/x86/kvm/vmx/hyperv_evmcs.c
create mode 100644 arch/x86/kvm/vmx/hyperv_evmcs.h
create mode 100644 arch/x86/kvm/vmx/vmx_onhyperv.c
create mode 100644 arch/x86/kvm/vmx/vmx_onhyperv.h