diff options
author | Paolo Bonzini | 2020-10-21 13:23:49 +0200 |
---|---|---|
committer | Paolo Bonzini | 2020-10-26 12:08:40 +0100 |
commit | 2c920e4577b29702c0c01b0d491903c159df894a (patch) | |
tree | 034e0d069c332bda5d988651a3bc5c047cd113a5 /hw | |
parent | machine: remove deprecated -machine enforce-config-section option (diff) | |
download | qemu-2c920e4577b29702c0c01b0d491903c159df894a.tar.gz qemu-2c920e4577b29702c0c01b0d491903c159df894a.tar.xz qemu-2c920e4577b29702c0c01b0d491903c159df894a.zip |
machine: move UP defaults to class_base_init
Clean up vl.c, default min/max/default_cpus to uniprocessor
directly in the QOM class initialization code.
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/core/machine.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c index 7a0b263cda..57463ad77a 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -853,8 +853,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, |