]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: selftests: Add an MSR test to exercise guest/host and read/write
authorSean Christopherson <seanjc@google.com>
Fri, 19 Sep 2025 22:32:52 +0000 (15:32 -0700)
committerSean Christopherson <seanjc@google.com>
Tue, 23 Sep 2025 16:51:56 +0000 (09:51 -0700)
commit9c38ddb3df94acdc86485c7073610f01655309f9
tree10c66f4d84ea32bf412b721fa74a7fc11a4d580c
parentfddd07626baa419c259ad5f3537a57188b5bb415
KVM: selftests: Add an MSR test to exercise guest/host and read/write

Add a selftest to verify reads and writes to various MSRs, from both the
guest and host, and expect success/failure based on whether or not the
vCPU supports the MSR according to supported CPUID.

Note, this test is extremely similar to KVM-Unit-Test's "msr" test, but
provides more coverage with respect to host accesses, and will be extended
to provide addition testing of CPUID-based features, save/restore lists,
and KVM_{G,S}ET_ONE_REG, all which are extremely difficult to validate in
KUT.

If kvm.ignore_msrs=true, skip the unsupported and reserved testcases as
KVM's ABI is a mess; what exactly is supposed to be ignored, and when,
varies wildly.

Reviewed-by: Chao Gao <chao.gao@intel.com>
Link: https://lore.kernel.org/r/20250919223258.1604852-46-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/Makefile.kvm
tools/testing/selftests/kvm/include/x86/processor.h
tools/testing/selftests/kvm/x86/msrs_test.c [new file with mode: 0644]