Skip to content

Commit e8c4451

Browse files
brooniectmarinas
authored andcommitted
kselftest/arm64: sme: Add SME support to vlset
The Scalable Matrix Extenions (SME) introduces additional register state with configurable vector lengths, similar to SVE but configured separately. Extend vlset to support configuring this state with a --sme or -s command line option. 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-30-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 6d51b18 commit e8c4451

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

  • tools/testing/selftests/arm64/fp

tools/testing/selftests/arm64/fp/vlset.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,15 @@ static int inherit = 0;
2222
static int no_inherit = 0;
2323
static int force = 0;
2424
static unsigned long vl;
25+
static int set_ctl = PR_SVE_SET_VL;
26+
static int get_ctl = PR_SVE_GET_VL;
2527

2628
static const struct option options[] = {
2729
{ "force", no_argument, NULL, 'f' },
2830
{ "inherit", no_argument, NULL, 'i' },
2931
{ "max", no_argument, NULL, 'M' },
3032
{ "no-inherit", no_argument, &no_inherit, 1 },
33+
{ "sme", no_argument, NULL, 's' },
3134
{ "help", no_argument, NULL, '?' },
3235
{}
3336
};
@@ -50,6 +53,9 @@ static int parse_options(int argc, char **argv)
5053
case 'M': vl = SVE_VL_MAX; break;
5154
case 'f': force = 1; break;
5255
case 'i': inherit = 1; break;
56+
case 's': set_ctl = PR_SME_SET_VL;
57+
get_ctl = PR_SME_GET_VL;
58+
break;
5359
case 0: break;
5460
default: goto error;
5561
}
@@ -125,14 +131,14 @@ int main(int argc, char **argv)
125131
if (inherit)
126132
flags |= PR_SVE_VL_INHERIT;
127133

128-
t = prctl(PR_SVE_SET_VL, vl | flags);
134+
t = prctl(set_ctl, vl | flags);
129135
if (t < 0) {
130136
fprintf(stderr, "%s: PR_SVE_SET_VL: %s\n",
131137
program_name, strerror(errno));
132138
goto error;
133139
}
134140

135-
t = prctl(PR_SVE_GET_VL);
141+
t = prctl(get_ctl);
136142
if (t == -1) {
137143
fprintf(stderr, "%s: PR_SVE_GET_VL: %s\n",
138144
program_name, strerror(errno));

0 commit comments

Comments
 (0)