[PATCH 11/12] Expose IOMMU and VFIO capabilities from virCaps

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

 



This piece of information may be useful for management application to
decide if a domain with a device passthrough can be started on given
host or not.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---

Notes:
    I'm not very happy with the element names, but they're the best I
    could come up with so far. If you have any better suggestion I am
    all ears.

 docs/formatcaps.html.in                      |  8 +++++++-
 docs/schemas/capability.rng                  | 12 ++++++++++++
 src/conf/capabilities.c                      |  4 ++++
 tests/capabilityschemadata/caps-qemu-kvm.xml |  2 ++
 tests/capabilityschemadata/caps-test.xml     |  2 ++
 tests/capabilityschemadata/caps-test2.xml    |  2 ++
 tests/capabilityschemadata/caps-test3.xml    |  2 ++
 tests/xencapsdata/xen-i686-pae-hvm.xml       |  2 ++
 tests/xencapsdata/xen-i686-pae.xml           |  2 ++
 tests/xencapsdata/xen-i686.xml               |  2 ++
 tests/xencapsdata/xen-ia64-be-hvm.xml        |  2 ++
 tests/xencapsdata/xen-ia64-be.xml            |  2 ++
 tests/xencapsdata/xen-ia64-hvm.xml           |  2 ++
 tests/xencapsdata/xen-ia64.xml               |  2 ++
 tests/xencapsdata/xen-ppc64.xml              |  2 ++
 tests/xencapsdata/xen-x86_64-hvm.xml         |  2 ++
 tests/xencapsdata/xen-x86_64.xml             |  2 ++
 17 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/docs/formatcaps.html.in b/docs/formatcaps.html.in
index d060a5b..eb8c905 100644
--- a/docs/formatcaps.html.in
+++ b/docs/formatcaps.html.in
@@ -35,6 +35,8 @@ BIOS you will see</p>
       &lt;suspend_disk/&gt;
       &lt;suspend_hybrid/&gt;
     &lt;power_management/&gt;
+    &lt;kvm&gt;true&lt;/kvm&gt;
+    &lt;vfio&gt;true&lt;/vfio&gt;
   &lt;/host&gt;</span>
 
   &lt;!-- xen-3.0-x86_64 --&gt;
@@ -78,7 +80,11 @@ BIOS you will see</p>
           Suspend-to-Disk (S4) and Hybrid-Suspend (a combination of S3
           and S4). In case the host does not support
           any such feature, then an empty &lt;power_management/&gt;
-          tag will be shown. </p>
+          tag will be shown. Then, two elements
+          <code>&lt;kvm/&gt;</code> and <code>&lt;vfio/&gt;</code>
+          expose the fact, whether the host supports legacy device
+          passthrough with IOMMU cooperation or newer Virtual function
+          I/O.</p>
         <p>The second block (in blue) indicates the paravirtualization
           support of the Xen support, you will see the os_type of xen
           to indicate a paravirtual kernel, then architecture
diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng
index d2d9776..3b378eb 100644
--- a/docs/schemas/capability.rng
+++ b/docs/schemas/capability.rng
@@ -48,6 +48,18 @@
       <zeroOrMore>
         <ref name='secmodel'/>
       </zeroOrMore>
+      <element name='kvm'>
+          <choice>
+              <value>false</value>
+              <value>true</value>
+          </choice>
+      </element>
+      <element name='vfio'>
+          <choice>
+              <value>false</value>
+              <value>true</value>
+          </choice>
+      </element>
     </element>
   </define>
 
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 9561ba3..a91f37b 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -901,6 +901,10 @@ virCapabilitiesFormatXML(virCapsPtr caps)
         virBufferAddLit(&buf, "</secmodel>\n");
     }
 
+    /* KVM and VFIO features */
+    virBufferAsprintf(&buf, "<kvm>%s</kvm>\n", caps->host.legacyKVMPassthrough ? "true" : "false");
+    virBufferAsprintf(&buf, "<vfio>%s</vfio>\n", caps->host.VFIOPassthrough ? "true" : "false");
+
     virBufferAdjustIndent(&buf, -2);
     virBufferAddLit(&buf, "</host>\n\n");
 
diff --git a/tests/capabilityschemadata/caps-qemu-kvm.xml b/tests/capabilityschemadata/caps-qemu-kvm.xml
index 55faa16..1a7fca9 100644
--- a/tests/capabilityschemadata/caps-qemu-kvm.xml
+++ b/tests/capabilityschemadata/caps-qemu-kvm.xml
@@ -28,6 +28,8 @@
       <baselabel type='kvm'>system_u:system_r:svirt_t:s0</baselabel>
       <baselabel type='qemu'>system_u:system_r:svirt_tcg_t:s0</baselabel>
     </secmodel>
+    <kvm>false</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
diff --git a/tests/capabilityschemadata/caps-test.xml b/tests/capabilityschemadata/caps-test.xml
index 64f9bb6..72bfafc 100644
--- a/tests/capabilityschemadata/caps-test.xml
+++ b/tests/capabilityschemadata/caps-test.xml
@@ -36,6 +36,8 @@
         </cell>
       </cells>
     </topology>
+    <kvm>true</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
diff --git a/tests/capabilityschemadata/caps-test2.xml b/tests/capabilityschemadata/caps-test2.xml
index a99c1b8..04c9b09 100644
--- a/tests/capabilityschemadata/caps-test2.xml
+++ b/tests/capabilityschemadata/caps-test2.xml
@@ -33,6 +33,8 @@
         <uri_transport>tcp</uri_transport>
       </uri_transports>
     </migration_features>
