qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/22] machine: move UP defaults to class_base_init


From: Thomas Huth
Subject: Re: [PATCH 03/22] machine: move UP defaults to class_base_init
Date: Thu, 22 Oct 2020 07:11:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 21/10/2020 22.56, Paolo Bonzini wrote:
> Clean up vl.c, default min/max/default_cpus to uniprocessor
> directly in the QOM class initialization code.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/core/machine.c | 6 +++++-
>  softmmu/vl.c      | 5 -----
>  2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index 80a918895a..d3a8450b1f 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -854,8 +854,12 @@ static void machine_class_init(ObjectClass *oc, void 
> *data)
>  
>  static void machine_class_base_init(ObjectClass *oc, void *data)
>  {
> +    MachineClass *mc = MACHINE_CLASS(oc);
> +    mc->max_cpus = mc->max_cpus ?: 1;
> +    mc->min_cpus = mc->min_cpus ?: 1;
> +    mc->default_cpus = mc->default_cpus ?: 1;
> +
>      if (!object_class_is_abstract(oc)) {
> -        MachineClass *mc = MACHINE_CLASS(oc);
>          const char *cname = object_class_get_name(oc);
>          assert(g_str_has_suffix(cname, TYPE_MACHINE_SUFFIX));
>          mc->name = g_strndup(cname,
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index 42314e6ff9..75bc686397 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -3966,11 +3966,6 @@ void qemu_init(int argc, char **argv, char **envp)
>          exit(0);
>      }
>  
> -    /* machine_class: default to UP */
> -    machine_class->max_cpus = machine_class->max_cpus ?: 1;
> -    machine_class->min_cpus = machine_class->min_cpus ?: 1;
> -    machine_class->default_cpus = machine_class->default_cpus ?: 1;
> -
>      /* default to machine_class->default_cpus */
>      current_machine->smp.cpus = machine_class->default_cpus;
>      current_machine->smp.max_cpus = machine_class->default_cpus;
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]