]> xenbits.xensource.com Git - libvirt.git/commitdiff
capabilities: Extend capabilities with iommu_support
authorFilip Alac <filipalac@gmail.com>
Fri, 1 Jun 2018 08:15:59 +0000 (10:15 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 5 Jun 2018 06:33:13 +0000 (08:33 +0200)
Signed-off-by: Filip Alac <filipalac@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
15 files changed:
docs/schemas/capability.rng
src/conf/capabilities.c
src/conf/capabilities.h
src/libvirt_private.syms
src/qemu/qemu_capabilities.c
src/test/test_driver.c
tests/qemucaps2xmldata/all_1.6.0-1.xml
tests/qemucaps2xmldata/nodisksnapshot_1.6.0-1.xml
tests/vircaps2xmldata/vircaps-aarch64-basic.xml
tests/vircaps2xmldata/vircaps-x86_64-basic.xml
tests/vircaps2xmldata/vircaps-x86_64-caches.xml
tests/vircaps2xmldata/vircaps-x86_64-resctrl-cdp.xml
tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx-twocaches.xml
tests/vircaps2xmldata/vircaps-x86_64-resctrl-skx.xml
tests/vircaps2xmldata/vircaps-x86_64-resctrl.xml

index 66c5de62e5168ca863dbcf7be8367b8581faf9db..52164d5ecb8b869cace2739b4b7ad62a0c5d7e3c 100644 (file)
@@ -39,6 +39,9 @@
       <optional>
         <ref name='power_management'/>
       </optional>
+      <optional>
+        <ref name='iommu_support'/>
+      </optional>
       <optional>
         <ref name='migration'/>
       </optional>
     </element>
   </define>
 
+  <define name='iommu_support'>
+    <element name='iommu'>
+      <optional>
+        <attribute name='support'>
+          <ref name='virYesNo'/>
+        </attribute>
+      </optional>
+    </element>
+  </define>
+
   <define name='migration'>
     <element name='migration_features'>
       <optional>
index dd2fc77f91314ec916c7b33d02a67b05a9a49d45..d5f6f007300ad5465e870afa84ddb46ee0d29a7f 100644 (file)
@@ -1025,6 +1025,9 @@ virCapabilitiesFormatXML(virCapsPtr caps)
         virBufferAddLit(&buf, "<power_management/>\n");
     }
 
+    virBufferAsprintf(&buf, "<iommu support='%s'/>\n",
+                      caps->host.iommu  ? "yes" : "no");
+
     if (caps->host.offlineMigrate) {
         virBufferAddLit(&buf, "<migration_features>\n");
         virBufferAdjustIndent(&buf, 2);
@@ -1743,3 +1746,10 @@ virCapabilitiesInitCaches(virCapsPtr caps)
     virBitmapFree(cpus);
     return ret;
 }
+
+
+void
+virCapabilitiesHostInitIOMMU(virCapsPtr caps)
+{
+    caps->host.iommu = virHostHasIOMMU();
+}
index f0a06a24dfd271826e3f324a58ef0bb415bd5cb7..fe1b9ea45539efffebda20d1fe983cb95fc0ed00 100644 (file)
@@ -183,6 +183,7 @@ struct _virCapsHost {
     int nPagesSize;             /* size of pagesSize array */
     unsigned int *pagesSize;    /* page sizes support on the system */
     unsigned char host_uuid[VIR_UUID_BUFLEN];
+    bool iommu;
 };
 
 typedef int (*virDomainDefNamespaceParse)(xmlDocPtr, xmlNodePtr,
@@ -327,4 +328,6 @@ void virCapsHostCacheBankFree(virCapsHostCacheBankPtr ptr);
 
 int virCapabilitiesInitCaches(virCapsPtr caps);
 
+void virCapabilitiesHostInitIOMMU(virCapsPtr caps);
+
 #endif /* __VIR_CAPABILITIES_H */
index 9b9970163f57e387246f02d39f0bb91b0f8aa109..206107befd9065b1bc0e9b792e39ac77ebe9a4ce 100644 (file)
@@ -58,6 +58,7 @@ virCapabilitiesFreeMachines;
 virCapabilitiesFreeNUMAInfo;
 virCapabilitiesGetCpusForNodemask;
 virCapabilitiesGetNodeInfo;
+virCapabilitiesHostInitIOMMU;
 virCapabilitiesHostSecModelAddBaseLabel;
 virCapabilitiesInitCaches;
 virCapabilitiesInitNUMA;
index b8764eacd81f2e6a1f89b53af6e6d6051a1929c1..26969ed3dcad4b58c22e4d835acd4abff09507e9 100644 (file)
@@ -948,6 +948,9 @@ virQEMUCapsInit(virFileCachePtr cache)
     if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0)
         VIR_WARN("Failed to get host power management capabilities");
 
