[PATCH v3 21/52] qemu: Store typename from query-cpu-definitions in qemuCaps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We need to create a mapping between CPU model names and their
corresponding QOM types.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>
---

Notes:
    Version 2:
    - ignore empty typename strings
    
    Version 3:
    - g_strdup

 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 ccb337ee2f..665fee28eb 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3528,6 +3528,8 @@ virQEMUCapsLoadCPUModels(virQEMUCapsPtr qemuCaps,
             return -1;
         }
 
+        cpu->type = virXMLPropString(nodes[i], "typename");
+
         node = ctxt->node;
         ctxt->node = nodes[i];
         nblockers = virXPathNodeSet("./blocker", ctxt, &blockerNodes);
@@ -3989,6 +3991,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 39c3122074..a1cdb19318 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3574,6 +3574,7 @@ qemuMonitorCPUDefsFree(qemuMonitorCPUDefsPtr defs)
     for (i = 0; i < defs->ncpus; i++) {
         g_strfreev(defs->cpus[i].blockers);
         g_free(defs->cpus[i].name);
+        g_free(defs->cpus[i].type);
     }
 
     g_free(defs->cpus);
@@ -3610,6 +3611,7 @@ qemuMonitorCPUDefsCopy(qemuMonitorCPUDefsPtr src)
 
         cpuDst->usable = cpuSrc->usable;
         cpuDst->name = g_strdup(cpuSrc->name);
