aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/arm64/signal/testcases/za_regs.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/arm64/signal/testcases/za_regs.c')
-rw-r--r--tools/testing/selftests/arm64/signal/testcases/za_regs.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/tools/testing/selftests/arm64/signal/testcases/za_regs.c b/tools/testing/selftests/arm64/signal/testcases/za_regs.c
index b94e4f99fcac..ea45acb115d5 100644
--- a/tools/testing/selftests/arm64/signal/testcases/za_regs.c
+++ b/tools/testing/selftests/arm64/signal/testcases/za_regs.c
@@ -13,7 +13,10 @@
#include "test_signals_utils.h"
#include "testcases.h"
-struct fake_sigframe sf;
+static union {
+ ucontext_t uc;
+ char buf[1024 * 128];
+} context;
static unsigned int vls[SVE_VQ_MAX];
unsigned int nvls = 0;
@@ -22,10 +25,10 @@ static bool sme_get_vls(struct tdescr *td)
int vq, vl;
/*
- * Enumerate up to SVE_VQ_MAX vector lengths
+ * Enumerate up to SME_VQ_MAX vector lengths
*/
for (vq = SVE_VQ_MAX; vq > 0; --vq) {
- vl = prctl(PR_SVE_SET_VL, vq * 16);
+ vl = prctl(PR_SME_SET_VL, vq * 16);
if (vl == -1)
return false;
@@ -52,11 +55,13 @@ static void setup_za_regs(void)
asm volatile(".inst 0xd503457f" : : : );
}
+static char zeros[ZA_SIG_REGS_SIZE(SVE_VQ_MAX)];
+
static int do_one_sme_vl(struct tdescr *td, siginfo_t *si, ucontext_t *uc,
unsigned int vl)
{
- size_t resv_sz, offset;
- struct _aarch64_ctx *head = GET_SF_RESV_HEAD(sf);
+ size_t offset;
+ struct _aarch64_ctx *head = GET_BUF_RESV_HEAD(context);
struct za_context *za;
fprintf(stderr, "Testing VL %d\n", vl);
@@ -71,11 +76,10 @@ static int do_one_sme_vl(struct tdescr *td, siginfo_t *si, ucontext_t *uc,
* in it.
*/
setup_za_regs();
- if (!get_current_context(td, &sf.uc))
+ if (!get_current_context(td, &context.uc, sizeof(context)))
return 1;
- resv_sz = GET_SF_RESV_SIZE(sf);
- head = get_header(head, ZA_MAGIC, resv_sz, &offset);
+ head = get_header(head, ZA_MAGIC, GET_BUF_RESV_SIZE(context), &offset);
if (!head) {
fprintf(stderr, "No ZA context\n");
return 1;
@@ -87,10 +91,22 @@ static int do_one_sme_vl(struct tdescr *td, siginfo_t *si, ucontext_t *uc,
return 1;
}
- /* The actual size validation is done in get_current_context() */
+ if (head->size != ZA_SIG_CONTEXT_SIZE(sve_vq_from_vl(vl))) {
+ fprintf(stderr, "ZA context size %u, expected %lu\n",
+ head->size, ZA_SIG_CONTEXT_SIZE(sve_vq_from_vl(vl)));
+ return 1;
+ }
+
fprintf(stderr, "Got expected size %u and VL %d\n",
head->size, za->vl);
+ /* We didn't load any data into ZA so it should be all zeros */
+ if (memcmp(zeros, (char *)za + ZA_SIG_REGS_OFFSET,
+ ZA_SIG_REGS_SIZE(sve_vq_from_vl(za->vl))) != 0) {
+ fprintf(stderr, "ZA data invalid\n");
+ return 1;
+ }
+
return 0;
}
@@ -99,16 +115,6 @@ static int sme_regs(struct tdescr *td, siginfo_t *si, ucontext_t *uc)
int i;
for (i = 0; i < nvls; i++) {
- /*
- * TODO: the signal test helpers can't currently cope
- * with signal frames bigger than struct sigcontext,
- * skip VLs that will trigger that.
- */
- if (vls[i] > 32) {
- printf("Skipping VL %u due to stack size\n", vls[i]);
- continue;
- }
-
if (do_one_sme_vl(td, si, uc, vls[i]))
return 1;
}