[GIT PULL] KVM: x86: Misc changes for 6.7

From: Sean Christopherson
Date: Fri Oct 27 2023 - 16:49:51 EST


A truly miscellaneous collection of patches this time around. David M's PML
fix obviously belongs in the MMU pull request, but I applied it to the wrong
branch and didn't want to rebase for such a silly thing.

The following changes since commit 5804c19b80bf625c6a9925317f845e497434d6d3:

Merge tag 'kvm-riscv-fixes-6.6-1' of https://github.com/kvm-riscv/linux into HEAD (2023-09-23 05:35:55 -0400)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-misc-6.7

for you to fetch changes up to 2770d4722036d6bd24bcb78e9cd7f6e572077d03:

KVM: x86: Ignore MSR_AMD64_TW_CFG access (2023-10-19 10:55:14 -0700)

----------------------------------------------------------------
KVM x86 misc changes for 6.7:

- Add CONFIG_KVM_MAX_NR_VCPUS to allow supporting up to 4096 vCPUs without
forcing more common use cases to eat the extra memory overhead.

- Add IBPB and SBPB virtualization support.

- Fix a bug where restoring a vCPU snapshot that was taken within 1 second of
creating the original vCPU would cause KVM to try to synchronize the vCPU's
TSC and thus clobber the correct TSC being set by userspace.

- Compute guest wall clock using a single TSC read to avoid generating an
inaccurate time, e.g. if the vCPU is preempted between multiple TSC reads.

- "Virtualize" HWCR.TscFreqSel to make Linux guests happy, which complain
about a "Firmware Bug" if the bit isn't set for select F/M/S combos.

- Don't apply side effects to Hyper-V's synthetic timer on writes from
userspace to fix an issue where the auto-enable behavior can trigger
spurious interrupts, i.e. do auto-enabling only for guest writes.

- Remove an unnecessary kick of all vCPUs when synchronizing the dirty log
without PML enabled.

- Advertise "support" for non-serializing FS/GS base MSR writes as appropriate.

- Use octal notation for file permissions through KVM x86.

- Fix a handful of typo fixes and warts.

----------------------------------------------------------------
David Matlack (1):
KVM: x86/mmu: Stop kicking vCPUs to sync the dirty log when PML is disabled

David Woodhouse (1):
KVM: x86: Refine calculation of guest wall clock to use a single TSC read

Dongli Zhang (1):
KVM: x86: remove always-false condition in kvmclock_sync_fn

Jim Mattson (4):
KVM: x86: Allow HWCR.McStatusWrEn to be cleared once set
KVM: x86: Virtualize HWCR.TscFreqSel[bit 24]
KVM: selftests: Test behavior of HWCR, a.k.a. MSR_K7_HWCR
x86: KVM: Add feature flag for CPUID.80000021H:EAX[bit 1]

Josh Poimboeuf (2):
KVM: x86: Add IBPB_BRTYPE support
KVM: x86: Add SBPB support

Kyle Meyer (1):
KVM: x86: Add CONFIG_KVM_MAX_NR_VCPUS to allow up to 4096 vCPUs

Liang Chen (1):
KVM: x86: remove the unused assigned_dev_head from kvm_arch

Like Xu (1):
KVM: x86: Don't sync user-written TSC against startup values

Maciej S. Szmigiero (1):
KVM: x86: Ignore MSR_AMD64_TW_CFG access

Michal Luczaj (2):
KVM: x86: Remove redundant vcpu->arch.cr0 assignments
KVM: x86: Force TLB flush on userspace changes to special registers

Mingwei Zhang (1):
KVM: x86: Update the variable naming in kvm_x86_ops.sched_in()

Nicolas Saenz Julienne (1):
KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space

Peng Hao (1):
KVM: x86: Use octal for file permission

arch/x86/include/asm/cpufeatures.h | 1 +
arch/x86/include/asm/kvm_host.h | 12 +-
arch/x86/include/asm/msr-index.h | 1 +
arch/x86/kvm/Kconfig | 11 ++
arch/x86/kvm/cpuid.c | 8 +-
arch/x86/kvm/cpuid.h | 3 +-
arch/x86/kvm/hyperv.c | 10 +-
arch/x86/kvm/smm.c | 1 -
arch/x86/kvm/svm/svm.c | 2 +-
arch/x86/kvm/vmx/vmx.c | 20 +--
arch/x86/kvm/x86.c | 195 ++++++++++++++++-----
arch/x86/kvm/x86.h | 1 +
arch/x86/kvm/xen.c | 4 +-
tools/testing/selftests/kvm/Makefile | 1 +
tools/testing/selftests/kvm/x86_64/hwcr_msr_test.c | 47 +++++
15 files changed, 251 insertions(+), 66 deletions(-)
create mode 100644 tools/testing/selftests/kvm/x86_64/hwcr_msr_test.c