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>
This commit is contained in:
parent
9f2931bc65
commit
2c920e4577
@ -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,
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user