Skip to content

Commit 4126bde

Browse files
brooniectmarinas
authored andcommitted
kselftest/arm64: sme: Provide streaming mode SVE stress test
One of the features of SME is the addition of streaming mode, in which we have access to a set of streaming mode SVE registers at the SME vector length. Since these are accessed using the SVE instructions let's reuse the existing SVE stress test for testing with a compile time option for controlling the few small differences needed: - Enter streaming mode immediately on starting the program. - In streaming mode FFR is removed so skip reading and writing FFR. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20220419112247.711548-33-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent a0f2eb6 commit 4126bde

4 files changed

Lines changed: 83 additions & 0 deletions

File tree

tools/testing/selftests/arm64/fp/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ rdvl-sve
55
sve-probe-vls
66
sve-ptrace
77
sve-test
8+
ssve-test
89
vec-syscfg
910
vlset

tools/testing/selftests/arm64/fp/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ TEST_GEN_PROGS := sve-ptrace sve-probe-vls vec-syscfg
55
TEST_PROGS_EXTENDED := fp-pidbench fpsimd-test fpsimd-stress \
66
rdvl-sme rdvl-sve \
77
sve-test sve-stress \
8+
ssve-test ssve-stress \
89
vlset
910

1011
all: $(TEST_GEN_PROGS) $(TEST_PROGS_EXTENDED)
@@ -19,6 +20,8 @@ sve-ptrace: sve-ptrace.o
1920
sve-probe-vls: sve-probe-vls.o rdvl.o
2021
sve-test: sve-test.o asm-utils.o
2122
$(CC) -nostdlib $^ -o $@
23+
ssve-test: sve-test.S asm-utils.o
24+
$(CC) -DSSVE -nostdlib $^ -o $@
2225
vec-syscfg: vec-syscfg.o rdvl.o
2326
vlset: vlset.o
2427

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-2.0-only
3+
# Copyright (C) 2015-2019 ARM Limited.
4+
# Original author: Dave Martin <Dave.Martin@arm.com>
5+
6+
set -ue
7+
8+
NR_CPUS=`nproc`
9+
10+
pids=
11+
logs=
12+
13+
cleanup () {
14+
trap - INT TERM CHLD
15+
set +e
16+
17+
if [ -n "$pids" ]; then
18+
kill $pids
19+
wait $pids
20+
pids=
21+
fi
22+
23+
if [ -n "$logs" ]; then
24+
cat $logs
25+
rm $logs
26+
logs=
27+
fi
28+
}
29+
30+
interrupt () {
31+
cleanup
32+
exit 0
33+
}
34+
35+
child_died () {
36+
cleanup
37+
exit 1
38+
}
39+
40+
trap interrupt INT TERM EXIT
41+
42+
for x in `seq 0 $((NR_CPUS * 4))`; do
43+
log=`mktemp`
44+
logs=$logs\ $log
45+
./ssve-test >$log &
46+
pids=$pids\ $!
47+
done
48+
49+
# Wait for all child processes to be created:
50+
sleep 10
51+
52+
while :; do
53+
kill -USR1 $pids
54+
done &
55+
pids=$pids\ $!
56+
57+
wait
58+
59+
exit 1

tools/testing/selftests/arm64/fp/sve-test.S

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <asm/unistd.h>
1414
#include "assembler.h"
1515
#include "asm-offsets.h"
16+
#include "sme-inst.h"
1617

1718
#define NZR 32
1819
#define NPR 16
@@ -156,6 +157,7 @@ endfunction
156157
// We fill the upper lanes of FFR with zeros.
157158
// Beware: corrupts P0.
158159
function setup_ffr
160+
#ifndef SSVE
159161
mov x4, x30
160162

161163
and w0, w0, #0x3
@@ -178,6 +180,9 @@ function setup_ffr
178180
wrffr p0.b
179181

180182
ret x4
183+
#else
184+
ret
185+
#endif
181186
endfunction
182187

183188
// Trivial memory compare: compare x2 bytes starting at address x0 with
@@ -260,6 +265,7 @@ endfunction
260265
// Beware -- corrupts P0.
261266
// Clobbers x0-x5.
262267
function check_ffr
268+
#ifndef SSVE
263269
mov x3, x30
264270

265271
ldr x4, =scratch
@@ -280,6 +286,9 @@ function check_ffr
280286
mov x2, x5
281287
mov x30, x3
282288
b memcmp
289+
#else
290+
ret
291+
#endif
283292
endfunction
284293

285294
// Any SVE register modified here can cause corruption in the main
@@ -295,10 +304,12 @@ function irritator_handler
295304
movi v0.8b, #1
296305
movi v9.16b, #2
297306
movi v31.8b, #3
307+
#ifndef SSVE
298308
// And P0
299309
rdffr p0.b
300310
// And FFR
301311
wrffr p15.b
312+
#endif
302313

303314
ret
304315
endfunction
@@ -359,6 +370,11 @@ endfunction
359370
.globl _start
360371
function _start
361372
_start:
373+
#ifdef SSVE
374+
puts "Streaming mode "
375+
smstart_sm
376+
#endif
377+
362378
// Sanity-check and report the vector length
363379

364380
rdvl x19, #8
@@ -407,6 +423,10 @@ _start:
407423
orr w2, w2, #SA_NODEFER
408424
bl setsignal
409425

426+
#ifdef SSVE
427+
smstart_sm // syscalls will have exited streaming mode
428+
#endif
429+
410430
mov x22, #0 // generation number, increments per iteration
411431
.Ltest_loop:
412432
rdvl x0, #8

0 commit comments

Comments
 (0)