kselftest/arm64: Validate SVCR in streaming SVE stress test
authorMark Brown <broonie@kernel.org>
Fri, 22 Sep 2023 13:42:55 +0000 (14:42 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 25 Sep 2023 16:20:38 +0000 (17:20 +0100)
In the ZA and ZT test programs we explicitly validate that PSTATE.ZA is as
expected on each loop but we do not do the equivalent for our streaming
SVE test, add a check that we are still in streaming mode on every loop
in case that goes wrong.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230922-arm64-ssve-validate-svcr-v1-1-f518960eaeda@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
tools/testing/selftests/arm64/fp/sve-test.S

index 4328895dfc8763f6f63c540f27c8976eaf3da7d6..547d077e351727b4edc237ea5d4e136d8d743b4a 100644 (file)
@@ -473,6 +473,13 @@ function _start
 //     mov     x8, #__NR_sched_yield   // Encourage preemption
 //     svc     #0
 
+#ifdef SSVE
+       mrs     x0, S3_3_C4_C2_2        // SVCR should have ZA=0,SM=1
+       and     x1, x0, #3
+       cmp     x1, #1
+       b.ne    svcr_barf
+#endif
+
        mov     x21, #0
 0:     mov     x0, x21
        bl      check_zreg
@@ -553,3 +560,15 @@ function vl_barf
        mov     x1, #1
        svc     #0
 endfunction
+
+function svcr_barf
+       mov     x10, x0
+
+       puts    "Bad SVCR: "
+       mov     x0, x10
+       bl      putdecn
+
+       mov     x8, #__NR_exit
+       mov     x1, #1
+       svc     #0
+endfunction