Skip to content

Commit 7710861

Browse files
brooniectmarinas
authored andcommitted
kselftest/arm64: Provide a helper binary and "library" for SVE RDVL
SVE provides an instruction RDVL which reports the currently configured vector length. In order to validate that our vector length configuration interfaces are working correctly without having to build the C code for our test programs with SVE enabled provide a trivial assembly library with a C callable function that executes RDVL. Since these interfaces also control behaviour on exec*() provide a trivial wrapper program which reports the currently configured vector length on stdout, tests can use this to verify that behaviour on exec*() is as expected. In preparation for providing similar helper functionality for SME, the Scalable Matrix Extension, which allows separately configured vector lengths to be read back both the assembler function and wrapper binary have SVE included in their name. Signed-off-by: Mark Brown <[email protected]> Reviewed-by: Dave Martin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent dac3ce6 commit 7710861

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
fpsimd-test
2+
rdvl-sve
23
sve-probe-vls
34
sve-ptrace
45
sve-test

tools/testing/selftests/arm64/fp/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
CFLAGS += -I../../../../../usr/include/
44
TEST_GEN_PROGS := sve-ptrace sve-probe-vls
5-
TEST_PROGS_EXTENDED := fpsimd-test fpsimd-stress sve-test sve-stress vlset
5+
TEST_PROGS_EXTENDED := fpsimd-test fpsimd-stress \
6+
rdvl-sve \
7+
sve-test sve-stress \
8+
vlset
69

710
all: $(TEST_GEN_PROGS) $(TEST_PROGS_EXTENDED)
811

912
fpsimd-test: fpsimd-test.o
1013
$(CC) -nostdlib $^ -o $@
14+
rdvl-sve: rdvl-sve.o rdvl.o
1115
sve-ptrace: sve-ptrace.o sve-ptrace-asm.o
1216
sve-probe-vls: sve-probe-vls.o
1317
sve-test: sve-test.o
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
3+
#include <stdio.h>
4+
5+
#include "rdvl.h"
6+
7+
int main(void)
8+
{
9+
int vl = rdvl_sve();
10+
11+
printf("%d\n", vl);
12+
13+
return 0;
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
// Copyright (C) 2021 ARM Limited.
3+
4+
.arch_extension sve
5+
6+
.globl rdvl_sve
7+
rdvl_sve:
8+
hint 34 // BTI C
9+
rdvl x0, #1
10+
ret
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+
#ifndef RDVL_H
4+
#define RDVL_H
5+
6+
int rdvl_sve(void);
7+
8+
#endif

0 commit comments

Comments
 (0)