[GIT PULL] KVM: Selftests change for 7.3, part 1
From: Sean Christopherson
Date: Wed Aug 12 2026 - 17:39:58 EST
This was supposed to be the "main" selftests pull request, but it ended up being
about half the size of the second pull request. Yosry's work on the nested
virtualization infrastructure is by far the most notable thing here.
The following changes since commit a204badd8432f93b7e862e7dac6db0fe3d65f370:
Merge branch 'kvm-chainsaw' into HEAD (2026-06-25 11:32:09 +0200)
are available in the Git repository at:
https://github.com/kvm-x86/linux.git tags/kvm-x86-selftests-7.3
for you to fetch changes up to b18ee21055a77eb1fb6070cb3f819cd3372c466e:
KVM: selftests: Add a test for KVM_CREATE_VM VM type enforcement (2026-07-31 15:47:25 -0700)
----------------------------------------------------------------
KVM selftests changes for 7.3, part 1
- Clean up nested SVM's handling of GPRs on L2<=>L1 transitions, reuse the
functionality for nested VMX, and drop the ucall hack that was fudging
around the lack of GPR switching on nVMX.
- Add a stress test to verify KVM doesn't clobber/drop #PF state, e.g. CR2,
across save/restore, including when L2 is active.
- Add a test to verify KVM_CREATE_VM accepts exactly what is reported by
KVM_CAP_VM_TYPES.
- Misc selftests fixes and cleanups
----------------------------------------------------------------
Hemanth Selam (1):
KVM: selftests: Add a test for KVM_CREATE_VM VM type enforcement
Sean Christopherson (2):
KVM: selftests: Drop superfluous use of pthread_attr_setaffinity_np()
KVM: selftests: Randomize pCPU in steal time test
Shivank Sharma (1):
KVM: selftests: Fix typos in x86 and riscv tests
Wang Yan (1):
KVM: selftests: Fix a spelling error in an xapic_ipi_test comment
Yosry Ahmed (13):
KVM: selftests: Use __stringify() instead of custom XSTR() macros
KVM: selftests: Fix RAX and RFLAGS VMCB offsets when running L2
KVM: selftests: Rework GPR registers switching for SVM (and fix offsets)
KVM: selftests: Handle rflags save/restore for SVM in guest_regs
KVM: selftests: Reuse GPR switching logic for nVMX
KVM: selftests: Drop HORRIFIC_L2_UCALL_CLOBBER_HACK
KVM: selftests: Add a blank line before logging assertion failures
KVM: selftests: Expose PTE masks to guests as part of an MMU
KVM: selftests: Do not intercept #PF by default in nVMX tests
KVM: selftests: Add basic stress test for save+restore and #PF handling
KVM: selftests: Trigger save+restore randomly in the #PF stress test
KVM: selftests: Support running stress save+restore and #PF test in L2
KVM: selftests: Trigger L2->L1 exits stress save+restore and #PF test
tools/testing/selftests/kvm/Makefile.kvm | 2 +
tools/testing/selftests/kvm/include/test_util.h | 1 +
tools/testing/selftests/kvm/include/x86/evmcs.h | 46 ++--
.../testing/selftests/kvm/include/x86/processor.h | 52 +++-
tools/testing/selftests/kvm/include/x86/vmx.h | 69 +++--
tools/testing/selftests/kvm/lib/assert.c | 2 +-
tools/testing/selftests/kvm/lib/x86/processor.c | 14 +
tools/testing/selftests/kvm/lib/x86/svm.c | 62 +++--
tools/testing/selftests/kvm/lib/x86/ucall.c | 32 +--
tools/testing/selftests/kvm/lib/x86/vmx.c | 2 +-
tools/testing/selftests/kvm/riscv/sbi_pmu_test.c | 4 +-
tools/testing/selftests/kvm/steal_time.c | 15 +-
tools/testing/selftests/kvm/vm_types_test.c | 48 ++++
.../selftests/kvm/x86/evmcs_smm_controls_test.c | 5 +-
.../testing/selftests/kvm/x86/fix_hypercall_test.c | 1 -
tools/testing/selftests/kvm/x86/hyperv_clock.c | 4 +-
tools/testing/selftests/kvm/x86/hyperv_evmcs.c | 2 +-
.../kvm/x86/save_restore_pf_stress_test.c | 288 +++++++++++++++++++++
tools/testing/selftests/kvm/x86/sev_init2_tests.c | 4 -
tools/testing/selftests/kvm/x86/smm_test.c | 5 +-
.../kvm/x86/vmx_invalid_nested_guest_state.c | 2 +-
tools/testing/selftests/kvm/x86/xapic_ipi_test.c | 2 +-
22 files changed, 502 insertions(+), 160 deletions(-)
create mode 100644 tools/testing/selftests/kvm/vm_types_test.c
create mode 100644 tools/testing/selftests/kvm/x86/save_restore_pf_stress_test.c