summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2024-10-03 16:43:29 -0700
committerSean Christopherson <seanjc@google.com>2024-11-01 09:26:29 -0700
commit164cea33bfedf883651d8d8b2db2fa867b48ecb0 (patch)
treea7b14b98b7eae99014f75ac80a086aeb42df9a42
parentf2c5aa31670d8532dc820c110faf96d0cdbba7d9 (diff)
KVM: selftests: Mask off OSPKE and OSXSAVE when comparing CPUID entries
Mask off OSPKE and OSXSAVE, which are toggled based on corresponding CR4 enabling bits, when comparing vCPU CPUID against KVM's supported CPUID. This will allow setting OSXSAVE by default when creating vCPUs, without causing test failures (KVM doesn't enumerate OSXSAVE=1). Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> Link: https://lore.kernel.org/r/20241003234337.273364-4-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
-rw-r--r--tools/testing/selftests/kvm/x86_64/cpuid_test.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/cpuid_test.c b/tools/testing/selftests/kvm/x86_64/cpuid_test.c
index f7fdcef5fa59..7b3fda6842bc 100644
--- a/tools/testing/selftests/kvm/x86_64/cpuid_test.c
+++ b/tools/testing/selftests/kvm/x86_64/cpuid_test.c
@@ -62,6 +62,12 @@ static struct cpuid_mask get_const_cpuid_mask(const struct kvm_cpuid_entry2 *ent
memset(&mask, 0xff, sizeof(mask));
switch (entry->function) {
+ case 0x1:
+ mask.regs[X86_FEATURE_OSXSAVE.reg] &= ~BIT(X86_FEATURE_OSXSAVE.bit);
+ break;
+ case 0x7:
+ mask.regs[X86_FEATURE_OSPKE.reg] &= ~BIT(X86_FEATURE_OSPKE.bit);
+ break;
case 0xd:
/*
* CPUID.0xD.{0,1}.EBX enumerate XSAVE size based on the current