Skip to content

Commit d87b459

Browse files
committed
KVM: selftests: Verify XCR0 can be "downgraded" and "upgraded"
Now that KVM selftests enable all supported XCR0 features by default, add a testcase to the XCR0 vs. CPUID test to verify that the guest can disable everything except the legacy FPU in XCR0, and then re-enable the full feature set, which is kinda sorta what the test did before XCR0 was setup by default. Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> Link: https://lore.kernel.org/r/20241003234337.273364-7-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 331b8dd commit d87b459

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/testing/selftests/kvm/x86_64/xcr0_cpuid_test.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ static void guest_code(void)
7979
ASSERT_ALL_OR_NONE_XFEATURE(supported_xcr0,
8080
XFEATURE_MASK_XTILE);
8181

82+
vector = xsetbv_safe(0, XFEATURE_MASK_FP);
83+
__GUEST_ASSERT(!vector,
84+
"Expected success on XSETBV(FP), got vector '0x%x'",
85+
vector);
86+
8287
vector = xsetbv_safe(0, supported_xcr0);
8388
__GUEST_ASSERT(!vector,
8489
"Expected success on XSETBV(0x%lx), got vector '0x%x'",

0 commit comments

Comments
 (0)