Skip to content

Commit a0f2eb6

Browse files
brooniectmarinas
authored andcommitted
kselftest/arm64: Extend vector configuration API tests to cover SME
Provide RDVL helpers for SME and extend the main vector configuration tests to cover SME. 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-32-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 30e3a42 commit a0f2eb6

6 files changed

Lines changed: 38 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
fp-pidbench
22
fpsimd-test
3+
rdvl-sme
34
rdvl-sve
45
sve-probe-vls
56
sve-ptrace

tools/testing/selftests/arm64/fp/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
CFLAGS += -I../../../../../usr/include/
44
TEST_GEN_PROGS := sve-ptrace sve-probe-vls vec-syscfg
55
TEST_PROGS_EXTENDED := fp-pidbench fpsimd-test fpsimd-stress \
6-
rdvl-sve \
6+
rdvl-sme rdvl-sve \
77
sve-test sve-stress \
88
vlset
99

@@ -13,6 +13,7 @@ fp-pidbench: fp-pidbench.S asm-utils.o
1313
$(CC) -nostdlib $^ -o $@
1414
fpsimd-test: fpsimd-test.o asm-utils.o
1515
$(CC) -nostdlib $^ -o $@
16+
rdvl-sme: rdvl-sme.o rdvl.o
1617
rdvl-sve: rdvl-sve.o rdvl.o
1718
sve-ptrace: sve-ptrace.o
1819
sve-probe-vls: sve-probe-vls.o rdvl.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_sme();
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
@@ -1,10 +1,20 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
// Copyright (C) 2021 ARM Limited.
33

4+
#include "sme-inst.h"
5+
46
.arch_extension sve
57

68
.globl rdvl_sve
79
rdvl_sve:
810
hint 34 // BTI C
911
rdvl x0, #1
1012
ret
13+
14+
.globl rdvl_sme
15+
rdvl_sme:
16+
hint 34 // BTI C
17+
18+
rdsvl 0, 1
19+
20+
ret

tools/testing/selftests/arm64/fp/rdvl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#ifndef RDVL_H
44
#define RDVL_H
55

6+
int rdvl_sme(void);
67
int rdvl_sve(void);
78

89
#endif

tools/testing/selftests/arm64/fp/vec-syscfg.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ static struct vec_data vec_data[] = {
5151
.prctl_set = PR_SVE_SET_VL,
5252
.default_vl_file = "/proc/sys/abi/sve_default_vector_length",
5353
},
54+
{
55+
.name = "SME",
56+
.hwcap_type = AT_HWCAP2,
57+
.hwcap = HWCAP2_SME,
58+
.rdvl = rdvl_sme,
59+
.rdvl_binary = "./rdvl-sme",
60+
.prctl_get = PR_SME_GET_VL,
61+
.prctl_set = PR_SME_SET_VL,
62+
.default_vl_file = "/proc/sys/abi/sme_default_vector_length",
63+
},
5464
};
5565

5666
static int stdio_read_integer(FILE *f, const char *what, int *val)

0 commit comments

Comments
 (0)