KVM: selftests: Check that XTILEDATA supports XFD
authorAaron Lewis <aaronlewis@google.com>
Tue, 21 Feb 2023 16:36:55 +0000 (16:36 +0000)
committerSean Christopherson <seanjc@google.com>
Fri, 24 Mar 2023 21:21:42 +0000 (14:21 -0700)
Check that XTILEDATA supports XFD. In amx_test, add the requirement that
the guest allows the xfeature, XTILEDATA, to be set in XFD. Otherwise, the
test may fail.

Signed-off-by: Aaron Lewis <aaronlewis@google.com>
Signed-off-by: Mingwei Zhang <mizhang@google.com>
Link: https://lore.kernel.org/r/20230221163655.920289-14-mizhang@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/include/x86_64/processor.h
tools/testing/selftests/kvm/x86_64/amx_test.c

index f108fae..3538fa6 100644 (file)
@@ -143,6 +143,7 @@ struct kvm_x86_cpu_feature {
 #define        X86_FEATURE_XTILEDATA           KVM_X86_CPU_FEATURE(0xD, 0, EAX, 18)
 #define        X86_FEATURE_XSAVES              KVM_X86_CPU_FEATURE(0xD, 1, EAX, 3)
 #define        X86_FEATURE_XFD                 KVM_X86_CPU_FEATURE(0xD, 1, EAX, 4)
+#define X86_FEATURE_XTILEDATA_XFD      KVM_X86_CPU_FEATURE(0xD, 18, ECX, 2)
 
 /*
  * Extended Leafs, a.k.a. AMD defined
index 8e8f26d..5c82d7e 100644 (file)
@@ -258,6 +258,7 @@ int main(int argc, char *argv[])
        TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_AMX_TILE));
        TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_XTILECFG));
        TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_XTILEDATA));
+       TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_XTILEDATA_XFD));
 
        /* Create VM */
        vm = vm_create_with_one_vcpu(&vcpu, guest_code);