summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/kvm/lib/x86_64/processor.c
diff options
context:
space:
mode:
authorSean Christopherson <seanjc@google.com>2022-06-14 20:07:04 +0000
committerSean Christopherson <seanjc@google.com>2022-07-13 18:14:24 -0700
commitd4c94ee8121cce64f2882f3bdcc346dc3d01bcdd (patch)
tree21a040301a4c0fc7a80244f0fb1258ac56c22008 /tools/testing/selftests/kvm/lib/x86_64/processor.c
parent7fbb653e01fdd45b377674a9e77da473d49afd38 (diff)
downloadlinux-d4c94ee8121cce64f2882f3bdcc346dc3d01bcdd.tar.bz2
KVM: selftests: Skip AMX test if ARCH_REQ_XCOMP_GUEST_PERM isn't supported
Skip the AMX test instead of silently returning if the host kernel doesn't support ARCH_REQ_XCOMP_GUEST_PERM. KVM didn't support XFD until v5.17, so it's extremely unlikely allowing the test to run on a pre-v5.15 kernel is the right thing to do. Signed-off-by: Sean Christopherson <seanjc@google.com> Link: https://lore.kernel.org/r/20220614200707.3315957-40-seanjc@google.com
Diffstat (limited to 'tools/testing/selftests/kvm/lib/x86_64/processor.c')
-rw-r--r--tools/testing/selftests/kvm/lib/x86_64/processor.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c
index 6cb93bbd6130..912da2100f90 100644
--- a/tools/testing/selftests/kvm/lib/x86_64/processor.c
+++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c
@@ -601,14 +601,7 @@ void vm_xsave_req_perm(int bit)
TEST_REQUIRE(bitmask & (1ULL << bit));
- rc = syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_GUEST_PERM, bit);
-
- /*
- * The older kernel version(<5.15) can't support
- * ARCH_REQ_XCOMP_GUEST_PERM and directly return.
- */
- if (rc)
- return;
+ TEST_REQUIRE(!syscall(SYS_arch_prctl, ARCH_REQ_XCOMP_GUEST_PERM, bit));
rc = syscall(SYS_arch_prctl, ARCH_GET_XCOMP_GUEST_PERM, &bitmask);
TEST_ASSERT(rc == 0, "prctl(ARCH_GET_XCOMP_GUEST_PERM) error: %ld", rc);