|
15 | 15 | #include "helpers.h"
|
16 | 16 | #include "xstate.h"
|
17 | 17 |
|
| 18 | +/* |
| 19 | + * The userspace xstate test suite is designed to be generic and operates |
| 20 | + * with randomized xstate data. However, some states require special handling: |
| 21 | + * |
| 22 | + * - PKRU and XTILECFG need specific adjustments, such as modifying |
| 23 | + * randomization behavior or using fixed values. |
| 24 | + * - But, PKRU already has a dedicated test suite in /tools/selftests/mm. |
| 25 | + * - Legacy states (FP and SSE) are excluded, as they are not considered |
| 26 | + * part of extended states (xstates) and their usage is already deeply |
| 27 | + * integrated into user-space libraries. |
| 28 | + */ |
| 29 | +#define XFEATURE_MASK_TEST_SUPPORTED \ |
| 30 | + ((1 << XFEATURE_YMM) | \ |
| 31 | + (1 << XFEATURE_OPMASK) | \ |
| 32 | + (1 << XFEATURE_ZMM_Hi256) | \ |
| 33 | + (1 << XFEATURE_Hi16_ZMM) | \ |
| 34 | + (1 << XFEATURE_XTILEDATA)) |
| 35 | + |
18 | 36 | static inline uint64_t xgetbv(uint32_t index)
|
19 | 37 | {
|
20 | 38 | uint32_t eax, edx;
|
@@ -435,6 +453,12 @@ void test_xstate(uint32_t feature_num)
|
435 | 453 | unsigned long features;
|
436 | 454 | long rc;
|
437 | 455 |
|
| 456 | + if (!(XFEATURE_MASK_TEST_SUPPORTED & (1 << feature_num))) { |
| 457 | + ksft_print_msg("The xstate test does not fully support the component %u, yet.\n", |
| 458 | + feature_num); |
| 459 | + return; |
| 460 | + } |
| 461 | + |
438 | 462 | rc = syscall(SYS_arch_prctl, ARCH_GET_XCOMP_SUPP, &features);
|
439 | 463 | if (rc || !(features & (1 << feature_num))) {
|
440 | 464 | ksft_print_msg("The kernel does not support feature number: %u\n", feature_num);
|
|
0 commit comments