+    <kvm>false</kvm>
+    <vfio>true</vfio>
   </host>
 
   <guest>
diff --git a/tests/capabilityschemadata/caps-test3.xml b/tests/capabilityschemadata/caps-test3.xml
index 7e21f85..9374077 100644
--- a/tests/capabilityschemadata/caps-test3.xml
+++ b/tests/capabilityschemadata/caps-test3.xml
@@ -85,6 +85,8 @@
       <baselabel type='kvm'>107:107</baselabel>
       <baselabel type='qemu'>107:107</baselabel>
     </secmodel>
+    <kvm>true</kvm>
+    <vfio>true</vfio>
   </host>
 
 </capabilities>
diff --git a/tests/xencapsdata/xen-i686-pae-hvm.xml b/tests/xencapsdata/xen-i686-pae-hvm.xml
index 872e5f6..4f3c720 100644
--- a/tests/xencapsdata/xen-i686-pae-hvm.xml
+++ b/tests/xencapsdata/xen-i686-pae-hvm.xml
@@ -14,6 +14,8 @@
         <uri_transport>xenmigr</uri_transport>
       </uri_transports>
     </migration_features>
+    <kvm>false</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
diff --git a/tests/xencapsdata/xen-i686-pae.xml b/tests/xencapsdata/xen-i686-pae.xml
index 3dba6eb..f24306e 100644
--- a/tests/xencapsdata/xen-i686-pae.xml
+++ b/tests/xencapsdata/xen-i686-pae.xml
@@ -14,6 +14,8 @@
         <uri_transport>xenmigr</uri_transport>
       </uri_transports>
     </migration_features>
+    <kvm>false</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
diff --git a/tests/xencapsdata/xen-i686.xml b/tests/xencapsdata/xen-i686.xml
index 22d7685..b4f0a86 100644
--- a/tests/xencapsdata/xen-i686.xml
+++ b/tests/xencapsdata/xen-i686.xml
@@ -11,6 +11,8 @@
         <uri_transport>xenmigr</uri_transport>
       </uri_transports>
     </migration_features>
+    <kvm>false</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
diff --git a/tests/xencapsdata/xen-ia64-be-hvm.xml b/tests/xencapsdata/xen-ia64-be-hvm.xml
index 222de1d..951dbdd 100644
--- a/tests/xencapsdata/xen-ia64-be-hvm.xml
+++ b/tests/xencapsdata/xen-ia64-be-hvm.xml
@@ -11,6 +11,8 @@
         <uri_transport>xenmigr</uri_transport>
       </uri_transports>
     </migration_features>
+    <kvm>false</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
diff --git a/tests/xencapsdata/xen-ia64-be.xml b/tests/xencapsdata/xen-ia64-be.xml
index 017816c..0b90fea 100644
--- a/tests/xencapsdata/xen-ia64-be.xml
+++ b/tests/xencapsdata/xen-ia64-be.xml
@@ -11,6 +11,8 @@
         <uri_transport>xenmigr</uri_transport>
       </uri_transports>
     </migration_features>
+    <kvm>false</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
diff --git a/tests/xencapsdata/xen-ia64-hvm.xml b/tests/xencapsdata/xen-ia64-hvm.xml
index 33c4946..6b1780e 100644
--- a/tests/xencapsdata/xen-ia64-hvm.xml
+++ b/tests/xencapsdata/xen-ia64-hvm.xml
@@ -11,6 +11,8 @@
         <uri_transport>xenmigr</uri_transport>
       </uri_transports>
     </migration_features>
+    <kvm>false</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
diff --git a/tests/xencapsdata/xen-ia64.xml b/tests/xencapsdata/xen-ia64.xml
index 82ce965..1bb58e9 100644
--- a/tests/xencapsdata/xen-ia64.xml
+++ b/tests/xencapsdata/xen-ia64.xml
@@ -11,6 +11,8 @@
         <uri_transport>xenmigr</uri_transport>
       </uri_transports>
     </migration_features>
+    <kvm>false</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
diff --git a/tests/xencapsdata/xen-ppc64.xml b/tests/xencapsdata/xen-ppc64.xml
index 91401b9..fa61351 100644
--- a/tests/xencapsdata/xen-ppc64.xml
+++ b/tests/xencapsdata/xen-ppc64.xml
@@ -11,6 +11,8 @@
         <uri_transport>xenmigr</uri_transport>
       </uri_transports>
     </migration_features>
+    <kvm>false</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
diff --git a/tests/xencapsdata/xen-x86_64-hvm.xml b/tests/xencapsdata/xen-x86_64-hvm.xml
index 8de8cf4..7aece30 100644
--- a/tests/xencapsdata/xen-x86_64-hvm.xml
+++ b/tests/xencapsdata/xen-x86_64-hvm.xml
@@ -14,6 +14,8 @@
         <uri_transport>xenmigr</uri_transport>
       </uri_transports>
     </migration_features>
+    <kvm>false</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
diff --git a/tests/xencapsdata/xen-x86_64.xml b/tests/xencapsdata/xen-x86_64.xml
index 0c3279b..3bbd40c 100644
--- a/tests/xencapsdata/xen-x86_64.xml
+++ b/tests/xencapsdata/xen-x86_64.xml
@@ -14,6 +14,8 @@
         <uri_transport>xenmigr</uri_transport>
       </uri_transports>
     </migration_features>
+    <kvm>false</kvm>
+    <vfio>false</vfio>
   </host>
 
   <guest>
-- 
1.9.3

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