KVM: selftests: Load XSAVE state into untouched vCPU during state test
authorSean Christopherson <seanjc@google.com>
Thu, 28 Sep 2023 00:19:55 +0000 (17:19 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 12 Oct 2023 15:08:59 +0000 (11:08 -0400)
commit77709820787355f45755fe454e26fca8584ecf40
tree214e31359783a7d2b7bfba1716d60dbca05ed337
parent60d351f18f7a8acd08964ef1d5c948354a7907be
KVM: selftests: Load XSAVE state into untouched vCPU during state test

Expand x86's state test to load XSAVE state into a "dummy" vCPU prior to
KVM_SET_CPUID2, and again with an empty guest CPUID model.  Except for
off-by-default features, i.e. AMX, KVM's ABI for KVM_SET_XSAVE is that
userspace is allowed to load xfeatures so long as they are supported by
the host.  This is a regression test for a combination of KVM bugs where
the state saved by KVM_GET_XSAVE{2} could not be loaded via KVM_SET_XSAVE
if the saved xstate_bv would load guest-unsupported xfeatures.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20230928001956.924301-5-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/x86_64/state_test.c