diff options
Diffstat (limited to 'tools/testing/selftests/arm64')
| -rw-r--r-- | tools/testing/selftests/arm64/abi/hwcap.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/abi/ptrace.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/abi/syscall-abi.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/fp/fp-ptrace.c | 7 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/fp/fp-stress.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/fp/sve-probe-vls.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/fp/sve-ptrace.c | 63 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/fp/vec-syscfg.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/fp/za-ptrace.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/fp/zt-ptrace.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/fp/zt-test.S | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/gcs/gcs-stress.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/pauth/pac.c | 2 | ||||
| -rw-r--r-- | tools/testing/selftests/arm64/tags/tags_test.c | 2 |
14 files changed, 76 insertions, 18 deletions
diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c index 3b96d090c5eb..c41640f18e4e 100644 --- a/tools/testing/selftests/arm64/abi/hwcap.c +++ b/tools/testing/selftests/arm64/abi/hwcap.c @@ -19,7 +19,7 @@ #include <linux/auxvec.h> -#include "../../kselftest.h" +#include "kselftest.h" #define TESTS_PER_HWCAP 3 diff --git a/tools/testing/selftests/arm64/abi/ptrace.c b/tools/testing/selftests/arm64/abi/ptrace.c index b51d21f78cf9..0e46ac21c81d 100644 --- a/tools/testing/selftests/arm64/abi/ptrace.c +++ b/tools/testing/selftests/arm64/abi/ptrace.c @@ -18,7 +18,7 @@ #include <asm/sigcontext.h> #include <asm/ptrace.h> -#include "../../kselftest.h" +#include "kselftest.h" #define EXPECTED_TESTS 11 diff --git a/tools/testing/selftests/arm64/abi/syscall-abi.c b/tools/testing/selftests/arm64/abi/syscall-abi.c index 5ec9a18ec802..b67e3e26fa6d 100644 --- a/tools/testing/selftests/arm64/abi/syscall-abi.c +++ b/tools/testing/selftests/arm64/abi/syscall-abi.c @@ -16,7 +16,7 @@ #include <asm/sigcontext.h> #include <asm/unistd.h> -#include "../../kselftest.h" +#include "kselftest.h" #include "syscall-abi.h" diff --git a/tools/testing/selftests/arm64/fp/fp-ptrace.c b/tools/testing/selftests/arm64/fp/fp-ptrace.c index a85c19e9524e..22c584b78be5 100644 --- a/tools/testing/selftests/arm64/fp/fp-ptrace.c +++ b/tools/testing/selftests/arm64/fp/fp-ptrace.c @@ -27,7 +27,7 @@ #include <asm/sve_context.h> #include <asm/ptrace.h> -#include "../../kselftest.h" +#include "kselftest.h" #include "fp-ptrace.h" @@ -1071,7 +1071,7 @@ static bool sve_write_supported(struct test_config *config) static bool sve_write_fpsimd_supported(struct test_config *config) { - if (!sve_supported()) + if (!sve_supported() && !sme_supported()) return false; if ((config->svcr_in & SVCR_ZA) != (config->svcr_expected & SVCR_ZA)) @@ -1231,9 +1231,6 @@ static void sve_write_fpsimd(pid_t child, struct test_config *config) vl = vl_expected(config); vq = __sve_vq_from_vl(vl); - if (!vl) - return; - iov.iov_len = SVE_PT_SIZE(vq, SVE_PT_REGS_FPSIMD); iov.iov_base = malloc(iov.iov_len); if (!iov.iov_base) { diff --git a/tools/testing/selftests/arm64/fp/fp-stress.c b/tools/testing/selftests/arm64/fp/fp-stress.c index 9349aa630c84..65e01aba96ff 100644 --- a/tools/testing/selftests/arm64/fp/fp-stress.c +++ b/tools/testing/selftests/arm64/fp/fp-stress.c @@ -24,7 +24,7 @@ #include <sys/wait.h> #include <asm/hwcap.h> -#include "../../kselftest.h" +#include "kselftest.h" #define MAX_VLS 16 diff --git a/tools/testing/selftests/arm64/fp/sve-probe-vls.c b/tools/testing/selftests/arm64/fp/sve-probe-vls.c index a24eca7a4ecb..df0c1b6eb114 100644 --- a/tools/testing/selftests/arm64/fp/sve-probe-vls.c +++ b/tools/testing/selftests/arm64/fp/sve-probe-vls.c @@ -12,7 +12,7 @@ #include <sys/prctl.h> #include <asm/sigcontext.h> -#include "../../kselftest.h" +#include "kselftest.h" #include "rdvl.h" int main(int argc, char **argv) diff --git a/tools/testing/selftests/arm64/fp/sve-ptrace.c b/tools/testing/selftests/arm64/fp/sve-ptrace.c index e0fc3a001e28..28f6b996c5e2 100644 --- a/tools/testing/selftests/arm64/fp/sve-ptrace.c +++ b/tools/testing/selftests/arm64/fp/sve-ptrace.c @@ -19,7 +19,7 @@ #include <asm/sigcontext.h> #include <asm/ptrace.h> -#include "../../kselftest.h" +#include "kselftest.h" /* <linux/elf.h> and <sys/auxv.h> don't like each other, so: */ #ifndef NT_ARM_SVE @@ -394,6 +394,58 @@ out: free(svebuf); } +/* Write the FPSIMD registers via the SVE regset when SVE is not supported */ +static void ptrace_sve_fpsimd_no_sve(pid_t child) +{ + void *svebuf; + struct user_sve_header *sve; + struct user_fpsimd_state *fpsimd, new_fpsimd; + unsigned int i, j; + unsigned char *p; + int ret; + + svebuf = malloc(SVE_PT_SIZE(0, SVE_PT_REGS_FPSIMD)); + if (!svebuf) { + ksft_test_result_fail("Failed to allocate FPSIMD buffer\n"); + return; + } + + /* On a system without SVE the VL should be set to 0 */ + memset(svebuf, 0, SVE_PT_SIZE(0, SVE_PT_REGS_FPSIMD)); + sve = svebuf; + sve->flags = SVE_PT_REGS_FPSIMD; + sve->size = SVE_PT_SIZE(0, SVE_PT_REGS_FPSIMD); + sve->vl = 0; + + /* Try to set a known FPSIMD state via PT_REGS_SVE */ + fpsimd = (struct user_fpsimd_state *)((char *)sve + + SVE_PT_FPSIMD_OFFSET); + for (i = 0; i < 32; ++i) { + p = (unsigned char *)&fpsimd->vregs[i]; + + for (j = 0; j < sizeof(fpsimd->vregs[i]); ++j) + p[j] = j; + } + + ret = set_sve(child, &vec_types[0], sve); + ksft_test_result(ret == 0, "FPSIMD write via SVE\n"); + if (ret) { + ksft_test_result_skip("Verify FPSIMD write via SVE\n"); + goto out; + } + + /* Verify via the FPSIMD regset */ + if (get_fpsimd(child, &new_fpsimd)) { + ksft_test_result_skip("Verify FPSIMD write via SVE\n"); + goto out; + } + ksft_test_result(memcmp(fpsimd, &new_fpsimd, sizeof(*fpsimd)) == 0, + "Verify FPSIMD write via SVE\n"); + +out: + free(svebuf); +} + /* Validate attempting to set SVE data and read SVE data */ static void ptrace_set_sve_get_sve_data(pid_t child, const struct vec_type *type, @@ -826,6 +878,15 @@ static int do_parent(pid_t child) } } + /* We support SVE writes of FPSMID format on SME only systems */ + if (!(getauxval(AT_HWCAP) & HWCAP_SVE) && + (getauxval(AT_HWCAP2) & HWCAP2_SME)) { + ptrace_sve_fpsimd_no_sve(child); + } else { + ksft_test_result_skip("FPSIMD write via SVE\n"); + ksft_test_result_skip("Verify FPSIMD write via SVE\n"); + } + ret = EXIT_SUCCESS; error: diff --git a/tools/testing/selftests/arm64/fp/vec-syscfg.c b/tools/testing/selftests/arm64/fp/vec-syscfg.c index 2d75d342eeb9..8dd932fdcdc4 100644 --- a/tools/testing/selftests/arm64/fp/vec-syscfg.c +++ b/tools/testing/selftests/arm64/fp/vec-syscfg.c @@ -19,7 +19,7 @@ #include <asm/sigcontext.h> #include <asm/hwcap.h> -#include "../../kselftest.h" +#include "kselftest.h" #include "rdvl.h" #define ARCH_MIN_VL SVE_VL_MIN diff --git a/tools/testing/selftests/arm64/fp/za-ptrace.c b/tools/testing/selftests/arm64/fp/za-ptrace.c index 08c777f87ea2..787eed22d059 100644 --- a/tools/testing/selftests/arm64/fp/za-ptrace.c +++ b/tools/testing/selftests/arm64/fp/za-ptrace.c @@ -18,7 +18,7 @@ #include <asm/sigcontext.h> #include <asm/ptrace.h> -#include "../../kselftest.h" +#include "kselftest.h" /* <linux/elf.h> and <sys/auxv.h> don't like each other, so: */ #ifndef NT_ARM_ZA diff --git a/tools/testing/selftests/arm64/fp/zt-ptrace.c b/tools/testing/selftests/arm64/fp/zt-ptrace.c index a7f34040fbf1..f3fa49fd0fbd 100644 --- a/tools/testing/selftests/arm64/fp/zt-ptrace.c +++ b/tools/testing/selftests/arm64/fp/zt-ptrace.c @@ -18,7 +18,7 @@ #include <asm/sigcontext.h> #include <asm/ptrace.h> -#include "../../kselftest.h" +#include "kselftest.h" /* <linux/elf.h> and <sys/auxv.h> don't like each other, so: */ #ifndef NT_ARM_ZA diff --git a/tools/testing/selftests/arm64/fp/zt-test.S b/tools/testing/selftests/arm64/fp/zt-test.S index 38080f3c3280..a8df05771670 100644 --- a/tools/testing/selftests/arm64/fp/zt-test.S +++ b/tools/testing/selftests/arm64/fp/zt-test.S @@ -276,7 +276,7 @@ function barf bl putdec puts ", iteration=" mov x0, x22 - bl putdec + bl putdecn puts "\tExpected [" mov x0, x10 mov x1, x12 diff --git a/tools/testing/selftests/arm64/gcs/gcs-stress.c b/tools/testing/selftests/arm64/gcs/gcs-stress.c index cf316d78ea97..86d8cd42aee7 100644 --- a/tools/testing/selftests/arm64/gcs/gcs-stress.c +++ b/tools/testing/selftests/arm64/gcs/gcs-stress.c @@ -24,7 +24,7 @@ #include <sys/wait.h> #include <asm/hwcap.h> -#include "../../kselftest.h" +#include "kselftest.h" struct child_data { char *name, *output; diff --git a/tools/testing/selftests/arm64/pauth/pac.c b/tools/testing/selftests/arm64/pauth/pac.c index 6d21b2fc758d..67d138057707 100644 --- a/tools/testing/selftests/arm64/pauth/pac.c +++ b/tools/testing/selftests/arm64/pauth/pac.c @@ -10,7 +10,7 @@ #include <setjmp.h> #include <sched.h> -#include "../../kselftest_harness.h" +#include "kselftest_harness.h" #include "helper.h" #define PAC_COLLISION_ATTEMPTS 1000 diff --git a/tools/testing/selftests/arm64/tags/tags_test.c b/tools/testing/selftests/arm64/tags/tags_test.c index 8ae26e496c89..375ab47f0edb 100644 --- a/tools/testing/selftests/arm64/tags/tags_test.c +++ b/tools/testing/selftests/arm64/tags/tags_test.c @@ -6,7 +6,7 @@ #include <stdint.h> #include <sys/prctl.h> #include <sys/utsname.h> -#include "../../kselftest.h" +#include "kselftest.h" #define SHIFT_TAG(tag) ((uint64_t)(tag) << 56) #define SET_TAG(ptr, tag) (((uint64_t)(ptr) & ~SHIFT_TAG(0xff)) | \ |
