aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/x86_64/amx_test.c
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-06-14 20:06:36 +0000
committerSean Christopherson <seanjc@google.com>2022-07-13 18:14:12 -0700
commit8fea056eeb0c4840593bf2ed1e4cab5030d0b5b5 (patch)
tree4fb98f52035711546798abfa3af55518698c65b1 /tools/testing/selftests/kvm/x86_64/amx_test.c
parentKVM: selftests: Check for _both_ XTILE data and cfg in AMX test (diff)
downloadlinux-dev-8fea056eeb0c4840593bf2ed1e4cab5030d0b5b5.tar.xz
linux-dev-8fea056eeb0c4840593bf2ed1e4cab5030d0b5b5.zip
KVM: selftests: Use kvm_cpu_has() in AMX test
Use kvm_cpu_has() in the AMX test instead of open coding equivalent functionality using kvm_get_supported_cpuid_entry() and kvm_get_supported_cpuid_index(). No functional change intended. Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220614200707.3315957-12-seanjc@google.com
Diffstat (limited to 'tools/testing/selftests/kvm/x86_64/amx_test.c')
-rw-r--r--tools/testing/selftests/kvm/x86_64/amx_test.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/amx_test.c b/tools/testing/selftests/kvm/x86_64/amx_test.c
index 6fc4e652b38f..c8f98331a807 100644
--- a/tools/testing/selftests/kvm/x86_64/amx_test.c
+++ b/tools/testing/selftests/kvm/x86_64/amx_test.c
@@ -312,13 +312,12 @@ void guest_nm_handler(struct ex_regs *regs)
int main(int argc, char *argv[])
{
- struct kvm_cpuid_entry2 *entry;
struct kvm_regs regs1, regs2;
struct kvm_vcpu *vcpu;
struct kvm_vm *vm;
struct kvm_run *run;
struct kvm_x86_state *state;
- int xsave_restore_size = 0;
+ int xsave_restore_size;
vm_vaddr_t amx_cfg, tiledata, xsavedata;
struct ucall uc;
u32 amx_offset;
@@ -329,17 +328,13 @@ int main(int argc, char *argv[])
/* Create VM */
vm = vm_create_with_one_vcpu(&vcpu, guest_code);
- entry = kvm_get_supported_cpuid_entry(1);
- TEST_REQUIRE(entry->ecx & CPUID_XSAVE);
-
- TEST_REQUIRE(kvm_get_cpuid_max_basic() >= 0xd);
-
- entry = kvm_get_supported_cpuid_index(0xd, 0);
- TEST_REQUIRE(entry->eax & XFEATURE_MASK_XTILECFG);
- TEST_REQUIRE(entry->eax & XFEATURE_MASK_XTILEDATA);
+ TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_XSAVE));
+ 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));
/* Get xsave/restore max size */
- xsave_restore_size = entry->ecx;
+ xsave_restore_size = kvm_get_supported_cpuid_index(0xd, 0)->ecx;
run = vcpu->run;
vcpu_regs_get(vcpu, &regs1);