[PATCH v3 23/52] qemu: Add virQEMUCaps{Load, Format}Accel

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

 



The new functions are designed to load and format capabilities which
depend on the accelerator (host CPU expansion and CPU models).

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---

Notes:
    Version 3:
    - new patch

 src/qemu/qemu_capabilities.c                  |  40 +-
 .../caps_2.10.0.x86_64.xml                    | 216 ++++-----
 .../caps_2.11.0.x86_64.xml                    | 154 +++----
 .../caps_2.12.0.x86_64.xml                    | 430 +++++++++---------
 .../caps_2.9.0.x86_64.xml                     | 114 ++---
 .../caps_3.0.0.x86_64.xml                     | 238 +++++-----
 .../caps_3.1.0.x86_64.xml                     | 366 +++++++--------
 .../qemucapabilitiesdata/caps_4.0.0.s390x.xml |  68 +--
 .../caps_4.0.0.x86_64.xml                     | 362 +++++++--------
 .../caps_4.1.0.x86_64.xml                     | 398 ++++++++--------
 .../qemucapabilitiesdata/caps_4.2.0.s390x.xml |  80 ++--
 .../caps_4.2.0.x86_64.xml                     | 404 ++++++++--------
 12 files changed, 1444 insertions(+), 1426 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 435e65daed..54f2ecb7f4 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3555,6 +3555,21 @@ virQEMUCapsLoadCPUModels(virQEMUCapsPtr qemuCaps,
 }
 
 
