]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
kselftest/arm64: fp-ptrace: Adjust to new inactive mode behaviour
authorMark Rutland <mark.rutland@arm.com>
Thu, 8 May 2025 13:26:44 +0000 (14:26 +0100)
committerWill Deacon <will@kernel.org>
Thu, 8 May 2025 14:45:24 +0000 (15:45 +0100)
In order to fix an ABI problem, we recently changed the way that reads
of the NT_ARM_SVE and NT_ARM_SSVE regsets behave when their
corresponding vector state is inactive.

Update the fp-ptrace test for the new behaviour.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Spickett <david.spickett@arm.com>
Cc: Luis Machado <luis.machado@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Mark Brown <broonie@kernel.org>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20250508132644.1395904-25-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
tools/testing/selftests/arm64/fp/fp-ptrace.c

index c2882a5a5cc0aa912a7780b14b1e8914b0c62d31..191c47ca0ed80de94e54023920e27fe62a0a20f2 100644 (file)
@@ -439,10 +439,17 @@ static bool check_ptrace_values_sve(pid_t child, struct test_config *config)
                pass = false;
        }
 
-       if (sve->size != SVE_PT_SIZE(vq, sve->flags)) {
-               ksft_print_msg("Mismatch in SVE header size: %d != %lu\n",
-                              sve->size, SVE_PT_SIZE(vq, sve->flags));
-               pass = false;
+       if (svcr_in & SVCR_SM) {
+               if (sve->size != sizeof(sve)) {
+                       ksft_print_msg("NT_ARM_SVE reports data with PSTATE.SM\n");
+                       pass = false;
+               }
+       } else {
+               if (sve->size != SVE_PT_SIZE(vq, sve->flags)) {
+                       ksft_print_msg("Mismatch in SVE header size: %d != %lu\n",
+                                      sve->size, SVE_PT_SIZE(vq, sve->flags));
+                       pass = false;
+               }
        }
 
        /* The registers might be in completely different formats! */
@@ -515,10 +522,17 @@ static bool check_ptrace_values_ssve(pid_t child, struct test_config *config)
                pass = false;
        }
 
-       if (sve->size != SVE_PT_SIZE(vq, sve->flags)) {
-               ksft_print_msg("Mismatch in SSVE header size: %d != %lu\n",
-                              sve->size, SVE_PT_SIZE(vq, sve->flags));
-               pass = false;
+       if (!(svcr_in & SVCR_SM)) {
+               if (sve->size != sizeof(sve)) {
+                       ksft_print_msg("NT_ARM_SSVE reports data without PSTATE.SM\n");
+                       pass = false;
+               }
+       } else {
+               if (sve->size != SVE_PT_SIZE(vq, sve->flags)) {
+                       ksft_print_msg("Mismatch in SSVE header size: %d != %lu\n",
+                                      sve->size, SVE_PT_SIZE(vq, sve->flags));
+                       pass = false;
+               }
        }
 
        /* The registers might be in completely different formats! */