aboutsummaryrefslogtreecommitdiff
path: root/hw/i386
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2021-06-17 17:53:06 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2021-06-25 16:16:11 +0200
commit1e63fe685804dfadddd643bf3860b1a59702d4bf (patch)
tree8f83101a313b998195a35e2908e385dc6d3086d0 /hw/i386
parentabc2f51144242e819fd7af69d3e7c199cc9d7004 (diff)
downloadqemu-1e63fe685804dfadddd643bf3860b1a59702d4bf.zip
qemu-1e63fe685804dfadddd643bf3860b1a59702d4bf.tar.gz
qemu-1e63fe685804dfadddd643bf3860b1a59702d4bf.tar.bz2
machine: pass QAPI struct to mc->smp_parse
As part of converting -smp to a property with a QAPI type, define the struct and use it to do the actual parsing. machine_smp_parse takes care of doing the QemuOpts->QAPI conversion by hand, for now. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20210617155308.928754-10-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i386')
-rw-r--r--hw/i386/pc.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index cce275d..8e1220d 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -710,13 +710,13 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level)
* This function is very similar to smp_parse()
* in hw/core/machine.c but includes CPU die support.
*/
-static void pc_smp_parse(MachineState *ms, QemuOpts *opts, Error **errp)
+static void pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp)
{
- unsigned cpus = qemu_opt_get_number(opts, "cpus", 0);
- unsigned sockets = qemu_opt_get_number(opts, "sockets", 0);
- unsigned dies = qemu_opt_get_number(opts, "dies", 1);
- unsigned cores = qemu_opt_get_number(opts, "cores", 0);
- unsigned threads = qemu_opt_get_number(opts, "threads", 0);
+ unsigned cpus = config->has_cpus ? config->cpus : 0;
+ unsigned sockets = config->has_sockets ? config->sockets : 0;
+ unsigned dies = config->has_dies ? config->dies : 1;
+ unsigned cores = config->has_cores ? config->cores : 0;
+ unsigned threads = config->has_threads ? config->threads : 0;
/* compute missing values, prefer sockets over cores over threads */
if (cpus == 0 || sockets == 0) {
@@ -726,8 +726,7 @@ static void pc_smp_parse(MachineState *ms, QemuOpts *opts, Error **errp)
sockets = sockets > 0 ? sockets : 1;
cpus = cores * threads * dies * sockets;
} else {
- ms->smp.max_cpus =
- qemu_opt_get_number(opts, "maxcpus", cpus);
+ ms->smp.max_cpus = config->has_maxcpus ? config->maxcpus : cpus;
sockets = ms->smp.max_cpus / (cores * threads * dies);
}
} else if (cores == 0) {
@@ -745,8 +744,7 @@ static void pc_smp_parse(MachineState *ms, QemuOpts *opts, Error **errp)
return;
}
- ms->smp.max_cpus =
- qemu_opt_get_number(opts, "maxcpus", cpus);
+ ms->smp.max_cpus = config->has_maxcpus ? config->maxcpus : cpus;
if (ms->smp.max_cpus < cpus) {
error_setg(errp, "maxcpus must be equal to or greater than smp");