diff options
author | Mark Brown <broonie@kernel.org> | 2022-04-19 13:22:47 +0200 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2022-04-28 18:57:12 +0200 |
commit | 212b0426bc361eede2f9ce43fb2a5b01070000a1 (patch) | |
tree | 0a77f65eb412518404baf93b48b1556d7a24dc64 /tools/testing/selftests/arm64/fp/za-fork-asm.S | |
parent | kselftest/arm64: Add SME support to syscall ABI test (diff) | |
download | linux-212b0426bc361eede2f9ce43fb2a5b01070000a1.tar.xz linux-212b0426bc361eede2f9ce43fb2a5b01070000a1.zip |
selftests/arm64: Add a testcase for handling of ZA on clone()
Add a small testcase that attempts to do a clone() with ZA enabled and
verifies that it remains enabled with the same contents. We only check
one word in one horizontal vector of ZA since there's already other tests
that check for data corruption more broadly, we're just looking to make
sure that ZA is still enabled and it looks like the data got copied.
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20220419112247.711548-40-broonie@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'tools/testing/selftests/arm64/fp/za-fork-asm.S')
-rw-r--r-- | tools/testing/selftests/arm64/fp/za-fork-asm.S | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tools/testing/selftests/arm64/fp/za-fork-asm.S b/tools/testing/selftests/arm64/fp/za-fork-asm.S new file mode 100644 index 000000000000..2fafadd491c3 --- /dev/null +++ b/tools/testing/selftests/arm64/fp/za-fork-asm.S @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (C) 2021 ARM Limited. + +#include "sme-inst.h" + +.arch_extension sve + +#define MAGIC 42 + +#define MAXVL 2048 +#define MAXVL_B (MAXVL / 8) + +.pushsection .text +.data +.align 4 +scratch: + .space MAXVL_B +.popsection + +.globl fork_test +fork_test: + smstart_za + + // For simplicity just set one word in one vector, other tests + // cover general data corruption issues. + ldr x0, =scratch + mov x1, #MAGIC + str x1, [x0] + mov w12, wzr + _ldr_za 12, 0 // ZA.H[W12] loaded from [X0] + + // Tail call into the C portion that does the fork & verify + b fork_test_c + +.globl verify_fork +verify_fork: + // SVCR should have ZA=1, SM=0 + mrs x0, S3_3_C4_C2_2 + and x1, x0, #3 + cmp x1, #2 + beq 1f + mov x0, xzr + b 100f +1: + + // ZA should still have the value we loaded + ldr x0, =scratch + mov w12, wzr + _str_za 12, 0 // ZA.H[W12] stored to [X0] + ldr x1, [x0] + cmp x1, #MAGIC + beq 2f + mov x0, xzr + b 100f + +2: + // All tests passed + mov x0, #1 +100: + ret + |