qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Gavin Shan <gshan@redhat.com>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, pbonzini@redhat.com,
	eduardo@habkost.net, peter.maydell@linaro.org,
	marcel.apfelbaum@gmail.com, philmd@linaro.org,
	wangyanan55@huawei.com, shan.gavin@gmail.com
Subject: Re: [PATCH 2/3] hw/arm/virt: Use generic CPU type invalidation
Date: Fri, 14 Jul 2023 13:59:30 +0200	[thread overview]
Message-ID: <20230714135930.428e7d19@imammedo.users.ipa.redhat.com> (raw)
In-Reply-To: <20230713054502.410911-3-gshan@redhat.com>

On Thu, 13 Jul 2023 15:45:01 +1000
Gavin Shan <gshan@redhat.com> wrote:

> There is a generic CPU type invalidation in machine_run_board_init()
                              ^^^^^
using that throughout the series is confusing to me.
Perhaps use original phrase 'valid cpu types' with appropriate rephrasing
would be better 

> and we needn't a same and private invalidation. Set mc->valid_cpu_types
> to use the generic CPU type invalidation.

I's suggest to replace commit message/subj with something like

arm/virt specific cpu_type_valid() is duplicate of ...
drop it and use ...

> No functional change intended.



> 
> Signed-off-by: Gavin Shan <gshan@redhat.com>
> ---
>  hw/arm/virt.c | 21 +++------------------
>  1 file changed, 3 insertions(+), 18 deletions(-)
> 
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 7d9dbc2663..43d7772ffd 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -203,7 +203,7 @@ static const int a15irqmap[] = {
>      [VIRT_PLATFORM_BUS] = 112, /* ...to 112 + PLATFORM_BUS_NUM_IRQS -1 */
>  };
>  
> -static const char *valid_cpus[] = {
> +static const char *valid_cpu_types[] = {
>  #ifdef CONFIG_TCG
>      ARM_CPU_TYPE_NAME("cortex-a7"),
>      ARM_CPU_TYPE_NAME("cortex-a15"),
> @@ -219,20 +219,9 @@ static const char *valid_cpus[] = {
>      ARM_CPU_TYPE_NAME("cortex-a57"),
>      ARM_CPU_TYPE_NAME("host"),
>      ARM_CPU_TYPE_NAME("max"),
> +    NULL
>  };
>  
> -static bool cpu_type_valid(const char *cpu)
> -{
> -    int i;
> -
> -    for (i = 0; i < ARRAY_SIZE(valid_cpus); i++) {
> -        if (strcmp(cpu, valid_cpus[i]) == 0) {
> -            return true;
> -        }
> -    }
> -    return false;
> -}
> -
>  static void create_randomness(MachineState *ms, const char *node)
>  {
>      struct {
> @@ -2030,11 +2019,6 @@ static void machvirt_init(MachineState *machine)
>      unsigned int smp_cpus = machine->smp.cpus;
>      unsigned int max_cpus = machine->smp.max_cpus;
>  
> -    if (!cpu_type_valid(machine->cpu_type)) {
> -        error_report("mach-virt: CPU type %s not supported", machine->cpu_type);
> -        exit(1);
> -    }
> -
>      possible_cpus = mc->possible_cpu_arch_ids(machine);
>  
>      /*
> @@ -2953,6 +2937,7 @@ static void virt_machine_class_init(ObjectClass *oc, void *data)
>  #else
>      mc->default_cpu_type = ARM_CPU_TYPE_NAME("max");
>  #endif
> +    mc->valid_cpu_types = valid_cpu_types;
>      mc->get_default_cpu_node_id = virt_get_default_cpu_node_id;
>      mc->kvm_type = virt_kvm_type;
>      assert(!mc->get_hotplug_handler);



  reply	other threads:[~2023-07-14 12:00 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13  5:44 [PATCH 0/3] hw/arm/virt: Use generic CPU invalidation Gavin Shan
2023-07-13  5:45 ` [PATCH 1/3] machine: Factor CPU type invalidation out into helper Gavin Shan
2023-07-14 12:07   ` Igor Mammedov
2023-07-18  6:11     ` Gavin Shan
2023-07-24 14:39       ` Igor Mammedov
2023-07-13  5:45 ` [PATCH 2/3] hw/arm/virt: Use generic CPU type invalidation Gavin Shan
2023-07-14 11:59   ` Igor Mammedov [this message]
2023-07-18  6:17     ` Gavin Shan
2023-07-13  5:45 ` [PATCH 3/3] hw/arm/virt: Support host CPU type only when KVM or HVF is configured Gavin Shan
2023-07-13 12:46   ` Cornelia Huck
2023-07-13 13:16     ` Gavin Shan
2023-07-13 11:44 ` [PATCH 0/3] hw/arm/virt: Use generic CPU invalidation Peter Maydell
2023-07-13 11:52   ` Marcin Juszkiewicz
2023-07-13 11:59     ` Peter Maydell
2023-07-14 11:50       ` Igor Mammedov
2023-07-14 12:56         ` Peter Maydell
2023-07-17 12:44           ` Igor Mammedov
2023-07-18 10:31             ` Gavin Shan
2023-07-24 15:06               ` Igor Mammedov
2023-07-24 15:14                 ` Peter Maydell
2023-07-25  6:46                   ` Igor Mammedov
2023-07-13 12:34     ` Gavin Shan
2023-07-13 12:44       ` Marcin Juszkiewicz
2023-07-13 13:00         ` Gavin Shan
2023-07-13 16:29       ` Philippe Mathieu-Daudé
2023-07-14  0:51         ` Gavin Shan
2023-07-14  9:14           ` Gavin Shan
2023-07-13 19:27       ` Richard Henderson
2023-07-14  0:54         ` Gavin Shan
2023-07-13 12:42   ` Gavin Shan

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=20230714135930.428e7d19@imammedo.users.ipa.redhat.com \
    --to=imammedo@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=gshan@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=shan.gavin@gmail.com \
    --cc=wangyanan55@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).