We need to create a mapping between CPU model names and their corresponding QOM types. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- Notes: Version 2: - ignore empty typename strings src/qemu/qemu_capabilities.c | 3 + src/qemu/qemu_monitor.c | 2 + src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 5 + .../caps_2.10.0.aarch64.xml | 126 ++--- .../caps_2.10.0.ppc64.xml | 512 ++++++++--------- .../caps_2.10.0.s390x.xml | 264 ++++----- .../caps_2.10.0.x86_64.xml | 132 ++--- .../caps_2.11.0.s390x.xml | 264 ++++----- .../caps_2.11.0.x86_64.xml | 136 ++--- .../caps_2.12.0.aarch64.xml | 136 ++--- .../caps_2.12.0.ppc64.xml | 516 +++++++++--------- .../caps_2.12.0.s390x.xml | 264 ++++----- .../caps_2.12.0.x86_64.xml | 180 +++--- .../qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 512 ++++++++--------- .../qemucapabilitiesdata/caps_2.9.0.s390x.xml | 256 ++++----- .../caps_2.9.0.x86_64.xml | 128 ++--- .../qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 516 +++++++++--------- .../qemucapabilitiesdata/caps_3.0.0.s390x.xml | 272 ++++----- .../caps_3.0.0.x86_64.xml | 184 +++---- .../qemucapabilitiesdata/caps_3.1.0.ppc64.xml | 516 +++++++++--------- .../caps_3.1.0.x86_64.xml | 196 +++---- .../caps_4.0.0.aarch64.xml | 148 ++--- .../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 516 +++++++++--------- .../qemucapabilitiesdata/caps_4.0.0.s390x.xml | 284 +++++----- .../caps_4.0.0.x86_64.xml | 196 +++---- .../caps_4.1.0.x86_64.xml | 400 +++++++------- .../caps_4.2.0.aarch64.xml | 148 ++--- .../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 516 +++++++++--------- .../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 300 +++++----- .../caps_4.2.0.x86_64.xml | 400 +++++++------- 31 files changed, 4020 insertions(+), 4009 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a274cef120..2a32d575c9 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3548,6 +3548,8 @@ virQEMUCapsLoadCPUModels(virQEMUCapsPtr qemuCaps, return -1; } + cpu->type = virXMLPropString(nodes[i], "typename"); + node = ctxt->node; ctxt->node = nodes[i]; nblockers = virXPathNodeSet("./blocker", ctxt, &blockerNodes); @@ -4010,6 +4012,7 @@ virQEMUCapsFormatCPUModels(virQEMUCapsPtr qemuCaps, virBufferAsprintf(buf, "<cpu type='%s' ", typeStr); virBufferEscapeString(buf, "name='%s'", cpu->name); + virBufferEscapeString(buf, " typename='%s'", cpu->type); if (cpu->usable) { virBufferAsprintf(buf, " usable='%s'", virDomainCapsCPUUsableTypeToString(cpu->usable)); diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 8d86112f30..6056219674 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3559,6 +3559,7 @@ qemuMonitorCPUDefsFree(qemuMonitorCPUDefsPtr defs) for (i = 0; i < defs->ncpus; i++) { virStringListFree(defs->cpus[i].blockers); VIR_FREE(defs->cpus[i].name); + VIR_FREE(defs->cpus[i].type); } VIR_FREE(defs->cpus); @@ -3605,6 +3606,7 @@ qemuMonitorCPUDefsCopy(qemuMonitorCPUDefsPtr *dst, cpuDst->usable = cpuSrc->usable; if (VIR_STRDUP(cpuDst->name, cpuSrc->name) < 0 || + VIR_STRDUP(cpuDst->type, cpuSrc->type) < 0 || virStringListCopy(&cpuDst->blockers, (const char **)cpuSrc->blockers) < 0) return -1; diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 4f355c760a..f2af1badd4 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1098,6 +1098,7 @@ typedef qemuMonitorCPUDefInfo *qemuMonitorCPUDefInfoPtr; struct _qemuMonitorCPUDefInfo { virTristateBool usable; char *name; + char *type; char **blockers; /* NULL-terminated string list */ }; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index de75c46dc1..bc30884223 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5571,6 +5571,11 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon, if (VIR_STRDUP(cpu->name, tmp) < 0) return -1; + if ((tmp = virJSONValueObjectGetString(child, "typename")) && + *tmp && + VIR_STRDUP(cpu->type, tmp) < 0) + return -1; + if (virJSONValueObjectHasKey(child, "unavailable-features")) { virJSONValuePtr blockers; size_t j; ... diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index ab884239fe..176613fa2a 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -621,14 +621,14 @@ <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'/> - <cpu type='kvm' name='qemu64-v1' usable='yes'/> - <cpu type='kvm' name='qemu64' usable='yes'/> - <cpu type='kvm' name='qemu32-v1' usable='yes'/> - <cpu type='kvm' name='qemu32' usable='yes'/> - <cpu type='kvm' name='phenom-v1' usable='no'> + <cpu type='kvm' name='max' typename='max-x86_64-cpu' usable='yes'/> + <cpu type='kvm' name='host' typename='host-x86_64-cpu' usable='yes'/> + <cpu type='kvm' name='base' typename='base-x86_64-cpu' usable='yes'/> + <cpu type='kvm' name='qemu64-v1' typename='qemu64-v1-x86_64-cpu' usable='yes'/> + <cpu type='kvm' name='qemu64' typename='qemu64-x86_64-cpu' usable='yes'/> + <cpu type='kvm' name='qemu32-v1' typename='qemu32-v1-x86_64-cpu' usable='yes'/> + <cpu type='kvm' name='qemu32' typename='qemu32-x86_64-cpu' usable='yes'/> + <cpu type='kvm' name='phenom-v1' typename='phenom-v1-x86_64-cpu' usable='no'> <blocker name='mmxext'/> <blocker name='fxsr-opt'/> <blocker name='3dnowext'/> @@ -636,7 +636,7 @@ <blocker name='sse4a'/> <blocker name='npt'/> </cpu> - <cpu type='kvm' name='phenom' usable='no'> + <cpu type='kvm' name='phenom' typename='phenom-x86_64-cpu' usable='no'> <blocker name='mmxext'/> <blocker name='fxsr-opt'/> <blocker name='3dnowext'/> ... -- 2.23.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list