+static int
+virQEMUCapsLoadAccel(virQEMUCapsPtr qemuCaps,
+                     xmlXPathContextPtr ctxt,
+                     virDomainVirtType type)
+{
+    if (virQEMUCapsLoadHostCPUModelInfo(qemuCaps, ctxt, type) < 0)
+        return -1;
+
+    if (virQEMUCapsLoadCPUModels(qemuCaps, ctxt, type) < 0)
+        return -1;
+
+    return 0;
+}
+
+
 struct _virQEMUCapsCachePriv {
     char *libDir;
     uid_t runUid;
@@ -3766,12 +3781,8 @@ virQEMUCapsLoadCache(virArch hostArch,
     }
     VIR_FREE(str);
 
-    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 ||
-        virQEMUCapsLoadCPUModels(qemuCaps, ctxt, VIR_DOMAIN_VIRT_QEMU) < 0)
+    if (virQEMUCapsLoadAccel(qemuCaps, ctxt, VIR_DOMAIN_VIRT_KVM) < 0 ||
+        virQEMUCapsLoadAccel(qemuCaps, ctxt, VIR_DOMAIN_VIRT_QEMU) < 0)
         goto cleanup;
 
     if ((n = virXPathNodeSet("./machine", ctxt, &nodes)) < 0) {
@@ -4003,6 +4014,16 @@ virQEMUCapsFormatCPUModels(virQEMUCapsPtr qemuCaps,
 }
 
 
+static void
+virQEMUCapsFormatAccel(virQEMUCapsPtr qemuCaps,
+                       virBufferPtr buf,
+                       virDomainVirtType type)
+{
+    virQEMUCapsFormatHostCPUModelInfo(qemuCaps, buf, type);
+    virQEMUCapsFormatCPUModels(qemuCaps, buf, type);
+}
+
+
 static void
 virQEMUCapsFormatSEVInfo(virQEMUCapsPtr qemuCaps, virBufferPtr buf)
 {
@@ -4065,11 +4086,8 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps)
     virBufferAsprintf(&buf, "<arch>%s</arch>\n",
                       virArchToString(qemuCaps->arch));
 
-    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);
+    virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_KVM);
+    virQEMUCapsFormatAccel(qemuCaps, &buf, VIR_DOMAIN_VIRT_QEMU);
 
     for (i = 0; i < qemuCaps->nmachineTypes; i++) {
         virBufferEscapeString(&buf, "<machine name='%s'",
diff --git a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
index 10a94a7f1c..951e1c85a4 100644
--- a/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml
@@ -420,6 +420,114 @@
     <property name='avx512pf' type='boolean' value='false'/>
     <property name='xstore-en' type='boolean' value='false'/>
   </hostCPU>
+  <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' typename='qemu64-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='qemu32' typename='qemu32-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='phenom' typename='phenom-x86_64-cpu' usable='no'>
+    <blocker name='mmxext'/>
+    <blocker name='fxsr-opt'/>
+    <blocker name='3dnowext'/>
+    <blocker name='3dnow'/>
+    <blocker name='sse4a'/>
+    <blocker name='npt'/>
+  </cpu>
+  <cpu type='kvm' name='pentium3' typename='pentium3-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='pentium2' typename='pentium2-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='pentium' typename='pentium-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='n270' typename='n270-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='kvm64' typename='kvm64-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='kvm32' typename='kvm32-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='coreduo' typename='coreduo-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='core2duo' typename='core2duo-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='athlon' typename='athlon-x86_64-cpu' usable='no'>
+    <blocker name='mmxext'/>
+    <blocker name='3dnowext'/>
+    <blocker name='3dnow'/>
+  </cpu>
+  <cpu type='kvm' name='Westmere' typename='Westmere-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='Skylake-Server' typename='Skylake-Server-x86_64-cpu' usable='no'>
+    <blocker name='hle'/>
+    <blocker name='rtm'/>
+    <blocker name='mpx'/>
+    <blocker name='avx512f'/>
+    <blocker name='avx512dq'/>
+    <blocker name='rdseed'/>
+    <blocker name='adx'/>
+    <blocker name='smap'/>
+    <blocker name='clwb'/>
+    <blocker name='avx512cd'/>
+    <blocker name='avx512bw'/>
+    <blocker name='avx512vl'/>
+    <blocker name='3dnowprefetch'/>
+    <blocker name='xsavec'/>
+    <blocker name='xgetbv1'/>
+    <blocker name='mpx'/>
+    <blocker name='mpx'/>
+    <blocker name='avx512f'/>
+    <blocker name='avx512f'/>
+    <blocker name='avx512f'/>
+  </cpu>
+  <cpu type='kvm' name='Skylake-Client' typename='Skylake-Client-x86_64-cpu' usable='no'>
+    <blocker name='hle'/>
+    <blocker name='rtm'/>
+    <blocker name='mpx'/>
+    <blocker name='rdseed'/>
+    <blocker name='adx'/>
+    <blocker name='smap'/>
+    <blocker name='3dnowprefetch'/>
+    <blocker name='xsavec'/>
+    <blocker name='xgetbv1'/>
+    <blocker name='mpx'/>
+    <blocker name='mpx'/>
+  </cpu>
+  <cpu type='kvm' name='SandyBridge' typename='SandyBridge-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='Penryn' typename='Penryn-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='Opteron_G5' typename='Opteron_G5-x86_64-cpu' usable='no'>
+    <blocker name='sse4a'/>
+    <blocker name='misalignsse'/>
+    <blocker name='3dnowprefetch'/>
+    <blocker name='xop'/>
+    <blocker name='fma4'/>
+    <blocker name='tbm'/>
+  </cpu>
+  <cpu type='kvm' name='Opteron_G4' typename='Opteron_G4-x86_64-cpu' usable='no'>
+    <blocker name='sse4a'/>
+    <blocker name='misalignsse'/>
+    <blocker name='3dnowprefetch'/>
+    <blocker name='xop'/>
+    <blocker name='fma4'/>
+  </cpu>
+  <cpu type='kvm' name='Opteron_G3' typename='Opteron_G3-x86_64-cpu' usable='no'>
+    <blocker name='sse4a'/>
+    <blocker name='misalignsse'/>
+  </cpu>
+  <cpu type='kvm' name='Opteron_G2' typename='Opteron_G2-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='Opteron_G1' typename='Opteron_G1-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='Nehalem' typename='Nehalem-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='IvyBridge' typename='IvyBridge-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='Haswell' typename='Haswell-x86_64-cpu' usable='no'>
+    <blocker name='hle'/>
+    <blocker name='rtm'/>
+  </cpu>
+  <cpu type='kvm' name='Haswell-noTSX' typename='Haswell-noTSX-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='Conroe' typename='Conroe-x86_64-cpu' usable='yes'/>
+  <cpu type='kvm' name='Broadwell' typename='Broadwell-x86_64-cpu' usable='no'>
+    <blocker name='hle'/>
+    <blocker name='rtm'/>
+    <blocker name='rdseed'/>
+    <blocker name='adx'/>
+    <blocker name='smap'/>
+    <blocker name='3dnowprefetch'/>
+  </cpu>
+  <cpu type='kvm' name='Broadwell-noTSX' typename='Broadwell-noTSX-x86_64-cpu' usable='no'>
+    <blocker name='rdseed'/>
+    <blocker name='adx'/>
+    <blocker name='smap'/>
+    <blocker name='3dnowprefetch'/>
+  </cpu>
+  <cpu type='kvm' name='486' typename='486-x86_64-cpu' usable='yes'/>
   <hostCPU type='tcg' model='base' migratability='yes'>
     <property name='phys-bits' type='number' value='0'/>
     <property name='core-id' type='number' value='-1'/>
@@ -654,114 +762,6 @@
     <property name='avx512pf' type='boolean' value='false'/>
     <property name='xstore-en' type='boolean' value='false'/>
   </hostCPU>
-  <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' typename='qemu64-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='qemu32' typename='qemu32-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='phenom' typename='phenom-x86_64-cpu' usable='no'>
-    <blocker name='mmxext'/>
-    <blocker name='fxsr-opt'/>
-    <blocker name='3dnowext'/>
-    <blocker name='3dnow'/>
-    <blocker name='sse4a'/>
-    <blocker name='npt'/>
-  </cpu>
-  <cpu type='kvm' name='pentium3' typename='pentium3-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='pentium2' typename='pentium2-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='pentium' typename='pentium-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='n270' typename='n270-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='kvm64' typename='kvm64-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='kvm32' typename='kvm32-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='coreduo' typename='coreduo-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='core2duo' typename='core2duo-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='athlon' typename='athlon-x86_64-cpu' usable='no'>
-    <blocker name='mmxext'/>
-    <blocker name='3dnowext'/>
-    <blocker name='3dnow'/>
-  </cpu>
-  <cpu type='kvm' name='Westmere' typename='Westmere-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='Skylake-Server' typename='Skylake-Server-x86_64-cpu' usable='no'>
-    <blocker name='hle'/>
-    <blocker name='rtm'/>
-    <blocker name='mpx'/>
-    <blocker name='avx512f'/>
-    <blocker name='avx512dq'/>
-    <blocker name='rdseed'/>
-    <blocker name='adx'/>
-    <blocker name='smap'/>
-    <blocker name='clwb'/>
-    <blocker name='avx512cd'/>
-    <blocker name='avx512bw'/>
-    <blocker name='avx512vl'/>
-    <blocker name='3dnowprefetch'/>
-    <blocker name='xsavec'/>
-    <blocker name='xgetbv1'/>
-    <blocker name='mpx'/>
-    <blocker name='mpx'/>
-    <blocker name='avx512f'/>
-    <blocker name='avx512f'/>
-    <blocker name='avx512f'/>
-  </cpu>
-  <cpu type='kvm' name='Skylake-Client' typename='Skylake-Client-x86_64-cpu' usable='no'>
-    <blocker name='hle'/>
-    <blocker name='rtm'/>
-    <blocker name='mpx'/>
-    <blocker name='rdseed'/>
-    <blocker name='adx'/>
-    <blocker name='smap'/>
-    <blocker name='3dnowprefetch'/>
-    <blocker name='xsavec'/>
-    <blocker name='xgetbv1'/>
-    <blocker name='mpx'/>
-    <blocker name='mpx'/>
-  </cpu>
-  <cpu type='kvm' name='SandyBridge' typename='SandyBridge-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='Penryn' typename='Penryn-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='Opteron_G5' typename='Opteron_G5-x86_64-cpu' usable='no'>
-    <blocker name='sse4a'/>
-    <blocker name='misalignsse'/>
-    <blocker name='3dnowprefetch'/>
-    <blocker name='xop'/>
-    <blocker name='fma4'/>
-    <blocker name='tbm'/>
-  </cpu>
-  <cpu type='kvm' name='Opteron_G4' typename='Opteron_G4-x86_64-cpu' usable='no'>
-    <blocker name='sse4a'/>
-    <blocker name='misalignsse'/>
-    <blocker name='3dnowprefetch'/>
-    <blocker name='xop'/>
-    <blocker name='fma4'/>
-  </cpu>
-  <cpu type='kvm' name='Opteron_G3' typename='Opteron_G3-x86_64-cpu' usable='no'>
-    <blocker name='sse4a'/>
-    <blocker name='misalignsse'/>
-  </cpu>
-  <cpu type='kvm' name='Opteron_G2' typename='Opteron_G2-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='Opteron_G1' typename='Opteron_G1-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='Nehalem' typename='Nehalem-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='IvyBridge' typename='IvyBridge-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='Haswell' typename='Haswell-x86_64-cpu' usable='no'>
-    <blocker name='hle'/>
-    <blocker name='rtm'/>
-  </cpu>
-  <cpu type='kvm' name='Haswell-noTSX' typename='Haswell-noTSX-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='Conroe' typename='Conroe-x86_64-cpu' usable='yes'/>
-  <cpu type='kvm' name='Broadwell' typename='Broadwell-x86_64-cpu' usable='no'>
-    <blocker name='hle'/>
-    <blocker name='rtm'/>
-    <blocker name='rdseed'/>
-    <blocker name='adx'/>
-    <blocker name='smap'/>
-    <blocker name='3dnowprefetch'/>
-  </cpu>
-  <cpu type='kvm' name='Broadwell-noTSX' typename='Broadwell-noTSX-x86_64-cpu' usable='no'>
-    <blocker name='rdseed'/>
-    <blocker name='adx'/>
-    <blocker name='smap'/>
-    <blocker name='3dnowprefetch'/>
-  </cpu>
-  <cpu type='kvm' name='486' typename='486-x86_64-cpu' usable='yes'/>
   <cpu type='tcg' name='max' typename='max-x86_64-cpu' usable='yes'/>
   <cpu type='tcg' name='host' typename='host-x86_64-cpu' usable='no'>
     <blocker name='kvm'/>
...

--
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