[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/17] machine: move UP defaults to class_base_init
From: |
Paolo Bonzini |
Subject: |
[PULL 16/17] machine: move UP defaults to class_base_init |
Date: |
Mon, 26 Oct 2020 09:51:30 -0400 |
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>
---
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 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,
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 09b033ff73..9b67ea300e 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -3970,11 +3970,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;
--
2.26.2
- [PULL 07/17] Remove deprecated -no-kvm option, (continued)
- [PULL 07/17] Remove deprecated -no-kvm option, Paolo Bonzini, 2020/10/26
- [PULL 06/17] replay: do not build if TCG is not available, Paolo Bonzini, 2020/10/26
- [PULL 17/17] machine: move SMP initialization from vl.c, Paolo Bonzini, 2020/10/26
- [PULL 12/17] configure: move install_blobs from configure to meson, Paolo Bonzini, 2020/10/26
- [PULL 15/17] machine: remove deprecated -machine enforce-config-section option, Paolo Bonzini, 2020/10/26
- [PULL 13/17] WHPX: Fix WHPX build break, Paolo Bonzini, 2020/10/26
- [PULL 11/17] configure: remove unused variable from config-host.mak, Paolo Bonzini, 2020/10/26
- [PULL 01/17] build: fix macOS --enable-modules build, Paolo Bonzini, 2020/10/26
- [PULL 14/17] win32: boot broken when bind & data dir are the same, Paolo Bonzini, 2020/10/26
- [PULL 09/17] configure: allow configuring localedir, Paolo Bonzini, 2020/10/26
- [PULL 16/17] machine: move UP defaults to class_base_init,
Paolo Bonzini <=
- [PULL 10/17] configure: move directory options from config-host.mak to meson, Paolo Bonzini, 2020/10/26
- Re: [PULL 00/17] Build system changes and misc fixes for QEMU 5.2 soft freeze, Peter Maydell, 2020/10/26