Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230720-arm64-fix-sve-sme-vl-change-v2-3-8eea06b82d57@kernel.org
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Mark Brown and committed by
Will Deacon
0aeead9b 0c7c237b

+21 -1
+21 -1
tools/testing/selftests/arm64/fp/vec-syscfg.c
··· 554 554 /* For each VQ verify that setting via prctl() does the right thing */ 555 555 static void prctl_set_all_vqs(struct vec_data *data) 556 556 { 557 - int ret, vq, vl, new_vl; 557 + int ret, vq, vl, new_vl, i; 558 + int orig_vls[ARRAY_SIZE(vec_data)]; 558 559 int errors = 0; 559 560 560 561 if (!data->min_vl || !data->max_vl) { ··· 563 562 data->name); 564 563 return; 565 564 } 565 + 566 + for (i = 0; i < ARRAY_SIZE(vec_data); i++) 567 + orig_vls[i] = vec_data[i].rdvl(); 566 568 567 569 for (vq = SVE_VQ_MIN; vq <= SVE_VQ_MAX; vq++) { 568 570 vl = sve_vl_from_vq(vq); ··· 587 583 ksft_print_msg("Set %s VL %d but RDVL reports %d\n", 588 584 data->name, new_vl, data->rdvl()); 589 585 errors++; 586 + } 587 + 588 + /* Did any other VLs change? */ 589 + for (i = 0; i < ARRAY_SIZE(vec_data); i++) { 590 + if (&vec_data[i] == data) 591 + continue; 592 + 593 + if (!(getauxval(vec_data[i].hwcap_type) & vec_data[i].hwcap)) 594 + continue; 595 + 596 + if (vec_data[i].rdvl() != orig_vls[i]) { 597 + ksft_print_msg("%s VL changed from %d to %d\n", 598 + vec_data[i].name, orig_vls[i], 599 + vec_data[i].rdvl()); 600 + errors++; 601 + } 590 602 } 591 603 592 604 /* Was that the VL we asked for? */