diff mbox series

[04/22] machine: move SMP initialization from vl.c

Message ID 20201021205716.2359430-5-pbonzini@redhat.com
State Accepted
Commit 8b0e484c8bf82e07bb0439bff04e248c63cdc86a
Headers show
Series cleanup qemu_init and make sense of command line processing | expand

Commit Message

Paolo Bonzini Oct. 21, 2020, 8:56 p.m. UTC
Initialize the object's values from the class when the object is
created, no need to have vl.c do it for us.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/machine.c | 7 +++++++
 softmmu/vl.c      | 7 -------
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Philippe Mathieu-Daudé Oct. 22, 2020, 7:16 a.m. UTC | #1
On 10/21/20 10:56 PM, Paolo Bonzini wrote:
> Initialize the object's values from the class when the object is
> created, no need to have vl.c do it for us.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/core/machine.c | 7 +++++++
>   softmmu/vl.c      | 7 -------
>   2 files changed, 7 insertions(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/hw/core/machine.c b/hw/core/machine.c
index d3a8450b1f..7efeac03b3 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -908,6 +908,13 @@  static void machine_initfn(Object *obj)
     /* Register notifier when init is done for sysbus sanity checks */
     ms->sysbus_notifier.notify = machine_init_notify;
     qemu_add_machine_init_done_notifier(&ms->sysbus_notifier);
+
+    /* default to mc->default_cpus */
+    ms->smp.cpus = mc->default_cpus;
+    ms->smp.max_cpus = mc->default_cpus;
+    ms->smp.cores = 1;
+    ms->smp.threads = 1;
+    ms->smp.sockets = 1;
 }
 
 static void machine_finalize(Object *obj)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 75bc686397..05422a15ee 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -3966,13 +3966,6 @@  void qemu_init(int argc, char **argv, char **envp)
         exit(0);
     }
 
-    /* default to machine_class->default_cpus */
-    current_machine->smp.cpus = machine_class->default_cpus;
-    current_machine->smp.max_cpus = machine_class->default_cpus;
-    current_machine->smp.cores = 1;
-    current_machine->smp.threads = 1;
-    current_machine->smp.sockets = 1;
-
     machine_class->smp_parse(current_machine,
         qemu_opts_find(qemu_find_opts("smp-opts"), NULL));