Skip to content

Commit 116e50d

Browse files
brooniectmarinas
authored andcommitted
kselftest/arm64: Check that SVCR is 0 in signal handlers
We don't currently validate that we exit streaming mode and clear ZA when we enter a signal handler. Add simple checks for this in the SSVE and ZA tests. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20241106-arm64-fpmr-signal-test-v1-1-31fa34ce58fe@kernel.org [catalin.marinas@arm.com: Use %lx in fprintf() as uint64_t seems to be unsigned long in glibc] Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 694e280 commit 116e50d

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

tools/testing/selftests/arm64/signal/sve_helpers.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,17 @@ extern unsigned int nvls;
1818

1919
int sve_fill_vls(bool use_sme, int min_vls);
2020

21+
static inline uint64_t get_svcr(void)
22+
{
23+
uint64_t val;
24+
25+
asm volatile (
26+
"mrs %0, S3_3_C4_C2_2\n"
27+
: "=r"(val)
28+
:
29+
: "cc");
30+
31+
return val;
32+
}
33+
2134
#endif

tools/testing/selftests/arm64/signal/testcases/ssve_regs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ static int do_one_sme_vl(struct tdescr *td, siginfo_t *si, ucontext_t *uc,
8585
fprintf(stderr, "Got expected size %u and VL %d\n",
8686
head->size, ssve->vl);
8787

88+
if (get_svcr() != 0) {
89+
fprintf(stderr, "Unexpected SVCR %lx\n", get_svcr());
90+
return 1;
91+
}
92+
8893
return 0;
8994
}
9095

tools/testing/selftests/arm64/signal/testcases/za_regs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ static int do_one_sme_vl(struct tdescr *td, siginfo_t *si, ucontext_t *uc,
9191
return 1;
9292
}
9393

94+
if (get_svcr() != 0) {
95+
fprintf(stderr, "Unexpected SVCR %lx\n", get_svcr());
96+
return 1;
97+
}
98+
9499
return 0;
95100
}
96101

0 commit comments

Comments
 (0)