[GIT PULL] KVM: x86 and selftests fixes for 6.12-rcN

From: Sean Christopherson
Date: Wed Nov 06 2024 - 11:13:05 EST


Please pull several fixes for 6.12, and to save us both effort, please also
apply several fixes that should probably go into 6.12 (the selftest fix
definitely needs to land in 6.12).

https://lore.kernel.org/all/20241106034031.503291-1-jsperbeck@xxxxxxxxxx
https://lore.kernel.org/all/20241105010558.1266699-2-dionnaglaze@xxxxxxxxxx
https://lore.kernel.org/all/20241106015135.2462147-1-seanjc@xxxxxxxxxx

And while I have your attention, I'd also like your input on a proposed "fix"
for Intel PT virtualization, which is probably belongs in 6.12 too, if you
agree with the direction.

https://lore.kernel.org/all/20241101185031.1799556-2-seanjc@xxxxxxxxxx

Note, this is based on v6.12-rc5 in order to pull in the necessary base for
the -march=x86-64-v2 fix.

The following changes since commit 81983758430957d9a5cb3333fe324fd70cf63e7e:

Linux 6.12-rc5 (2024-10-27 12:52:02 -1000)

are available in the Git repository at:

https://github.com/kvm-x86/linux.git tags/kvm-x86-fixes-6.12-rcN

for you to fetch changes up to e5d253c60e9627a22940e00a05a6115d722f07ed:

KVM: SVM: Propagate error from snp_guest_req_init() to userspace (2024-11-04 22:03:04 -0800)

----------------------------------------------------------------
KVM x86 and selftests fixes for 6.12:

- Increase the timeout for the memslot performance selftest to avoid false
failures on arm64 and nested x86 platforms.

- Fix a goof in the guest_memfd selftest where a for-loop initialized a
bit mask to zero instead of BIT(0).

- Disable strict aliasing when building KVM selftests to prevent the
compiler from treating things like "u64 *" to "uint64_t *" cases as
undefined behavior, which can lead to nasty, hard to debug failures.

- Force -march=x86-64-v2 for KVM x86 selftests if and only if the uarch
is supported by the compiler.

- When emulating a guest TLB flush for a nested guest, flush vpid01, not
vpid02, if L2 is active but VPID is disabled in vmcs12, i.e. if L2 and
L1 are sharing VPID '0' (from L1's perspective).

- Fix a bug in the SNP initialization flow where KVM would return '0' to
userspace instead of -errno on failure.

----------------------------------------------------------------
Maxim Levitsky (1):
KVM: selftests: memslot_perf_test: increase guest sync timeout

Patrick Roy (1):
KVM: selftests: fix unintentional noop test in guest_memfd_test.c

Sean Christopherson (4):
KVM: selftests: Disable strict aliasing
KVM: selftests: Don't force -march=x86-64-v2 if it's unsupported
KVM: nVMX: Treat vpid01 as current if L2 is active, but with VPID disabled
KVM: SVM: Propagate error from snp_guest_req_init() to userspace

arch/x86/kvm/svm/sev.c | 7 ++++--
arch/x86/kvm/vmx/nested.c | 30 ++++++++++++++++++++-----
arch/x86/kvm/vmx/vmx.c | 2 +-
tools/testing/selftests/kvm/Makefile | 10 +++++----
tools/testing/selftests/kvm/guest_memfd_test.c | 2 +-
tools/testing/selftests/kvm/memslot_perf_test.c | 2 +-
6 files changed, 39 insertions(+), 14 deletions(-)