Lines Matching +full:read +full:- +full:out

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2015-2021 ARM Limited.
58 #define VL_TESTS (((SVE_VQ_MAX - SVE_VQ_MIN) + 1) * 4)
74 if (ptrace(PTRACE_TRACEME, -1, NULL, NULL)) in do_child()
123 if (ptrace(PTRACE_GETREGSET, pid, type->regset, &iov)) in get_sve()
127 if (sve->size <= sz) in get_sve()
130 sz = sve->size; in get_sve()
145 iov.iov_len = sve->size; in set_sve()
146 return ptrace(PTRACE_SETREGSET, pid, type->regset, &iov); in set_sve()
165 type->name); in ptrace_set_get_inherit()
170 * Read back the new register state and verify that we have in ptrace_set_get_inherit()
174 ksft_test_result_fail("Failed to read %s SVE flags\n", in ptrace_set_get_inherit()
175 type->name); in ptrace_set_get_inherit()
179 ksft_test_result(new_sve->flags & SVE_PT_VL_INHERIT, in ptrace_set_get_inherit()
180 "%s SVE_PT_VL_INHERIT set\n", type->name); in ptrace_set_get_inherit()
187 type->name); in ptrace_set_get_inherit()
192 ksft_test_result_fail("Failed to read %s SVE flags\n", in ptrace_set_get_inherit()
193 type->name); in ptrace_set_get_inherit()
197 ksft_test_result(!(new_sve->flags & SVE_PT_VL_INHERIT), in ptrace_set_get_inherit()
198 "%s SVE_PT_VL_INHERIT cleared\n", type->name); in ptrace_set_get_inherit()
215 prctl_vl = prctl(type->prctl_set, vl); in ptrace_set_get_vl()
216 if (prctl_vl == -1) in ptrace_set_get_vl()
218 type->name, strerror(errno), errno); in ptrace_set_get_vl()
230 type->name, vl); in ptrace_set_get_vl()
235 * Read back the new register state and verify that we have the in ptrace_set_get_vl()
239 ksft_test_result_fail("Failed to read %s VL %u\n", in ptrace_set_get_vl()
240 type->name, vl); in ptrace_set_get_vl()
244 ksft_test_result(new_sve->vl = prctl_vl, "Set %s VL %u\n", in ptrace_set_get_vl()
245 type->name, vl); in ptrace_set_get_vl()
251 uint32_t *in, uint32_t *out, int *errors) in check_u32() argument
253 if (*in != *out) { in check_u32()
254 printf("# VL %d %s wrote %x read %x\n", in check_u32()
255 vl, reg, *in, *out); in check_u32()
278 sve->flags = SVE_PT_REGS_FPSIMD; in ptrace_sve_fpsimd()
279 sve->size = SVE_PT_SIZE(0, SVE_PT_REGS_FPSIMD); in ptrace_sve_fpsimd()
280 sve->vl = 16; /* We don't care what the VL is */ in ptrace_sve_fpsimd()
286 p = (unsigned char *)&fpsimd->vregs[i]; in ptrace_sve_fpsimd()
288 for (j = 0; j < sizeof(fpsimd->vregs[i]); ++j) in ptrace_sve_fpsimd()
294 type->name, ret); in ptrace_sve_fpsimd()
296 goto out; in ptrace_sve_fpsimd()
302 goto out; in ptrace_sve_fpsimd()
306 type->name); in ptrace_sve_fpsimd()
309 type->name); in ptrace_sve_fpsimd()
311 out: in ptrace_sve_fpsimd()
315 /* Validate attempting to set SVE data and read SVE data */
334 data_size, type->name, vl); in ptrace_set_sve_get_sve_data()
339 /* Set up some data and write it out */ in ptrace_set_sve_get_sve_data()
341 write_sve->size = data_size; in ptrace_set_sve_get_sve_data()
342 write_sve->vl = vl; in ptrace_set_sve_get_sve_data()
343 write_sve->flags = SVE_PT_REGS_SVE; in ptrace_set_sve_get_sve_data()
361 type->name, vl); in ptrace_set_sve_get_sve_data()
362 goto out; in ptrace_set_sve_get_sve_data()
365 /* Read the data back */ in ptrace_set_sve_get_sve_data()
367 ksft_test_result_fail("Failed to read %s VL %u data\n", in ptrace_set_sve_get_sve_data()
368 type->name, vl); in ptrace_set_sve_get_sve_data()
369 goto out; in ptrace_set_sve_get_sve_data()
373 /* We might read more data if there's extensions we don't know */ in ptrace_set_sve_get_sve_data()
374 if (read_sve->size < write_sve->size) { in ptrace_set_sve_get_sve_data()
375 ksft_test_result_fail("%s wrote %d bytes, only read %d\n", in ptrace_set_sve_get_sve_data()
376 type->name, write_sve->size, in ptrace_set_sve_get_sve_data()
377 read_sve->size); in ptrace_set_sve_get_sve_data()
405 type->name, vl); in ptrace_set_sve_get_sve_data()
409 out: in ptrace_set_sve_get_sve_data()
413 /* Validate attempting to set SVE data and read it via the FPSIMD regset */
435 data_size, type->name, vl); in ptrace_set_sve_get_fpsimd_data()
440 /* Set up some data and write it out */ in ptrace_set_sve_get_fpsimd_data()
442 write_sve->size = data_size; in ptrace_set_sve_get_fpsimd_data()
443 write_sve->vl = vl; in ptrace_set_sve_get_fpsimd_data()
444 write_sve->flags = SVE_PT_REGS_SVE; in ptrace_set_sve_get_fpsimd_data()
456 type->name, vl); in ptrace_set_sve_get_fpsimd_data()
457 goto out; in ptrace_set_sve_get_fpsimd_data()
460 /* Read the data back */ in ptrace_set_sve_get_fpsimd_data()
462 ksft_test_result_fail("Failed to read %s VL %u FPSIMD data\n", in ptrace_set_sve_get_fpsimd_data()
463 type->name, vl); in ptrace_set_sve_get_fpsimd_data()
464 goto out; in ptrace_set_sve_get_fpsimd_data()
479 type->name, vl, i); in ptrace_set_sve_get_fpsimd_data()
490 type->name, vl); in ptrace_set_sve_get_fpsimd_data()
492 out: in ptrace_set_sve_get_fpsimd_data()
496 /* Validate attempting to set FPSIMD data and read it via the SVE regset */
531 ksft_test_result_fail("Failed to read %s VL %u data\n", in ptrace_set_fpsimd_get_sve_data()
532 type->name, vl); in ptrace_set_fpsimd_get_sve_data()
537 if (read_sve->vl != vl) { in ptrace_set_fpsimd_get_sve_data()
539 read_sve->vl, vl); in ptrace_set_fpsimd_get_sve_data()
540 goto out; in ptrace_set_fpsimd_get_sve_data()
544 switch (read_sve->flags & SVE_PT_REGS_MASK) { in ptrace_set_fpsimd_get_sve_data()
548 ksft_test_result_fail("Read %d bytes, expected %d\n", in ptrace_set_fpsimd_get_sve_data()
550 goto out; in ptrace_set_fpsimd_get_sve_data()
556 ksft_print_msg("Read FPSIMD data mismatch\n"); in ptrace_set_fpsimd_get_sve_data()
564 ksft_test_result_fail("Read %d bytes, expected %d\n", in ptrace_set_fpsimd_get_sve_data()
566 goto out; in ptrace_set_fpsimd_get_sve_data()
581 type->name, vl, i, i); in ptrace_set_fpsimd_get_sve_data()
593 read_sve->flags & SVE_PT_REGS_MASK); in ptrace_set_fpsimd_get_sve_data()
598 ksft_test_result(errors == 0, "Set FPSIMD, read via SVE for %s VL %u\n", in ptrace_set_fpsimd_get_sve_data()
599 type->name, vl); in ptrace_set_fpsimd_get_sve_data()
601 out: in ptrace_set_fpsimd_get_sve_data()
621 if (pid == -1) { in do_parent()
646 sig = 0; /* bust group-stop */ in do_parent()
677 ksft_test_result_skip("%s FPSIMD read\n", in do_parent()