diff --git a/tools/testing/selftests/x86/amx.c b/tools/testing/selftests/x86/amx.c
index d884fd69dd510..5d1ca0bbaaae7 100644
--- a/tools/testing/selftests/x86/amx.c
+++ b/tools/testing/selftests/x86/amx.c
@@ -103,9 +103,10 @@ static void clearhandler(int sig)
#define CPUID_LEAF1_ECX_XSAVE_MASK (1 << 26)
#define CPUID_LEAF1_ECX_OSXSAVE_MASK (1 << 27)
-static inline void check_cpuid_xsave(void)
+static inline int check_cpuid_xsave(void)
{
uint32_t eax, ebx, ecx, edx;
+ int ret = 0;
/*
* CPUID.1:ECX.XSAVE[bit 26] enumerates general
@@ -113,10 +114,16 @@ static inline void check_cpuid_xsave(void)
* XGETBV.
*/
__cpuid_count(1, 0, eax, ebx, ecx, edx);
- if (!(ecx & CPUID_LEAF1_ECX_XSAVE_MASK))
- fatal_error("cpuid: no CPU xsave support");
- if (!(ecx & CPUID_LEAF1_ECX_OSXSAVE_MASK))
- fatal_error("cpuid: no OS xsave support");
+ if (!(ecx & CPUID_LEAF1_ECX_XSAVE_MASK)) {
+ ksft_print_msg("cpuid: no CPU xsave support\n");
+ ret = -1;
+ }
+ if (!(ecx & CPUID_LEAF1_ECX_OSXSAVE_MASK)) {
+ ksft_print_msg("cpuid: no OS xsave support\n");
+ ret = -1;
+ }
+
+ return ret;
}
-static void check_cpuid_xtiledata(void)
+static int check_cpuid_xtiledata(void)
{
uint32_t eax, ebx, ecx, edx;
@@ -153,12 +160,16 @@ static void check_cpuid_xtiledata(void)
* eax: XTILEDATA state component size
* ebx: XTILEDATA state component offset in user buffer
*/
- if (!eax || !ebx)
- fatal_error("xstate cpuid: invalid tile data size/offset: %d/%d",
- eax, ebx);
+ if (!eax || !ebx) {
+ ksft_print_msg("xstate cpuid: invalid tile data size/offset: %d/%d\n",
+ eax, ebx);
+ return -1;
+ }
xtiledata.size = eax;
xtiledata.xbuf_offset = ebx;
+
+ return 0;
}