+    /* Add IOMMU info */
+    virCapabilitiesHostInitIOMMU(caps);
+
     /* Add huge pages info */
     if (virCapabilitiesInitPages(caps) < 0)
         VIR_WARN("Failed to get pages info");
index a43b9781eb3b1d15fd2c54a63eac3b9fc3d42eec..89121d4220443dab3cd8f727abc73959a0b50ec1 100644 (file)
@@ -322,6 +322,8 @@ testBuildCapabilities(virConnectPtr conn)
     if (virCapabilitiesAddHostFeature(caps, "nonpae") < 0)
         goto error;
 
+    virCapabilitiesHostInitIOMMU(caps);
+
     if (VIR_ALLOC_N(caps->host.pagesSize, 4) < 0)
         goto error;
 
index 84d60008d826a5b1f40afe0714a21eac048b543d..efe86b9a12b2d9dfda41fa9a83e4dc3630fe80e6 100644 (file)
@@ -5,6 +5,7 @@
       <arch>i686</arch>
     </cpu>
     <power_management/>
+    <iommu support='no'/>
   </host>
 
   <guest>
index 28762c263bbf4cad2d70eb2afc6f5a7e65008f40..981344e6fd9d99be3d358218e27efd290647b6ac 100644 (file)
@@ -5,6 +5,7 @@
       <arch>i686</arch>
     </cpu>
     <power_management/>
+    <iommu support='no'/>
   </host>
 
   <guest>
index ce156a364e1ce9daf910af0e745ccad589bdf2a9..50466f9162aefd6926796f8f7912759999a01feb 100644 (file)
@@ -5,6 +5,7 @@
       <arch>aarch64</arch>
     </cpu>
     <power_management/>
+    <iommu support='no'/>
     <migration_features>
     </migration_features>
     <topology>
index 1f2c6659a5cb5f25d33622662794bf8e416437dc..e7be6def3ebbea14162de1643c9afe166013bbba 100644 (file)
@@ -5,6 +5,7 @@
       <arch>x86_64</arch>
     </cpu>
     <power_management/>
+    <iommu support='no'/>
     <topology>
       <cells num='4'>
         <cell id='0'>
index 0c6f3769a2a761a8c95accd4a762bb702f4d47f7..ca671a1640b1b913d2fe811065ffd00ffd09d107 100644 (file)
@@ -5,6 +5,7 @@
       <arch>x86_64</arch>
     </cpu>
     <power_management/>
+    <iommu support='no'/>
     <migration_features>
       <live/>
     </migration_features>
index 443917c62d69f0f1fe2f2ed91e8b941306406ea1..1d3df318c5b3a3d4212180b6de58d18b3633ec4e 100644 (file)
@@ -5,6 +5,7 @@
       <arch>x86_64</arch>
     </cpu>
     <power_management/>
+    <iommu support='no'/>
     <migration_features>
       <live/>
     </migration_features>
index d18665b24fd8b850d06ce1e4df2d159cba93cdad..44c1042afe3a31a750886a60fead88692a4302fb 100644 (file)
@@ -5,6 +5,7 @@
       <arch>x86_64</arch>
     </cpu>
     <power_management/>
+    <iommu support='no'/>
     <migration_features>
       <live/>
     </migration_features>
index 0cd25e59a9e0a5cd72503453fc73617fcb94c575..8382a26c7a4c4e2be5a298f71e60ccc617407200 100644 (file)
@@ -5,6 +5,7 @@
       <arch>x86_64</arch>
     </cpu>
     <power_management/>
+    <iommu support='no'/>
     <migration_features>
       <live/>
     </migration_features>
index 7629259294d69b66f383201bd7da7895aed495d9..4840614e86aa912bd6dfd7aa56be75d1a23658ee 100644 (file)
@@ -5,6 +5,7 @@
       <arch>x86_64</arch>
     </cpu>
     <power_management/>
+    <iommu support='no'/>
     <migration_features>
       <live/>
     </migration_features>