[libvirt] [PATCH 06/11] qemu: Perform full expansion on ARM

Andrea Bolognani abologna at redhat.com
Wed Nov 6 15:47:06 UTC 2019


The ARM implementation of query-cpu-model-expansion only
supports full expansion, so we have to make sure we're using
that expansion mode if we want to obtain any useful data.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
Tested-by: Andrew Jones <drjones at redhat.com>
---
 src/qemu/qemu_capabilities.c                  |   7 +-
 .../caps_4.2.0.aarch64.replies                | 100 ++++++++++++++++--
 .../caps_4.2.0.aarch64.xml                    |  42 ++++++++
 3 files changed, 141 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 363fb0e197..fc6473651c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2559,10 +2559,13 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCapsPtr qemuCaps,
      * the initial static expansion to get all variants of feature names.
      */
     if (ARCH_IS_X86(qemuCaps->arch) &&
-        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES))
+        !virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES)) {
         type = QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL;
-    else
+    } else if (ARCH_IS_ARM(qemuCaps->arch)) {
+        type = QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL;
+    } else {
         type = QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC;
+    }
 
     /* Older s390 models do not report a feature set */
     if (ARCH_IS_S390(qemuCaps->arch))
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.replies b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.replies
index efd193d90d..127f121680 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.replies
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.replies
@@ -21228,7 +21228,7 @@
 {
   "execute": "query-cpu-model-expansion",
   "arguments": {
-    "type": "static",
+    "type": "full",
     "model": {
       "name": "host"
     }
@@ -21237,10 +21237,54 @@
 }
 
 {
-  "id": "libvirt-42",
+  "return": {
+    "model": {
+      "name": "host",
+      "props": {
+        "sve768": false,
+        "sve128": true,
+        "sve1024": false,
+        "sve1280": false,
+        "sve896": false,
+        "sve256": true,
+        "sve1536": false,
+        "sve1792": false,
+        "sve384": false,
+        "sve": true,
+        "sve2048": false,
+        "sve512": true,
+        "aarch64": true,
+        "pmu": true,
+        "sve1920": false,
+        "sve1152": false,
+        "sve640": false,
+        "sve1408": false,
+        "sve1664": false
+      }
+    }
+  },
+  "id": "libvirt-42"
+}
+
+{
+  "execute": "query-cpu-model-expansion",
+  "arguments": {
+    "type": "full",
+    "model": {
+      "name": "host",
+      "props": {
+        "migratable": false
+      }
+    }
+  },
+  "id": "libvirt-43"
+}
+
+{
+  "id": "libvirt-43",
   "error": {
     "class": "GenericError",
-    "desc": "The requested expansion type is not supported"
+    "desc": "Parameter 'migratable' is unexpected"
   }
 }
 
@@ -21454,7 +21498,7 @@
 {
   "execute": "query-cpu-model-expansion",
   "arguments": {
-    "type": "static",
+    "type": "full",
     "model": {
       "name": "max"
     }
@@ -21463,9 +21507,53 @@
 }
 
 {
-  "id": "libvirt-3",
+  "return": {
+    "model": {
+      "name": "max",
+      "props": {
+        "sve768": true,
+        "sve128": true,
+        "sve1024": true,
+        "sve1280": true,
+        "sve896": true,
+        "sve256": true,
+        "sve1536": true,
+        "sve1792": true,
+        "sve384": true,
+        "sve": true,
+        "sve2048": true,
+        "sve512": true,
+        "aarch64": true,
+        "pmu": true,
+        "sve1920": true,
+        "sve1152": true,
+        "sve640": true,
+        "sve1408": true,
+        "sve1664": true
+      }
+    }
+  },
+  "id": "libvirt-3"
+}
+
+{
+  "execute": "query-cpu-model-expansion",
+  "arguments": {
+    "type": "full",
+    "model": {
+      "name": "max",
+      "props": {
+        "migratable": false
+      }
+    }
+  },
+  "id": "libvirt-4"
+}
+
+{
+  "id": "libvirt-4",
   "error": {
     "class": "GenericError",
-    "desc": "The requested expansion type is not supported"
+    "desc": "Parameter 'migratable' is unexpected"
   }
 }
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
index a4cb7ba4e6..17960460fb 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
@@ -175,6 +175,48 @@
   <microcodeVersion>61700242</microcodeVersion>
   <package>v4.1.0-2221-g36609b4fa3</package>
   <arch>aarch64</arch>
+  <hostCPU type='kvm' model='host' migratability='no'>
+    <property name='sve768' type='boolean' value='false'/>
+    <property name='sve128' type='boolean' value='true'/>
+    <property name='sve1024' type='boolean' value='false'/>
+    <property name='sve1280' type='boolean' value='false'/>
+    <property name='sve896' type='boolean' value='false'/>
+    <property name='sve256' type='boolean' value='true'/>
+    <property name='sve1536' type='boolean' value='false'/>
+    <property name='sve1792' type='boolean' value='false'/>
+    <property name='sve384' type='boolean' value='false'/>
+    <property name='sve' type='boolean' value='true'/>
+    <property name='sve2048' type='boolean' value='false'/>
+    <property name='sve512' type='boolean' value='true'/>
+    <property name='aarch64' type='boolean' value='true'/>
+    <property name='pmu' type='boolean' value='true'/>
+    <property name='sve1920' type='boolean' value='false'/>
+    <property name='sve1152' type='boolean' value='false'/>
+    <property name='sve640' type='boolean' value='false'/>
+    <property name='sve1408' type='boolean' value='false'/>
+    <property name='sve1664' type='boolean' value='false'/>
+  </hostCPU>
+  <hostCPU type='tcg' model='max' migratability='no'>
+    <property name='sve768' type='boolean' value='true'/>
+    <property name='sve128' type='boolean' value='true'/>
+    <property name='sve1024' type='boolean' value='true'/>
+    <property name='sve1280' type='boolean' value='true'/>
+    <property name='sve896' type='boolean' value='true'/>
+    <property name='sve256' type='boolean' value='true'/>
+    <property name='sve1536' type='boolean' value='true'/>
+    <property name='sve1792' type='boolean' value='true'/>
+    <property name='sve384' type='boolean' value='true'/>
+    <property name='sve' type='boolean' value='true'/>
+    <property name='sve2048' type='boolean' value='true'/>
+    <property name='sve512' type='boolean' value='true'/>
+    <property name='aarch64' type='boolean' value='true'/>
+    <property name='pmu' type='boolean' value='true'/>
+    <property name='sve1920' type='boolean' value='true'/>
+    <property name='sve1152' type='boolean' value='true'/>
+    <property name='sve640' type='boolean' value='true'/>
+    <property name='sve1408' type='boolean' value='true'/>
+    <property name='sve1664' type='boolean' value='true'/>
+  </hostCPU>
   <cpu type='kvm' name='pxa262'/>
   <cpu type='kvm' name='pxa270-a0'/>
   <cpu type='kvm' name='arm1136'/>
-- 
2.21.0




More information about the libvir-list mailing list