@@ -749,6 +749,7 @@ static void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp)
unsigned sockets = config->has_sockets ? config->sockets : 0;
unsigned cores = config->has_cores ? config->cores : 0;
unsigned threads = config->has_threads ? config->threads : 0;
+ unsigned mirror_vcpus = config->has_mirrorvcpus ? config->mirrorvcpus : 0;
if (config->has_dies && config->dies != 0 && config->dies != 1) {
error_setg(errp, "dies not supported by this machine's CPU topology");
@@ -787,6 +788,11 @@ static void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp)
return;
}
+ if (mirror_vcpus > ms->smp.max_cpus) {
+ error_setg(errp, "mirror vcpus must be less than max cpus");
+ return;
+ }
+
if (sockets * cores * threads != ms->smp.max_cpus) {
error_setg(errp, "Invalid CPU topology: "
"sockets (%u) * cores (%u) * threads (%u) "
@@ -800,6 +806,7 @@ static void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp)
ms->smp.cores = cores;
ms->smp.threads = threads;
ms->smp.sockets = sockets;
+ ms->smp.mirror_vcpus = mirror_vcpus;
}
static void machine_get_smp(Object *obj, Visitor *v, const char *name,
@@ -719,6 +719,7 @@ static void pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error **err
unsigned dies = config->has_dies ? config->dies : 1;
unsigned cores = config->has_cores ? config->cores : 0;
unsigned threads = config->has_threads ? config->threads : 0;
+ unsigned mirror_vcpus = config->has_mirrorvcpus ? config->mirrorvcpus : 0;
/* compute missing values, prefer sockets over cores over threads */
if (cpus == 0 || sockets == 0) {
@@ -753,6 +754,11 @@ static void pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error **err
return;
}
+ if (mirror_vcpus > ms->smp.max_cpus) {
+ error_setg(errp, "mirror vcpus must be less than max cpus");
+ return;
+ }
+
if (sockets * dies * cores * threads != ms->smp.max_cpus) {
error_setg(errp, "Invalid CPU topology deprecated: "
"sockets (%u) * dies (%u) * cores (%u) * threads (%u) "
@@ -767,6 +773,7 @@ static void pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error **err
ms->smp.threads = threads;
ms->smp.sockets = sockets;
ms->smp.dies = dies;
+ ms->smp.mirror_vcpus = mirror_vcpus;
}
static
@@ -286,6 +286,7 @@ typedef struct CpuTopology {
unsigned int threads;
unsigned int sockets;
unsigned int max_cpus;
+ unsigned int mirror_vcpus;
} CpuTopology;
/**
@@ -1303,6 +1303,8 @@
#
# @maxcpus: maximum number of hotpluggable virtual CPUs in the virtual machine
#
+# @mirrorvcpus: maximum number of mirror virtual CPUs in the virtual machine
+#
# Since: 6.1
##
{ 'struct': 'SMPConfiguration', 'data': {
@@ -1311,4 +1313,5 @@
'*dies': 'int',
'*cores': 'int',
'*threads': 'int',
- '*maxcpus': 'int' } }
+ '*maxcpus': 'int',
+ '*mirrorvcpus': 'int' } }
@@ -710,6 +710,9 @@ static QemuOptsList qemu_smp_opts = {
}, {
.name = "maxcpus",
.type = QEMU_OPT_NUMBER,
+ }, {
+ .name = "mirrorvcpus",
+ .type = QEMU_OPT_NUMBER,
},
{ /*End of list */ }
},