All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricardo Koller <ricarkol@google.com>
To: Andrew Jones <drjones@redhat.com>
Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu,
	maz@kernel.org, eric.auger@redhat.com, alexandru.elisei@arm.com,
	pbonzini@redhat.com
Subject: Re: [PATCH v3 3/5] KVM: arm64: selftests: get-reg-list: Provide config selection option
Date: Wed, 2 Jun 2021 17:03:45 -0700	[thread overview]
Message-ID: <YLgcYSJ3COevI7/0@google.com> (raw)
In-Reply-To: <20210531103344.29325-4-drjones@redhat.com>

On Mon, May 31, 2021 at 12:33:42PM +0200, Andrew Jones wrote:
> Add a new command line option that allows the user to select a specific
> configuration, e.g. --config=sve will give the sve config. Also provide
> help text and the --help/-h options.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>

Reviewed-by: Ricardo Koller <ricarkol@google.com>

> ---
>  .../selftests/kvm/aarch64/get-reg-list.c      | 56 ++++++++++++++++++-
>  1 file changed, 53 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> index 14fc8d82e30f..03e041d97a18 100644
> --- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> +++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> @@ -539,6 +539,52 @@ static void run_test(struct vcpu_config *c)
>  	kvm_vm_free(vm);
>  }
>  
> +static void help(void)
> +{
> +	struct vcpu_config *c;
> +	int i;
> +
> +	printf(
> +	"\n"
> +	"usage: get-reg-list [--config=<selection>] [--list] [--list-filtered] [--core-reg-fixup]\n\n"
> +	" --config=<selection>        Used to select a specific vcpu configuration for the test/listing\n"
> +	"                             '<selection>' may be\n");
> +
> +	for (i = 0; i < vcpu_configs_n; ++i) {
> +		c = vcpu_configs[i];
> +		printf(
> +	"                               '%s'\n", config_name(c));
> +	}
> +
> +	printf(
> +	"\n"
> +	" --list                      Print the register list rather than test it (requires --config)\n"
> +	" --list-filtered             Print registers that would normally be filtered out (requires --config)\n"
> +	" --core-reg-fixup            Needed when running on old kernels with broken core reg listings\n"
> +	"\n"
> +	);
> +}
> +
> +static struct vcpu_config *parse_config(const char *config)
> +{
> +	struct vcpu_config *c;
> +	int i;
> +
> +	if (config[8] != '=')
> +		help(), exit(1);
> +
> +	for (i = 0; i < vcpu_configs_n; ++i) {
> +		c = vcpu_configs[i];
> +		if (strcmp(config_name(c), &config[9]) == 0)
> +			break;
> +	}
> +
> +	if (i == vcpu_configs_n)
> +		help(), exit(1);
> +
> +	return c;
> +}
> +
>  int main(int ac, char **av)
>  {
>  	struct vcpu_config *c, *sel = NULL;
> @@ -547,20 +593,24 @@ int main(int ac, char **av)
>  	for (i = 1; i < ac; ++i) {
>  		if (strcmp(av[i], "--core-reg-fixup") == 0)
>  			fixup_core_regs = true;
> +		else if (strncmp(av[i], "--config", 8) == 0)
> +			sel = parse_config(av[i]);
>  		else if (strcmp(av[i], "--list") == 0)
>  			print_list = true;
>  		else if (strcmp(av[i], "--list-filtered") == 0)
>  			print_filtered = true;
> +		else if (strcmp(av[i], "--help") == 0 || strcmp(av[1], "-h") == 0)
> +			help(), exit(0);
>  		else
> -			TEST_FAIL("Unknown option: %s\n", av[i]);
> +			help(), exit(1);
>  	}
>  
>  	if (print_list || print_filtered) {
>  		/*
>  		 * We only want to print the register list of a single config.
> -		 * TODO: Add command line support to pick which config.
>  		 */
> -		sel = vcpu_configs[0];
> +		if (!sel)
> +			help(), exit(1);
>  	}
>  
>  	for (i = 0; i < vcpu_configs_n; ++i) {
> -- 
> 2.31.1
> 

WARNING: multiple messages have this Message-ID (diff)
From: Ricardo Koller <ricarkol@google.com>
To: Andrew Jones <drjones@redhat.com>
Cc: kvm@vger.kernel.org, maz@kernel.org, pbonzini@redhat.com,
	kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH v3 3/5] KVM: arm64: selftests: get-reg-list: Provide config selection option
Date: Wed, 2 Jun 2021 17:03:45 -0700	[thread overview]
Message-ID: <YLgcYSJ3COevI7/0@google.com> (raw)
In-Reply-To: <20210531103344.29325-4-drjones@redhat.com>

On Mon, May 31, 2021 at 12:33:42PM +0200, Andrew Jones wrote:
> Add a new command line option that allows the user to select a specific
> configuration, e.g. --config=sve will give the sve config. Also provide
> help text and the --help/-h options.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>

Reviewed-by: Ricardo Koller <ricarkol@google.com>

> ---
>  .../selftests/kvm/aarch64/get-reg-list.c      | 56 ++++++++++++++++++-
>  1 file changed, 53 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> index 14fc8d82e30f..03e041d97a18 100644
> --- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> +++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> @@ -539,6 +539,52 @@ static void run_test(struct vcpu_config *c)
>  	kvm_vm_free(vm);
>  }
>  
> +static void help(void)
> +{
> +	struct vcpu_config *c;
> +	int i;
> +
> +	printf(
> +	"\n"
> +	"usage: get-reg-list [--config=<selection>] [--list] [--list-filtered] [--core-reg-fixup]\n\n"
> +	" --config=<selection>        Used to select a specific vcpu configuration for the test/listing\n"
> +	"                             '<selection>' may be\n");
> +
> +	for (i = 0; i < vcpu_configs_n; ++i) {
> +		c = vcpu_configs[i];
> +		printf(
> +	"                               '%s'\n", config_name(c));
> +	}
> +
> +	printf(
> +	"\n"
> +	" --list                      Print the register list rather than test it (requires --config)\n"
> +	" --list-filtered             Print registers that would normally be filtered out (requires --config)\n"
> +	" --core-reg-fixup            Needed when running on old kernels with broken core reg listings\n"
> +	"\n"
> +	);
> +}
> +
> +static struct vcpu_config *parse_config(const char *config)
> +{
> +	struct vcpu_config *c;
> +	int i;
> +
> +	if (config[8] != '=')
> +		help(), exit(1);
> +
> +	for (i = 0; i < vcpu_configs_n; ++i) {
> +		c = vcpu_configs[i];
> +		if (strcmp(config_name(c), &config[9]) == 0)
> +			break;
> +	}
> +
> +	if (i == vcpu_configs_n)
> +		help(), exit(1);
> +
> +	return c;
> +}
> +
>  int main(int ac, char **av)
>  {
>  	struct vcpu_config *c, *sel = NULL;
> @@ -547,20 +593,24 @@ int main(int ac, char **av)
>  	for (i = 1; i < ac; ++i) {
>  		if (strcmp(av[i], "--core-reg-fixup") == 0)
>  			fixup_core_regs = true;
> +		else if (strncmp(av[i], "--config", 8) == 0)
> +			sel = parse_config(av[i]);
>  		else if (strcmp(av[i], "--list") == 0)
>  			print_list = true;
>  		else if (strcmp(av[i], "--list-filtered") == 0)
>  			print_filtered = true;
> +		else if (strcmp(av[i], "--help") == 0 || strcmp(av[1], "-h") == 0)
> +			help(), exit(0);
>  		else
> -			TEST_FAIL("Unknown option: %s\n", av[i]);
> +			help(), exit(1);
>  	}
>  
>  	if (print_list || print_filtered) {
>  		/*
>  		 * We only want to print the register list of a single config.
> -		 * TODO: Add command line support to pick which config.
>  		 */
> -		sel = vcpu_configs[0];
> +		if (!sel)
> +			help(), exit(1);
>  	}
>  
>  	for (i = 0; i < vcpu_configs_n; ++i) {
> -- 
> 2.31.1
> 
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

  reply	other threads:[~2021-06-03  0:04 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 10:33 [PATCH v3 0/5] KVM: arm64: selftests: Fix get-reg-list Andrew Jones
2021-05-31 10:33 ` Andrew Jones
2021-05-31 10:33 ` [PATCH v3 1/5] KVM: arm64: selftests: get-reg-list: Introduce vcpu configs Andrew Jones
2021-05-31 10:33   ` Andrew Jones
2021-06-02 23:40   ` Ricardo Koller
2021-06-02 23:40     ` Ricardo Koller
2021-06-03 12:14     ` Andrew Jones
2021-06-03 12:14       ` Andrew Jones
2021-05-31 10:33 ` [PATCH v3 2/5] KVM: arm64: selftests: get-reg-list: Prepare to run multiple configs at once Andrew Jones
2021-05-31 10:33   ` Andrew Jones
2021-06-02 23:56   ` Ricardo Koller
2021-06-02 23:56     ` Ricardo Koller
2021-05-31 10:33 ` [PATCH v3 3/5] KVM: arm64: selftests: get-reg-list: Provide config selection option Andrew Jones
2021-05-31 10:33   ` Andrew Jones
2021-06-03  0:03   ` Ricardo Koller [this message]
2021-06-03  0:03     ` Ricardo Koller
2021-05-31 10:33 ` [PATCH v3 4/5] KVM: arm64: selftests: get-reg-list: Remove get-reg-list-sve Andrew Jones
2021-05-31 10:33   ` Andrew Jones
2021-06-03  0:09   ` Ricardo Koller
2021-06-03  0:09     ` Ricardo Koller
2021-05-31 10:33 ` [PATCH v3 5/5] KVM: arm64: selftests: get-reg-list: Split base and pmu registers Andrew Jones
2021-05-31 10:33   ` Andrew Jones
2021-06-02 23:26   ` Ricardo Koller
2021-06-02 23:26     ` Ricardo Koller
2021-06-22  7:07 ` [PATCH v3 0/5] KVM: arm64: selftests: Fix get-reg-list Andrew Jones
2021-06-22  7:07   ` Andrew Jones
2021-06-22  7:32   ` Marc Zyngier
2021-06-22  7:32     ` Marc Zyngier
2021-06-22  7:48     ` Andrew Jones
2021-06-22  7:48       ` Andrew Jones
2021-06-22  7:57 ` Marc Zyngier
2021-06-22  7:57   ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YLgcYSJ3COevI7/0@google.com \
    --to=ricarkol@google.com \
    --cc=alexandru.elisei@arm.com \
    --cc=drjones@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.