diff mbox series

[v11,31/40] kselftest/arm64: sme: Add SME support to vlset

Message ID 20220207152109.197566-32-broonie@kernel.org (mailing list archive)
State Accepted
Commit e8c4451480d0cb37cbc69160113b1f4ff211cd16
Headers show
Series arm64/sme: Initial support for the Scalable Matrix Extension | expand

Commit Message

Mark Brown Feb. 7, 2022, 3:21 p.m. UTC
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>
---
 tools/testing/selftests/arm64/fp/vlset.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Shuah Khan Feb. 8, 2022, 12:15 a.m. UTC | #1
On 2/7/22 8:21 AM, Mark Brown wrote:
> 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.

It would be useful to add a -g command to get the current value.
-g would just do PR_SVE_GET_VL and print the value perhaps?

> 
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>   tools/testing/selftests/arm64/fp/vlset.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/arm64/fp/vlset.c b/tools/testing/selftests/arm64/fp/vlset.c
> index 308d27a68226..76912a581a95 100644
> --- a/tools/testing/selftests/arm64/fp/vlset.c
> +++ b/tools/testing/selftests/arm64/fp/vlset.c
> @@ -22,12 +22,15 @@ static int inherit = 0;
>   static int no_inherit = 0;
>   static int force = 0;
>   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[] = {
>   	{ "force",	no_argument, NULL, 'f' },
>   	{ "inherit",	no_argument, NULL, 'i' },
>   	{ "max",	no_argument, NULL, 'M' },
>   	{ "no-inherit",	no_argument, &no_inherit, 1 },
> +	{ "sme",	no_argument, NULL, 's' },
>   	{ "help",	no_argument, NULL, '?' },
>   	{}
>   };
> @@ -50,6 +53,9 @@ static int parse_options(int argc, char **argv)
>   		case 'M':	vl = SVE_VL_MAX; break;
>   		case 'f':	force = 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;
>   		default:	goto error;
>   		}
> @@ -125,14 +131,14 @@ int main(int argc, char **argv)
>   	if (inherit)
>   		flags |= PR_SVE_VL_INHERIT;
>   
> -	t = prctl(PR_SVE_SET_VL, vl | flags);
> +	t = prctl(set_ctl, vl | flags);
>   	if (t < 0) {
>   		fprintf(stderr, "%s: PR_SVE_SET_VL: %s\n",
>   			program_name, strerror(errno));
>   		goto error;
>   	}
>   
> -	t = prctl(PR_SVE_GET_VL);
> +	t = prctl(get_ctl);
>   	if (t == -1) {
>   		fprintf(stderr, "%s: PR_SVE_GET_VL: %s\n",
>   			program_name, strerror(errno));
> 

With the above comment addressed or explained:

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah
Mark Brown Feb. 8, 2022, 3:51 p.m. UTC | #2
On Mon, Feb 07, 2022 at 05:15:39PM -0700, Shuah Khan wrote:
> On 2/7/22 8:21 AM, Mark Brown wrote:
> > 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.

> It would be useful to add a -g command to get the current value.
> -g would just do PR_SVE_GET_VL and print the value perhaps?

We already have the rdvl helper programs which can be used to read the
actual vector length from a shell command.  I'm not sure there's a
particular use case for adding something to to this program, and I'm not
sure the complexity is worth it especially given that we've got both the
actual and to be inherited vector lengths to be considered in the UI.
This program exists to allow you to configure vector lengths for the
stress tests without having to write UI code in assembler.
Catalin Marinas Feb. 23, 2022, 3:42 p.m. UTC | #3
On Mon, Feb 07, 2022 at 03:21:00PM +0000, Mark Brown wrote:
> 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>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
diff mbox series

Patch

diff --git a/tools/testing/selftests/arm64/fp/vlset.c b/tools/testing/selftests/arm64/fp/vlset.c
index 308d27a68226..76912a581a95 100644
--- a/tools/testing/selftests/arm64/fp/vlset.c
+++ b/tools/testing/selftests/arm64/fp/vlset.c
@@ -22,12 +22,15 @@  static int inherit = 0;
 static int no_inherit = 0;
 static int force = 0;
 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[] = {
 	{ "force",	no_argument, NULL, 'f' },
 	{ "inherit",	no_argument, NULL, 'i' },
 	{ "max",	no_argument, NULL, 'M' },
 	{ "no-inherit",	no_argument, &no_inherit, 1 },
+	{ "sme",	no_argument, NULL, 's' },
 	{ "help",	no_argument, NULL, '?' },
 	{}
 };
@@ -50,6 +53,9 @@  static int parse_options(int argc, char **argv)
 		case 'M':	vl = SVE_VL_MAX; break;
 		case 'f':	force = 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;
 		default:	goto error;
 		}
@@ -125,14 +131,14 @@  int main(int argc, char **argv)
 	if (inherit)
 		flags |= PR_SVE_VL_INHERIT;
 
-	t = prctl(PR_SVE_SET_VL, vl | flags);
+	t = prctl(set_ctl, vl | flags);
 	if (t < 0) {
 		fprintf(stderr, "%s: PR_SVE_SET_VL: %s\n",
 			program_name, strerror(errno));
 		goto error;
 	}
 
-	t = prctl(PR_SVE_GET_VL);
+	t = prctl(get_ctl);
 	if (t == -1) {
 		fprintf(stderr, "%s: PR_SVE_GET_VL: %s\n",
 			program_name, strerror(errno));