]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_hostdev: Introduce qemuHostdevNeedsVFIO()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 17 Sep 2019 07:33:28 +0000 (09:33 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 21 Oct 2019 11:50:24 +0000 (13:50 +0200)
There are two types of host devices that require /dev/vfio/vfio
access:

  1) PCI devices with VFIO backend
  2) Mediated devices

Introduce a simple helper that returns true if passed @hostdev
falls in either of the categories.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
src/qemu/qemu_hostdev.c
src/qemu/qemu_hostdev.h

index af41c3267972ef5bfc66cf38467c9382b964721e..ebbca817b8a3ca48b5ca7fb61a03816218252d40 100644 (file)
@@ -118,6 +118,15 @@ qemuHostdevUpdateActiveDomainDevices(virQEMUDriverPtr driver,
     return 0;
 }
 
+
+bool
+qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev)
+{
+    return virHostdevIsVFIODevice(hostdev) ||
+        virHostdevIsMdevDevice(hostdev);
+}
+
+
 bool
 qemuHostdevHostSupportsPassthroughVFIO(void)
 {
index e99c204961a8877f32de9bada855249794491e33..536069fe8a7be573727faee85ba54f25c638ace5 100644 (file)
@@ -24,6 +24,8 @@
 #include "qemu_conf.h"
 #include "domain_conf.h"
 
+bool qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev);
+
 bool qemuHostdevHostSupportsPassthroughVFIO(void);
 
 int qemuHostdevUpdateActiveMediatedDevices(virQEMUDriverPtr driver,