Skip to content

Commit 0aeead9

Browse files
brooniewilldeacon
authored andcommitted
kselftest/arm64: Validate that changing one VL type does not affect another
On a system with both SVE and SME when we change one of the VLs this should not result in a change in the other VL. Add a check that this is in fact the case to vec-syscfg. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/20230720-arm64-fix-sve-sme-vl-change-v2-3-8eea06b82d57@kernel.org Signed-off-by: Will Deacon <[email protected]>
1 parent 0c7c237 commit 0aeead9

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tools/testing/selftests/arm64/fp/vec-syscfg.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,8 @@ static void prctl_set_onexec(struct vec_data *data)
554554
/* For each VQ verify that setting via prctl() does the right thing */
555555
static void prctl_set_all_vqs(struct vec_data *data)
556556
{
557-
int ret, vq, vl, new_vl;
557+
int ret, vq, vl, new_vl, i;
558+
int orig_vls[ARRAY_SIZE(vec_data)];
558559
int errors = 0;
559560

560561
if (!data->min_vl || !data->max_vl) {
@@ -563,6 +564,9 @@ static void prctl_set_all_vqs(struct vec_data *data)
563564
return;
564565
}
565566

567+
for (i = 0; i < ARRAY_SIZE(vec_data); i++)
568+
orig_vls[i] = vec_data[i].rdvl();
569+
566570
for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; vq++) {
567571
vl = sve_vl_from_vq(vq);
568572

@@ -585,6 +589,22 @@ static void prctl_set_all_vqs(struct vec_data *data)
585589
errors++;
586590
}
587591

592+
/* Did any other VLs change? */
593+
for (i = 0; i < ARRAY_SIZE(vec_data); i++) {
594+
if (&vec_data[i] == data)
595+
continue;
596+
597+
if (!(getauxval(vec_data[i].hwcap_type) & vec_data[i].hwcap))
598+
continue;
599+
600+
if (vec_data[i].rdvl() != orig_vls[i]) {
601+
ksft_print_msg("%s VL changed from %d to %d\n",
602+
vec_data[i].name, orig_vls[i],
603+
vec_data[i].rdvl());
604+
errors++;
605+
}
606+
}
607+
588608
/* Was that the VL we asked for? */
589609
if (new_vl == vl)
590610
continue;

0 commit comments

Comments
 (0)