[GIT PULL] KVM: x86: Late CPUID related fix for 6.9

From: Sean Christopherson
Date: Mon Mar 18 2024 - 19:16:23 EST


Another small series for 6.9. In hindsight, I could have squeezed this into the
"misc" PR, but since it was from Vitaly, my mind thought "Hyper-V!" and I put in
kvm-x86/hyperv. *sigh*

FWIW, I'm hoping to eliminate this sort of bug in KVM_SET_CPUID{2,} by swapping
the incoming CPUID with the current CPUID, and undoing the swap on failure, But
that's firmly a future cleanup (if it even works).

The following changes since commit 41bccc98fb7931d63d03f326a746ac4d429c1dd3:

Linux 6.8-rc2 (2024-01-28 17:01:12 -0800)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-pvunhalt-6.9

for you to fetch changes up to c2585047c8e185b070ad5c7bd887ef59cee3941f:

KVM: selftests: Check that PV_UNHALT is cleared when HLT exiting is disabled (2024-03-06 09:59:20 -0800)

----------------------------------------------------------------
Fix a bug in KVM_SET_CPUID{2,} where KVM looks at the wrong CPUID entries (old
vs. new) and ultimately neglects to clear PV_UNHALT from vCPUs with HLT-exiting
disabled.

----------------------------------------------------------------
Vitaly Kuznetsov (3):
KVM: x86: Introduce __kvm_get_hypervisor_cpuid() helper
KVM: x86: Use actual kvm_cpuid.base for clearing KVM_FEATURE_PV_UNHALT
KVM: selftests: Check that PV_UNHALT is cleared when HLT exiting is disabled

arch/x86/kvm/cpuid.c | 44 +++++++++++++---------
.../selftests/kvm/include/x86_64/processor.h | 9 +++++
tools/testing/selftests/kvm/x86_64/kvm_pv_test.c | 39 +++++++++++++++++++
3 files changed, 75 insertions(+), 17 deletions(-)