Querying "host" CPU model expansion only makes sense for KVM. QEMU 2.9.0
introduces a new "max" CPU model which can be used to ask QEMU what the
best CPU it can provide to a TCG domain is.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
Version 3:
- s/type/virtType/ in virQEMUCapsLoadHostCPUModelInfo as type variable
was added in the previous patch
Version 2:
- no change
src/qemu/qemu_capabilities.c | 151 ++++++++++++-----
src/qemu/qemu_capabilities.h | 3 +-
src/qemu/qemu_capspriv.h | 3 +-
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_process.c | 5 +-
.../qemucapabilitiesdata/caps_2.8.0.s390x.replies | 8 +
tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 2 +-
.../qemucapabilitiesdata/caps_2.9.0.x86_64.replies | 179 +++++++++++++++++++++
tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 172 +++++++++++++++++++-
tests/qemuxml2argvtest.c | 3 +-
10 files changed, 480 insertions(+), 48 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 0b611c323..f31a9ce6e 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -401,13 +401,15 @@ struct _virQEMUCaps {
size_t ngicCapabilities;
virGICCapability *gicCapabilities;
- qemuMonitorCPUModelInfoPtr hostCPUModelInfo;
+ qemuMonitorCPUModelInfoPtr kvmCPUModelInfo;
+ qemuMonitorCPUModelInfoPtr tcgCPUModelInfo;
/* Anything below is not stored in the cache since the values are
* re-computed from the other fields or external data sources every
* time we probe QEMU or load the results from the cache.
*/
- virCPUDefPtr hostCPUModel;
+ virCPUDefPtr kvmCPUModel;
+ virCPUDefPtr tcgCPUModel;
};
struct virQEMUCapsSearchData {
@@ -2164,12 +2166,20 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps)
goto error;
}
- if (qemuCaps->hostCPUModel &&
- !(ret->hostCPUModel = virCPUDefCopy(qemuCaps->hostCPUModel)))
+ if (qemuCaps->kvmCPUModel &&
+ !(ret->kvmCPUModel = virCPUDefCopy(qemuCaps->kvmCPUModel)))
goto error;
- if (qemuCaps->hostCPUModelInfo &&
- !(ret->hostCPUModelInfo =
qemuMonitorCPUModelInfoCopy(qemuCaps->hostCPUModelInfo)))
+ if (qemuCaps->tcgCPUModel &&
+ !(ret->tcgCPUModel = virCPUDefCopy(qemuCaps->tcgCPUModel)))
+ goto error;
+
+ if (qemuCaps->kvmCPUModelInfo &&
+ !(ret->kvmCPUModelInfo =
qemuMonitorCPUModelInfoCopy(qemuCaps->kvmCPUModelInfo)))
+ goto error;
+
+ if (qemuCaps->tcgCPUModelInfo &&
+ !(ret->tcgCPUModelInfo =
qemuMonitorCPUModelInfoCopy(qemuCaps->tcgCPUModelInfo)))
goto error;
if (VIR_ALLOC_N(ret->machineTypes, qemuCaps->nmachineTypes) < 0)
@@ -2218,8 +2228,10 @@ void virQEMUCapsDispose(void *obj)
VIR_FREE(qemuCaps->gicCapabilities);
- qemuMonitorCPUModelInfoFree(qemuCaps->hostCPUModelInfo);
- virCPUDefFree(qemuCaps->hostCPUModel);
+ qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo);
+ qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo);
+ virCPUDefFree(qemuCaps->kvmCPUModel);
+ virCPUDefFree(qemuCaps->tcgCPUModel);
}
void
@@ -2436,9 +2448,13 @@ virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
virCPUDefPtr
-virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps)
+virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps,
+ virDomainVirtType type)
{
- return qemuCaps->hostCPUModel;
+ if (type == VIR_DOMAIN_VIRT_KVM)
+ return qemuCaps->kvmCPUModel;
+ else
+ return qemuCaps->tcgCPUModel;
}
@@ -2456,7 +2472,7 @@ virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps,
virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch);
case VIR_CPU_MODE_HOST_MODEL:
- return !!qemuCaps->hostCPUModel;
+ return !!virQEMUCapsGetHostModel(qemuCaps, type);
case VIR_CPU_MODE_CUSTOM:
if (type == VIR_DOMAIN_VIRT_KVM)
@@ -2823,14 +2839,24 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
static int
virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps,
- qemuMonitorPtr mon)
+ qemuMonitorPtr mon,
+ bool tcg)
{
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION) ||
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
+ qemuMonitorCPUModelInfoPtr *modelInfo;
+ const char *model;
+
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION))
return 0;
- return qemuMonitorGetCPUModelExpansion(mon, "static", "host",
- &qemuCaps->hostCPUModelInfo);
+ if (tcg || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
+ modelInfo = &qemuCaps->tcgCPUModelInfo;
+ model = "max";
+ } else {
+ modelInfo = &qemuCaps->kvmCPUModelInfo;
+ model = "host";
+ }
+
+ return qemuMonitorGetCPUModelExpansion(mon, "static", model, modelInfo);
}
struct tpmTypeToCaps {
@@ -3055,12 +3081,16 @@ virQEMUCapsCPUFilterFeatures(const char *name,
*/
static int
virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps,
+ virDomainVirtType type,
virCPUDefPtr cpu)
{
- qemuMonitorCPUModelInfoPtr modelInfo = qemuCaps->hostCPUModelInfo;
+ qemuMonitorCPUModelInfoPtr modelInfo;
size_t i;
- if (!modelInfo) {
+ if (type != VIR_DOMAIN_VIRT_KVM)
+ return -1;
+
+ if (!(modelInfo = qemuCaps->kvmCPUModelInfo)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("missing host CPU model info from QEMU capabilities "
"for binary %s"),
@@ -3100,12 +3130,13 @@ virQEMUCapsInitCPUModelS390(virQEMUCapsPtr qemuCaps,
*/
static int
virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
+ virDomainVirtType type,
virCPUDefPtr cpu)
{
int ret = 1;
if (ARCH_IS_S390(qemuCaps->arch))
- ret = virQEMUCapsInitCPUModelS390(qemuCaps, cpu);
+ ret = virQEMUCapsInitCPUModelS390(qemuCaps, type, cpu);
if (ret == 0)
cpu->fallback = VIR_CPU_FALLBACK_FORBID;
@@ -3116,7 +3147,8 @@ virQEMUCapsInitCPUModel(virQEMUCapsPtr qemuCaps,
void
virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
- virCapsPtr caps)
+ virCapsPtr caps,
+ virDomainVirtType type)
{
virCPUDefPtr cpu = NULL;
int rc;
@@ -3132,7 +3164,7 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
cpu->match = VIR_CPU_MATCH_EXACT;
cpu->fallback = VIR_CPU_FALLBACK_ALLOW;
- if ((rc = virQEMUCapsInitCPUModel(qemuCaps, cpu)) < 0) {
+ if ((rc = virQEMUCapsInitCPUModel(qemuCaps, type, cpu)) < 0) {
goto error;
} else if (rc == 1) {
VIR_DEBUG("No host CPU model info from QEMU; using host
capabilities");
@@ -3145,7 +3177,11 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
goto error;
}
- qemuCaps->hostCPUModel = cpu;
+ if (type == VIR_DOMAIN_VIRT_KVM)
+ qemuCaps->kvmCPUModel = cpu;
+ else
+ qemuCaps->tcgCPUModel = cpu;
+
return;
error:
@@ -3156,7 +3192,8 @@ virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
static int
virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
- xmlXPathContextPtr ctxt)
+ xmlXPathContextPtr ctxt,
+ virDomainVirtType virtType)
{
char *str = NULL;
xmlNodePtr hostCPUNode;
@@ -3167,7 +3204,12 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
size_t i;
int n;
- if (!(hostCPUNode = virXPathNode("./hostCPU", ctxt))) {
+ if (virtType == VIR_DOMAIN_VIRT_KVM)
+ hostCPUNode = virXPathNode("./hostCPU[@type='kvm']", ctxt);
+ else
+ hostCPUNode = virXPathNode("./hostCPU[@type='tcg']", ctxt);
+
+ if (!hostCPUNode) {
ret = 0;
goto cleanup;
}
@@ -3247,7 +3289,10 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
}
}
- qemuCaps->hostCPUModelInfo = hostCPU;
+ if (virtType == VIR_DOMAIN_VIRT_KVM)
+ qemuCaps->kvmCPUModelInfo = hostCPU;
+ else
+ qemuCaps->tcgCPUModelInfo = hostCPU;
hostCPU = NULL;
ret = 0;
@@ -3454,7 +3499,8 @@ virQEMUCapsLoadCache(virCapsPtr caps,
}
VIR_FREE(str);
- if (virQEMUCapsLoadHostCPUModelInfo(qemuCaps, ctxt) < 0)
+ if (virQEMUCapsLoadHostCPUModelInfo(qemuCaps, ctxt, VIR_DOMAIN_VIRT_KVM) < 0 ||
+ virQEMUCapsLoadHostCPUModelInfo(qemuCaps, ctxt, VIR_DOMAIN_VIRT_QEMU) < 0)
goto cleanup;
if (virQEMUCapsLoadCPUModels(qemuCaps, ctxt, VIR_DOMAIN_VIRT_KVM) < 0 ||
@@ -3562,7 +3608,8 @@ virQEMUCapsLoadCache(virCapsPtr caps,
}
VIR_FREE(nodes);
- virQEMUCapsInitHostCPUModel(qemuCaps, caps);
+ virQEMUCapsInitHostCPUModel(qemuCaps, caps, VIR_DOMAIN_VIRT_KVM);
+ virQEMUCapsInitHostCPUModel(qemuCaps, caps, VIR_DOMAIN_VIRT_QEMU);
ret = 0;
cleanup:
@@ -3576,12 +3623,26 @@ virQEMUCapsLoadCache(virCapsPtr caps,
static void
virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
- virBufferPtr buf)
+ virBufferPtr buf,
+ virDomainVirtType type)
{
- qemuMonitorCPUModelInfoPtr model = qemuCaps->hostCPUModelInfo;
+ qemuMonitorCPUModelInfoPtr model;
+ const char *typeStr;
size_t i;
- virBufferAsprintf(buf, "<hostCPU model='%s'>\n",
model->name);
+ if (type == VIR_DOMAIN_VIRT_KVM) {
+ typeStr = "kvm";
+ model = qemuCaps->kvmCPUModelInfo;
+ } else {
+ typeStr = "tcg";
+ model = qemuCaps->tcgCPUModelInfo;
+ }
+
+ if (!model)
+ return;
+
+ virBufferAsprintf(buf, "<hostCPU type='%s'
model='%s'>\n",
+ typeStr, model->name);
virBufferAdjustIndent(buf, 2);
for (i = 0; i < model->nprops; i++) {
@@ -3692,8 +3753,8 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps,
virBufferAsprintf(&buf, "<arch>%s</arch>\n",
virArchToString(qemuCaps->arch));
- if (qemuCaps->hostCPUModelInfo)
- virQEMUCapsFormatHostCPUModelInfo(qemuCaps, &buf);
+ virQEMUCapsFormatHostCPUModelInfo(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM);
+ virQEMUCapsFormatHostCPUModelInfo(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU);
virQEMUCapsFormatCPUModels(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM);
virQEMUCapsFormatCPUModels(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU);
@@ -3828,11 +3889,15 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps)
VIR_FREE(qemuCaps->gicCapabilities);
qemuCaps->ngicCapabilities = 0;
- qemuMonitorCPUModelInfoFree(qemuCaps->hostCPUModelInfo);
- qemuCaps->hostCPUModelInfo = NULL;
+ qemuMonitorCPUModelInfoFree(qemuCaps->kvmCPUModelInfo);
+ qemuMonitorCPUModelInfoFree(qemuCaps->tcgCPUModelInfo);
+ qemuCaps->kvmCPUModelInfo = NULL;
+ qemuCaps->tcgCPUModelInfo = NULL;
- virCPUDefFree(qemuCaps->hostCPUModel);
- qemuCaps->hostCPUModel = NULL;
+ virCPUDefFree(qemuCaps->kvmCPUModel);
+ virCPUDefFree(qemuCaps->tcgCPUModel);
+ qemuCaps->kvmCPUModel = NULL;
+ qemuCaps->tcgCPUModel = NULL;
}
@@ -4390,7 +4455,7 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_QMP_SCHEMA) &&
virQEMUCapsProbeQMPSchemaCapabilities(qemuCaps, mon) < 0)
goto cleanup;
- if (virQEMUCapsProbeQMPHostCPU(qemuCaps, mon) < 0)
+ if (virQEMUCapsProbeQMPHostCPU(qemuCaps, mon, false) < 0)
goto cleanup;
/* 'intel-iommu' shows up as a device since 2.2.0, but can
@@ -4432,6 +4497,9 @@ virQEMUCapsInitQMPMonitorTCG(virQEMUCapsPtr qemuCaps
ATTRIBUTE_UNUSED,
if (virQEMUCapsProbeQMPCPUDefinitions(qemuCaps, mon, true) < 0)
goto cleanup;
+ if (virQEMUCapsProbeQMPHostCPU(qemuCaps, mon, true) < 0)
+ goto cleanup;
+
ret = 0;
cleanup:
return ret;
@@ -4776,7 +4844,8 @@ virQEMUCapsNewForBinaryInternal(virCapsPtr caps,
virQEMUCapsRememberCached(qemuCaps, cacheDir) < 0)
goto error;
- virQEMUCapsInitHostCPUModel(qemuCaps, caps);
+ virQEMUCapsInitHostCPUModel(qemuCaps, caps, VIR_DOMAIN_VIRT_KVM);
+ virQEMUCapsInitHostCPUModel(qemuCaps, caps, VIR_DOMAIN_VIRT_QEMU);
}
cleanup:
@@ -5222,8 +5291,10 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps,
domCaps->cpu.hostPassthrough = true;
if (virQEMUCapsIsCPUModeSupported(qemuCaps, caps, domCaps->virttype,
- VIR_CPU_MODE_HOST_MODEL))
- domCaps->cpu.hostModel = virCPUDefCopy(qemuCaps->hostCPUModel);
+ VIR_CPU_MODE_HOST_MODEL)) {
+ virCPUDefPtr cpu = virQEMUCapsGetHostModel(qemuCaps, domCaps->virttype);
+ domCaps->cpu.hostModel = virCPUDefCopy(cpu);
+ }
if (virQEMUCapsIsCPUModeSupported(qemuCaps, caps, domCaps->virttype,
VIR_CPU_MODE_CUSTOM)) {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 0f998c473..eba06aa6d 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -442,7 +442,8 @@ int virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCaps,
virDomainVirtType type,
char ***names,
size_t *count);
-virCPUDefPtr virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps);
+virCPUDefPtr virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps,
+ virDomainVirtType type);
bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps,
virCapsPtr caps,
virDomainVirtType type,
diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h
index 38b971e0e..75499d462 100644
--- a/src/qemu/qemu_capspriv.h
+++ b/src/qemu/qemu_capspriv.h
@@ -71,5 +71,6 @@ virQEMUCapsSetArch(virQEMUCapsPtr qemuCaps,
void
virQEMUCapsInitHostCPUModel(virQEMUCapsPtr qemuCaps,
- virCapsPtr caps);
+ virCapsPtr caps,
+ virDomainVirtType type);
#endif
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d5da533e5..cf2184969 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6665,7 +6665,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
if (def->cpu->mode == VIR_CPU_MODE_CUSTOM)
cpuDef = def->cpu;
else if (def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH)
- cpuDef = virQEMUCapsGetHostModel(qemuCaps);
+ cpuDef = virQEMUCapsGetHostModel(qemuCaps, def->virtType);
if (cpuDef) {
int svm = virCPUCheckFeature(def->os.arch, cpuDef, "svm");
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ea10fff45..1d7128037 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5177,13 +5177,14 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def,
/* custom CPUs in TCG mode don't need to be compared to host CPU */
if (def->virtType != VIR_DOMAIN_VIRT_QEMU ||
def->cpu->mode != VIR_CPU_MODE_CUSTOM) {
- if (virCPUCompare(caps->host.arch, virQEMUCapsGetHostModel(qemuCaps),
+ if (virCPUCompare(caps->host.arch,
+ virQEMUCapsGetHostModel(qemuCaps, def->virtType),
def->cpu, true) < 0)
return -1;
}
if (virCPUUpdate(def->os.arch, def->cpu,
- virQEMUCapsGetHostModel(qemuCaps)) < 0)
+ virQEMUCapsGetHostModel(qemuCaps, def->virtType)) < 0)
goto cleanup;
if (virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType,
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.replies
b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.replies
index 0405d5d7b..c3cbeee0a 100644
--- a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.replies
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.replies
@@ -13378,3 +13378,11 @@
],
"id": "libvirt-2"
}
+
+{
+ "id": "libvirt-3",
+ "error": {
+ "class": "GenericError",
+ "desc": "The CPU definition 'max' is unknown."
+ }
+}
diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
index 84c570020..d179a8413 100644
--- a/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml
@@ -133,7 +133,7 @@
<kvmVersion>0</kvmVersion>
<package></package>
<arch>s390x</arch>
- <hostCPU model='zEC12.2-base'>
+ <hostCPU type='kvm' model='zEC12.2-base'>
<property name='aefsi' type='boolean' value='true'/>
<property name='msa5' type='boolean' value='true'/>
<property name='msa4' type='boolean' value='true'/>
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.replies
b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.replies
index c000f8cf9..6cf1cdd3e 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.replies
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.replies
@@ -14889,3 +14889,182 @@
],
"id": "libvirt-2"
}
+
+{
+ "return": {
+ "model": {
+ "name": "base",
+ "props": {
+ "cmov": true,
+ "ia64": false,
+ "aes": true,
+ "mmx": true,
+ "rdpid": false,
+ "arat": true,
+ "pause-filter": false,
+ "xsavec": false,
+ "osxsave": false,
+ "kvm-asyncpf": false,
+ "perfctr-core": false,
+ "mpx": true,
+ "pbe": false,
+ "avx512cd": false,
+ "decodeassists": false,
+ "sse4.1": true,
+ "family": 6,
+ "avx512f": false,
+ "msr": true,
+ "mce": true,
+ "mca": true,
+ "xcrypt": false,
+ "min-level": 13,
+ "xgetbv1": true,
+ "cid": false,
+ "ds": false,
+ "fxsr": true,
+ "xsaveopt": true,
+ "xtpr": false,
+ "avx512vl": false,
+ "avx512-vpopcntdq": false,
+ "phe": false,
+ "extapic": false,
+ "3dnowprefetch": false,
+ "cr8legacy": true,
+ "xcrypt-en": false,
+ "pn": false,
+ "dca": false,
+ "vendor": "AuthenticAMD",
+ "pku": true,
+ "smx": false,
+ "cmp-legacy": false,
+ "avx512-4fmaps": false,
+ "vmcb-clean": false,
+ "hle": false,
+ "3dnowext": true,
+ "npt": false,
+ "clwb": true,
+ "lbrv": false,
+ "adx": true,
+ "ss": true,
+ "pni": true,
+ "svm-lock": false,
+ "smep": true,
+ "smap": true,
+ "pfthreshold": false,
+ "x2apic": false,
+ "avx512vbmi": false,
+ "flushbyasid": false,
+ "f16c": false,
+ "ace2-en": false,
+ "pae": true,
+ "pat": true,
+ "sse": true,
+ "phe-en": false,
+ "kvm-nopiodelay": false,
+ "tm": false,
+ "kvmclock-stable-bit": false,
+ "hypervisor": true,
+ "pcommit": true,
+ "syscall": true,
+ "avx512dq": false,
+ "svm": true,
+ "invtsc": false,
+ "sse2": true,
+ "est": false,
+ "avx512ifma": false,
+ "tm2": false,
+ "kvm-pv-eoi": false,
+ "cx8": true,
+ "kvm-mmu": false,
+ "sse4.2": true,
+ "pge": true,
+ "pdcm": false,
+ "model": 6,
+ "movbe": true,
+ "nrip-save": false,
+ "ssse3": true,
+ "sse4a": true,
+ "invpcid": false,
+ "pdpe1gb": true,
+ "tsc-deadline": false,
+ "fma": false,
+ "cx16": true,
+ "de": true,
+ "stepping": 3,
+ "xsave": true,
+ "clflush": true,
+ "skinit": false,
+ "tsc": true,
+ "tce": false,
+ "fpu": true,
+ "ds-cpl": false,
+ "ibs": false,
+ "fma4": false,
+ "la57": true,
+ "osvw": false,
+ "apic": true,
+ "pmm": false,
+ "tsc-adjust": false,
+ "kvm-steal-time": false,
+ "kvmclock": false,
+ "lwp": false,
+ "xop": false,
+ "avx": false,
+ "ospke": true,
+ "acpi": true,
+ "avx512bw": false,
+ "ace2": false,
+ "fsgsbase": true,
+ "ht": false,
+ "nx": true,
+ "pclmulqdq": true,
+ "mmxext": true,
+ "popcnt": true,
+ "xsaves": false,
+ "lm": true,
+ "umip": false,
+ "pse": true,
+ "avx2": false,
+ "sep": true,
+ "nodeid-msr": false,
+ "misalignsse": false,
+ "min-xlevel": 2147483658,
+ "bmi1": true,
+ "bmi2": true,
+ "kvm-pv-unhalt": false,
+ "tsc-scale": false,
+ "topoext": false,
+ "clflushopt": true,
+ "monitor": true,
+ "avx512er": false,
+ "pmm-en": false,
+ "pcid": false,
+ "3dnow": true,
+ "erms": true,
+ "lahf-lm": true,
+ "fxsr-opt": false,
+ "xstore": false,
+ "rtm": false,
+ "lmce": false,
+ "perfctr-nb": false,
+ "rdrand": false,
+ "rdseed": false,
+ "avx512-4vnniw": false,
+ "vme": false,
+ "vmx": false,
+ "dtes64": false,
+ "mtrr": true,
+ "rdtscp": true,
+ "pse36": true,
+ "tbm": false,
+ "wdt": false,
+ "model-id": "QEMU TCG CPU version 2.5+",
+ "sha-ni": false,
+ "abm": true,
+ "avx512pf": false,
+ "xstore-en": false
+ }
+ }
+ },
+ "id": "libvirt-3"
+}
diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
index 805fee78b..2afd78a98 100644
--- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml
@@ -207,7 +207,7 @@
<kvmVersion>0</kvmVersion>
<package> (v2.8.0-1428-g1b1a68c602)</package>
<arch>x86_64</arch>
- <hostCPU model='base'>
+ <hostCPU type='kvm' model='base'>
<property name='cmov' type='boolean' value='true'/>
<property name='ia64' type='boolean' value='false'/>
<property name='aes' type='boolean' value='true'/>
@@ -377,6 +377,176 @@
<property name='avx512pf' type='boolean'
value='false'/>
<property name='xstore-en' type='boolean'
value='false'/>
</hostCPU>
+ <hostCPU type='tcg' model='base'>
+ <property name='cmov' type='boolean' value='true'/>
+ <property name='ia64' type='boolean' value='false'/>
+ <property name='aes' type='boolean' value='true'/>
+ <property name='mmx' type='boolean' value='true'/>
+ <property name='rdpid' type='boolean' value='false'/>
+ <property name='arat' type='boolean' value='true'/>
+ <property name='pause-filter' type='boolean'
value='false'/>
+ <property name='xsavec' type='boolean' value='false'/>
+ <property name='osxsave' type='boolean'
value='false'/>
+ <property name='kvm-asyncpf' type='boolean'
value='false'/>
+ <property name='perfctr-core' type='boolean'
value='false'/>
+ <property name='mpx' type='boolean' value='true'/>
+ <property name='pbe' type='boolean' value='false'/>
+ <property name='avx512cd' type='boolean'
value='false'/>
+ <property name='decodeassists' type='boolean'
value='false'/>
+ <property name='sse4.1' type='boolean' value='true'/>
+ <property name='family' type='number' value='6'/>
+ <property name='avx512f' type='boolean'
value='false'/>
+ <property name='msr' type='boolean' value='true'/>
+ <property name='mce' type='boolean' value='true'/>
+ <property name='mca' type='boolean' value='true'/>
+ <property name='xcrypt' type='boolean' value='false'/>
+ <property name='min-level' type='number' value='13'/>
+ <property name='xgetbv1' type='boolean' value='true'/>
+ <property name='cid' type='boolean' value='false'/>
+ <property name='ds' type='boolean' value='false'/>
+ <property name='fxsr' type='boolean' value='true'/>
+ <property name='xsaveopt' type='boolean'
value='true'/>
+ <property name='xtpr' type='boolean' value='false'/>
+ <property name='avx512vl' type='boolean'
value='false'/>
+ <property name='avx512-vpopcntdq' type='boolean'
value='false'/>
+ <property name='phe' type='boolean' value='false'/>
+ <property name='extapic' type='boolean'
value='false'/>
+ <property name='3dnowprefetch' type='boolean'
value='false'/>
+ <property name='cr8legacy' type='boolean'
value='true'/>
+ <property name='xcrypt-en' type='boolean'
value='false'/>
+ <property name='pn' type='boolean' value='false'/>
+ <property name='dca' type='boolean' value='false'/>
+ <property name='vendor' type='string'
value='AuthenticAMD'/>
+ <property name='pku' type='boolean' value='true'/>
+ <property name='smx' type='boolean' value='false'/>
+ <property name='cmp-legacy' type='boolean'
value='false'/>
+ <property name='avx512-4fmaps' type='boolean'
value='false'/>
+ <property name='vmcb-clean' type='boolean'
value='false'/>
+ <property name='hle' type='boolean' value='false'/>
+ <property name='3dnowext' type='boolean'
value='true'/>
+ <property name='npt' type='boolean' value='false'/>
+ <property name='clwb' type='boolean' value='true'/>
+ <property name='lbrv' type='boolean' value='false'/>
+ <property name='adx' type='boolean' value='true'/>
+ <property name='ss' type='boolean' value='true'/>
+ <property name='pni' type='boolean' value='true'/>
+ <property name='svm-lock' type='boolean'
value='false'/>
+ <property name='smep' type='boolean' value='true'/>
+ <property name='smap' type='boolean' value='true'/>
+ <property name='pfthreshold' type='boolean'
value='false'/>
+ <property name='x2apic' type='boolean' value='false'/>
+ <property name='avx512vbmi' type='boolean'
value='false'/>
+ <property name='flushbyasid' type='boolean'
value='false'/>
+ <property name='f16c' type='boolean' value='false'/>
+ <property name='ace2-en' type='boolean'
value='false'/>
+ <property name='pae' type='boolean' value='true'/>
+ <property name='pat' type='boolean' value='true'/>
+ <property name='sse' type='boolean' value='true'/>
+ <property name='phe-en' type='boolean' value='false'/>
+ <property name='kvm-nopiodelay' type='boolean'
value='false'/>
+ <property name='tm' type='boolean' value='false'/>
+ <property name='kvmclock-stable-bit' type='boolean'
value='false'/>
+ <property name='hypervisor' type='boolean'
value='true'/>
+ <property name='pcommit' type='boolean' value='true'/>
+ <property name='syscall' type='boolean' value='true'/>
+ <property name='avx512dq' type='boolean'
value='false'/>
+ <property name='svm' type='boolean' value='true'/>
+ <property name='invtsc' type='boolean' value='false'/>
+ <property name='sse2' type='boolean' value='true'/>
+ <property name='est' type='boolean' value='false'/>
+ <property name='avx512ifma' type='boolean'
value='false'/>
+ <property name='tm2' type='boolean' value='false'/>
+ <property name='kvm-pv-eoi' type='boolean'
value='false'/>
+ <property name='cx8' type='boolean' value='true'/>
+ <property name='kvm-mmu' type='boolean'
value='false'/>
+ <property name='sse4.2' type='boolean' value='true'/>
+ <property name='pge' type='boolean' value='true'/>
+ <property name='pdcm' type='boolean' value='false'/>
+ <property name='model' type='number' value='6'/>
+ <property name='movbe' type='boolean' value='true'/>
+ <property name='nrip-save' type='boolean'
value='false'/>
+ <property name='ssse3' type='boolean' value='true'/>
+ <property name='sse4a' type='boolean' value='true'/>
+ <property name='invpcid' type='boolean'
value='false'/>
+ <property name='pdpe1gb' type='boolean' value='true'/>
+ <property name='tsc-deadline' type='boolean'
value='false'/>
+ <property name='fma' type='boolean' value='false'/>
+ <property name='cx16' type='boolean' value='true'/>
+ <property name='de' type='boolean' value='true'/>
+ <property name='stepping' type='number' value='3'/>
+ <property name='xsave' type='boolean' value='true'/>
+ <property name='clflush' type='boolean' value='true'/>
+ <property name='skinit' type='boolean' value='false'/>
+ <property name='tsc' type='boolean' value='true'/>
+ <property name='tce' type='boolean' value='false'/>
+ <property name='fpu' type='boolean' value='true'/>
+ <property name='ds-cpl' type='boolean' value='false'/>
+ <property name='ibs' type='boolean' value='false'/>
+ <property name='fma4' type='boolean' value='false'/>
+ <property name='la57' type='boolean' value='true'/>
+ <property name='osvw' type='boolean' value='false'/>
+ <property name='apic' type='boolean' value='true'/>
+ <property name='pmm' type='boolean' value='false'/>
+ <property name='tsc-adjust' type='boolean'
value='false'/>
+ <property name='kvm-steal-time' type='boolean'
value='false'/>
+ <property name='kvmclock' type='boolean'
value='false'/>
+ <property name='lwp' type='boolean' value='false'/>
+ <property name='xop' type='boolean' value='false'/>
+ <property name='avx' type='boolean' value='false'/>
+ <property name='ospke' type='boolean' value='true'/>
+ <property name='acpi' type='boolean' value='true'/>
+ <property name='avx512bw' type='boolean'
value='false'/>
+ <property name='ace2' type='boolean' value='false'/>
+ <property name='fsgsbase' type='boolean'
value='true'/>
+ <property name='ht' type='boolean' value='false'/>
+ <property name='nx' type='boolean' value='true'/>
+ <property name='pclmulqdq' type='boolean'
value='true'/>
+ <property name='mmxext' type='boolean' value='true'/>
+ <property name='popcnt' type='boolean' value='true'/>
+ <property name='xsaves' type='boolean' value='false'/>
+ <property name='lm' type='boolean' value='true'/>
+ <property name='umip' type='boolean' value='false'/>
+ <property name='pse' type='boolean' value='true'/>
+ <property name='avx2' type='boolean' value='false'/>
+ <property name='sep' type='boolean' value='true'/>
+ <property name='nodeid-msr' type='boolean'
value='false'/>
+ <property name='misalignsse' type='boolean'
value='false'/>
+ <property name='min-xlevel' type='number'
value='2147483658'/>
+ <property name='bmi1' type='boolean' value='true'/>
+ <property name='bmi2' type='boolean' value='true'/>
+ <property name='kvm-pv-unhalt' type='boolean'
value='false'/>
+ <property name='tsc-scale' type='boolean'
value='false'/>
+ <property name='topoext' type='boolean'
value='false'/>
+ <property name='clflushopt' type='boolean'
value='true'/>
+ <property name='monitor' type='boolean' value='true'/>
+ <property name='avx512er' type='boolean'
value='false'/>
+ <property name='pmm-en' type='boolean' value='false'/>
+ <property name='pcid' type='boolean' value='false'/>
+ <property name='3dnow' type='boolean' value='true'/>
+ <property name='erms' type='boolean' value='true'/>
+ <property name='lahf-lm' type='boolean' value='true'/>
+ <property name='fxsr-opt' type='boolean'
value='false'/>
+ <property name='xstore' type='boolean' value='false'/>
+ <property name='rtm' type='boolean' value='false'/>
+ <property name='lmce' type='boolean' value='false'/>
+ <property name='perfctr-nb' type='boolean'
value='false'/>
+ <property name='rdrand' type='boolean' value='false'/>
+ <property name='rdseed' type='boolean' value='false'/>
+ <property name='avx512-4vnniw' type='boolean'
value='false'/>
+ <property name='vme' type='boolean' value='false'/>
+ <property name='vmx' type='boolean' value='false'/>
+ <property name='dtes64' type='boolean' value='false'/>
+ <property name='mtrr' type='boolean' value='true'/>
+ <property name='rdtscp' type='boolean' value='true'/>
+ <property name='pse36' type='boolean' value='true'/>
+ <property name='tbm' type='boolean' value='false'/>
+ <property name='wdt' type='boolean' value='false'/>
+ <property name='model-id' type='string' value='QEMU TCG CPU
version 2.5+'/>
+ <property name='sha-ni' type='boolean' value='false'/>
+ <property name='abm' type='boolean' value='true'/>
+ <property name='avx512pf' type='boolean'
value='false'/>
+ <property name='xstore-en' type='boolean'
value='false'/>
+ </hostCPU>
<cpu type='kvm' name='max' usable='yes'/>
<cpu type='kvm' name='host' usable='yes'/>
<cpu type='kvm' name='base' usable='yes'/>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index f55b04b05..3590920d4 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -384,7 +384,8 @@ testUpdateQEMUCaps(const struct testInfo *info,
if (testAddCPUModels(info->qemuCaps, info->skipLegacyCPUs) < 0)
goto cleanup;
- virQEMUCapsInitHostCPUModel(info->qemuCaps, caps);
+ virQEMUCapsInitHostCPUModel(info->qemuCaps, caps, VIR_DOMAIN_VIRT_KVM);
+ virQEMUCapsInitHostCPUModel(info->qemuCaps, caps, VIR_DOMAIN_VIRT_QEMU);
virQEMUCapsFilterByMachineType(info->qemuCaps, vm->def->os.machine);
--
2.11.1