+        cpuDst->type = g_strdup(cpuSrc->type);
         cpuDst->blockers = g_strdupv(cpuSrc->blockers);
     }
 
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 0eed8b3f9e..824b580344 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1109,6 +1109,7 @@ typedef qemuMonitorCPUDefInfo *qemuMonitorCPUDefInfoPtr;
 struct _qemuMonitorCPUDefInfo {
     virDomainCapsCPUUsable 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 54963233e6..3f3bfc1720 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5621,6 +5621,11 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon,
 
         cpu->name = g_strdup(tmp);
 
+        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_2.10.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
index f0bf003528..ad4f5447ed 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.aarch64.xml
@@ -144,69 +144,69 @@
   <microcodeVersion>61700287</microcodeVersion>
   <package> (v2.10.0)</package>
   <arch>aarch64</arch>
-  <cpu type='kvm' name='pxa262'/>
-  <cpu type='kvm' name='pxa270-a0'/>
-  <cpu type='kvm' name='arm1136'/>
-  <cpu type='kvm' name='cortex-a15'/>
-  <cpu type='kvm' name='pxa260'/>
-  <cpu type='kvm' name='arm1136-r2'/>
-  <cpu type='kvm' name='pxa261'/>
-  <cpu type='kvm' name='pxa255'/>
-  <cpu type='kvm' name='arm926'/>
-  <cpu type='kvm' name='arm11mpcore'/>
-  <cpu type='kvm' name='pxa250'/>
-  <cpu type='kvm' name='ti925t'/>
-  <cpu type='kvm' name='cortex-a57'/>
-  <cpu type='kvm' name='sa1110'/>
-  <cpu type='kvm' name='arm1176'/>
-  <cpu type='kvm' name='cortex-a53'/>
-  <cpu type='kvm' name='host'/>
-  <cpu type='kvm' name='sa1100'/>
-  <cpu type='kvm' name='pxa270-c5'/>
-  <cpu type='kvm' name='cortex-a9'/>
-  <cpu type='kvm' name='cortex-a8'/>
-  <cpu type='kvm' name='pxa270-c0'/>
-  <cpu type='kvm' name='cortex-a7'/>
-  <cpu type='kvm' name='arm1026'/>
-  <cpu type='kvm' name='pxa270-b1'/>
-  <cpu type='kvm' name='cortex-m3'/>
-  <cpu type='kvm' name='cortex-m4'/>
-  <cpu type='kvm' name='pxa270-b0'/>
-  <cpu type='kvm' name='arm946'/>
-  <cpu type='kvm' name='cortex-r5'/>
-  <cpu type='kvm' name='pxa270-a1'/>
-  <cpu type='kvm' name='pxa270'/>
-  <cpu type='tcg' name='pxa262'/>
-  <cpu type='tcg' name='pxa270-a0'/>
-  <cpu type='tcg' name='arm1136'/>
-  <cpu type='tcg' name='cortex-a15'/>
-  <cpu type='tcg' name='pxa260'/>
-  <cpu type='tcg' name='arm1136-r2'/>
-  <cpu type='tcg' name='pxa261'/>
-  <cpu type='tcg' name='pxa255'/>
-  <cpu type='tcg' name='arm926'/>
-  <cpu type='tcg' name='arm11mpcore'/>
-  <cpu type='tcg' name='pxa250'/>
-  <cpu type='tcg' name='ti925t'/>
-  <cpu type='tcg' name='cortex-a57'/>
-  <cpu type='tcg' name='sa1110'/>
-  <cpu type='tcg' name='arm1176'/>
-  <cpu type='tcg' name='cortex-a53'/>
-  <cpu type='tcg' name='sa1100'/>
-  <cpu type='tcg' name='pxa270-c5'/>
-  <cpu type='tcg' name='cortex-a9'/>
-  <cpu type='tcg' name='cortex-a8'/>
-  <cpu type='tcg' name='pxa270-c0'/>
-  <cpu type='tcg' name='cortex-a7'/>
-  <cpu type='tcg' name='arm1026'/>
-  <cpu type='tcg' name='pxa270-b1'/>
-  <cpu type='tcg' name='cortex-m3'/>
-  <cpu type='tcg' name='cortex-m4'/>
-  <cpu type='tcg' name='pxa270-b0'/>
-  <cpu type='tcg' name='arm946'/>
-  <cpu type='tcg' name='cortex-r5'/>
-  <cpu type='tcg' name='pxa270-a1'/>
-  <cpu type='tcg' name='pxa270'/>
+  <cpu type='kvm' name='pxa262' typename='pxa262-arm-cpu'/>
+  <cpu type='kvm' name='pxa270-a0' typename='pxa270-a0-arm-cpu'/>
+  <cpu type='kvm' name='arm1136' typename='arm1136-arm-cpu'/>
+  <cpu type='kvm' name='cortex-a15' typename='cortex-a15-arm-cpu'/>
+  <cpu type='kvm' name='pxa260' typename='pxa260-arm-cpu'/>
+  <cpu type='kvm' name='arm1136-r2' typename='arm1136-r2-arm-cpu'/>
+  <cpu type='kvm' name='pxa261' typename='pxa261-arm-cpu'/>
+  <cpu type='kvm' name='pxa255' typename='pxa255-arm-cpu'/>
+  <cpu type='kvm' name='arm926' typename='arm926-arm-cpu'/>
+  <cpu type='kvm' name='arm11mpcore' typename='arm11mpcore-arm-cpu'/>
+  <cpu type='kvm' name='pxa250' typename='pxa250-arm-cpu'/>
+  <cpu type='kvm' name='ti925t' typename='ti925t-arm-cpu'/>
+  <cpu type='kvm' name='cortex-a57' typename='cortex-a57-arm-cpu'/>
+  <cpu type='kvm' name='sa1110' typename='sa1110-arm-cpu'/>
+  <cpu type='kvm' name='arm1176' typename='arm1176-arm-cpu'/>
+  <cpu type='kvm' name='cortex-a53' typename='cortex-a53-arm-cpu'/>
+  <cpu type='kvm' name='host' typename='host-arm-cpu'/>
+  <cpu type='kvm' name='sa1100' typename='sa1100-arm-cpu'/>
+  <cpu type='kvm' name='pxa270-c5' typename='pxa270-c5-arm-cpu'/>
+  <cpu type='kvm' name='cortex-a9' typename='cortex-a9-arm-cpu'/>
+  <cpu type='kvm' name='cortex-a8' typename='cortex-a8-arm-cpu'/>
+  <cpu type='kvm' name='pxa270-c0' typename='pxa270-c0-arm-cpu'/>
+  <cpu type='kvm' name='cortex-a7' typename='cortex-a7-arm-cpu'/>
+  <cpu type='kvm' name='arm1026' typename='arm1026-arm-cpu'/>
+  <cpu type='kvm' name='pxa270-b1' typename='pxa270-b1-arm-cpu'/>
+  <cpu type='kvm' name='cortex-m3' typename='cortex-m3-arm-cpu'/>
+  <cpu type='kvm' name='cortex-m4' typename='cortex-m4-arm-cpu'/>
+  <cpu type='kvm' name='pxa270-b0' typename='pxa270-b0-arm-cpu'/>
+  <cpu type='kvm' name='arm946' typename='arm946-arm-cpu'/>
+  <cpu type='kvm' name='cortex-r5' typename='cortex-r5-arm-cpu'/>
+  <cpu type='kvm' name='pxa270-a1' typename='pxa270-a1-arm-cpu'/>
+  <cpu type='kvm' name='pxa270' typename='pxa270-arm-cpu'/>
+  <cpu type='tcg' name='pxa262' typename='pxa262-arm-cpu'/>
+  <cpu type='tcg' name='pxa270-a0' typename='pxa270-a0-arm-cpu'/>
+  <cpu type='tcg' name='arm1136' typename='arm1136-arm-cpu'/>
+  <cpu type='tcg' name='cortex-a15' typename='cortex-a15-arm-cpu'/>
+  <cpu type='tcg' name='pxa260' typename='pxa260-arm-cpu'/>
+  <cpu type='tcg' name='arm1136-r2' typename='arm1136-r2-arm-cpu'/>
+  <cpu type='tcg' name='pxa261' typename='pxa261-arm-cpu'/>
+  <cpu type='tcg' name='pxa255' typename='pxa255-arm-cpu'/>
+  <cpu type='tcg' name='arm926' typename='arm926-arm-cpu'/>
+  <cpu type='tcg' name='arm11mpcore' typename='arm11mpcore-arm-cpu'/>
+  <cpu type='tcg' name='pxa250' typename='pxa250-arm-cpu'/>
+  <cpu type='tcg' name='ti925t' typename='ti925t-arm-cpu'/>
+  <cpu type='tcg' name='cortex-a57' typename='cortex-a57-arm-cpu'/>
+  <cpu type='tcg' name='sa1110' typename='sa1110-arm-cpu'/>
+  <cpu type='tcg' name='arm1176' typename='arm1176-arm-cpu'/>
+  <cpu type='tcg' name='cortex-a53' typename='cortex-a53-arm-cpu'/>
+  <cpu type='tcg' name='sa1100' typename='sa1100-arm-cpu'/>
+  <cpu type='tcg' name='pxa270-c5' typename='pxa270-c5-arm-cpu'/>
+  <cpu type='tcg' name='cortex-a9' typename='cortex-a9-arm-cpu'/>
+  <cpu type='tcg' name='cortex-a8' typename='cortex-a8-arm-cpu'/>
+  <cpu type='tcg' name='pxa270-c0' typename='pxa270-c0-arm-cpu'/>
+  <cpu type='tcg' name='cortex-a7' typename='cortex-a7-arm-cpu'/>
+  <cpu type='tcg' name='arm1026' typename='arm1026-arm-cpu'/>
+  <cpu type='tcg' name='pxa270-b1' typename='pxa270-b1-arm-cpu'/>
+  <cpu type='tcg' name='cortex-m3' typename='cortex-m3-arm-cpu'/>
+  <cpu type='tcg' name='cortex-m4' typename='cortex-m4-arm-cpu'/>
+  <cpu type='tcg' name='pxa270-b0' typename='pxa270-b0-arm-cpu'/>
+  <cpu type='tcg' name='arm946' typename='arm946-arm-cpu'/>
+  <cpu type='tcg' name='cortex-r5' typename='cortex-r5-arm-cpu'/>
+  <cpu type='tcg' name='pxa270-a1' typename='pxa270-a1-arm-cpu'/>
+  <cpu type='tcg' name='pxa270' typename='pxa270-arm-cpu'/>
   <machine name='integratorcp' maxCpus='1'/>
   <machine name='nuri' maxCpus='2'/>
   <machine name='mps2-an511' maxCpus='1'/>
...

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux