From: Daniel P. Berrangé Date: Fri, 5 Feb 2021 18:21:14 +0000 (+0000) Subject: qemu: probe for "-cpu max" support X-Git-Tag: v7.1.0-rc1~200 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c89cc5d6ff60122e15c086c92e93aeb5180cb6e;p=thirdparty%2Flibvirt.git 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 Signed-off-by: Daniel P. Berrangé --- diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index fb302c8e0c..a61a2616c7 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -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; } diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 8cb5673042..79d443adfb 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -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;