qemu: probe for "-cpu max" support

This is a special CPU model similar to "-cpu host", so won't use our
normal CPU model detection logic.

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2021-02-05 18:21:14 +00:00
parent 7c1653f63a
commit 9c89cc5d6f
2 changed files with 13 additions and 0 deletions

View File

@ -614,6 +614,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
/* 390 */
"vhost-user-blk",
"cpu-max",
);
@ -2984,12 +2985,23 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
virQEMUCapsAccelPtr accel,
qemuMonitorPtr mon)
{
qemuMonitorCPUDefsPtr defs;
size_t i;
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_DEFINITIONS))
return 0;
if (virQEMUCapsFetchCPUDefinitions(mon, qemuCaps->arch, &accel->cpuModels) < 0)
return -1;
defs = accel->cpuModels;
for (i = 0; i < defs->ncpus; i++) {
if (STREQ_NULLABLE(defs->cpus[i].name, "max")) {
virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_MAX);
break;
}
}
return 0;
}

View File

@ -594,6 +594,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
/* 390 */
QEMU_CAPS_DEVICE_VHOST_USER_BLK, /* -device vhost-user-blk */
QEMU_CAPS_CPU_MAX, /* -cpu max */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;