Commit e8c44514 authored by Mark Brown's avatar Mark Brown Committed by Catalin Marinas

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: default avatarMark Brown <broonie@kernel.org>
Reviewed-by: default avatarShuah Khan <skhan@linuxfoundation.org>
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20220419112247.711548-30-broonie@kernel.orgSigned-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 6d51b188
...@@ -22,12 +22,15 @@ static int inherit = 0; ...@@ -22,12 +22,15 @@ static int inherit = 0;
static int no_inherit = 0; static int no_inherit = 0;
static int force = 0; static int force = 0;
static unsigned long vl; static unsigned long vl;
static int set_ctl = PR_SVE_SET_VL;
static int get_ctl = PR_SVE_GET_VL;
static const struct option options[] = { static const struct option options[] = {
{ "force", no_argument, NULL, 'f' }, { "force", no_argument, NULL, 'f' },
{ "inherit", no_argument, NULL, 'i' }, { "inherit", no_argument, NULL, 'i' },
{ "max", no_argument, NULL, 'M' }, { "max", no_argument, NULL, 'M' },
{ "no-inherit", no_argument, &no_inherit, 1 }, { "no-inherit", no_argument, &no_inherit, 1 },
{ "sme", no_argument, NULL, 's' },
{ "help", no_argument, NULL, '?' }, { "help", no_argument, NULL, '?' },
{} {}
}; };
...@@ -50,6 +53,9 @@ static int parse_options(int argc, char **argv) ...@@ -50,6 +53,9 @@ static int parse_options(int argc, char **argv)
case 'M': vl = SVE_VL_MAX; break; case 'M': vl = SVE_VL_MAX; break;
case 'f': force = 1; break; case 'f': force = 1; break;
case 'i': inherit = 1; break; case 'i': inherit = 1; break;
case 's': set_ctl = PR_SME_SET_VL;
get_ctl = PR_SME_GET_VL;
break;
case 0: break; case 0: break;
default: goto error; default: goto error;
} }
...@@ -125,14 +131,14 @@ int main(int argc, char **argv) ...@@ -125,14 +131,14 @@ int main(int argc, char **argv)
if (inherit) if (inherit)
flags |= PR_SVE_VL_INHERIT; flags |= PR_SVE_VL_INHERIT;
t = prctl(PR_SVE_SET_VL, vl | flags); t = prctl(set_ctl, vl | flags);
if (t < 0) { if (t < 0) {
fprintf(stderr, "%s: PR_SVE_SET_VL: %s\n", fprintf(stderr, "%s: PR_SVE_SET_VL: %s\n",
program_name, strerror(errno)); program_name, strerror(errno));
goto error; goto error;
} }
t = prctl(PR_SVE_GET_VL); t = prctl(get_ctl);
if (t == -1) { if (t == -1) {
fprintf(stderr, "%s: PR_SVE_GET_VL: %s\n", fprintf(stderr, "%s: PR_SVE_GET_VL: %s\n",
program_name, strerror(errno)); program_name, strerror(errno));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment