[PATCH 01/10] hypervisor: move HostdevNeedsVFIO to hypervisor

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

 



Move HostdevNeedsVFIO method to hypervisor to be reused between qemu
and ch drivers.

Signed-off-by: Praveen K Paladugu <prapal@xxxxxxxxxxxxxxxxxxx>
---
 src/hypervisor/virhostdev.c | 7 +++++++
 src/hypervisor/virhostdev.h | 3 +++
 src/libvirt_private.syms    | 1 +
 src/qemu/qemu_cgroup.c      | 5 +++--
 src/qemu/qemu_hostdev.c     | 8 --------
 src/qemu/qemu_hostdev.h     | 2 --
 src/qemu/qemu_namespace.c   | 2 +-
 7 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
index 185ec2ca50..4b06e74894 100644
--- a/src/hypervisor/virhostdev.c
+++ b/src/hypervisor/virhostdev.c
@@ -2512,3 +2512,10 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManager *hostdev_mgr,
     }
     goto cleanup;
 }
+
+bool
+virHostdevNeedsVFIO(const virDomainHostdevDef *hostdev)
+{
+    return virHostdevIsPCIDevice(hostdev) ||
+        virHostdevIsMdevDevice(hostdev);
+}
diff --git a/src/hypervisor/virhostdev.h b/src/hypervisor/virhostdev.h
index 22ec3068db..b9e6108816 100644
--- a/src/hypervisor/virhostdev.h
+++ b/src/hypervisor/virhostdev.h
@@ -232,3 +232,6 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManager *hostdev_mgr,
                                   const char *dom_name,
                                   virDomainDiskDef **disks,
                                   size_t ndisks);
+
+bool
+virHostdevNeedsVFIO(const virDomainHostdevDef *hostdev);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index e09fb98596..cca071f866 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1670,6 +1670,7 @@ virCloseCallbacksDomainRunForConn;
 # hypervisor/virhostdev.h
 virHostdevFindUSBDevice;
 virHostdevManagerGetDefault;
+virHostdevNeedsVFIO;
 virHostdevPCINodeDeviceDetach;
 virHostdevPCINodeDeviceReAttach;
 virHostdevPCINodeDeviceReset;
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 23b7e6b4e8..be4b9a38ff 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -32,6 +32,7 @@
 #include "virfile.h"
 #include "virdevmapper.h"
 #include "virglibutil.h"
+#include "virhostdev.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
@@ -481,7 +482,7 @@ qemuSetupHostdevCgroup(virDomainObj *vm,
         return -1;
     }
 
-    if (qemuHostdevNeedsVFIO(dev) &&
+    if (virHostdevNeedsVFIO(dev) &&
         qemuCgroupAllowDevicePath(vm, QEMU_DEV_VFIO,
                                   VIR_CGROUP_DEVICE_RW, false) < 0) {
         return -1;
@@ -530,7 +531,7 @@ qemuTeardownHostdevCgroup(virDomainObj *vm,
         return -1;
     }
 
-    if (qemuHostdevNeedsVFIO(dev) &&
+    if (virHostdevNeedsVFIO(dev) &&
         !qemuDomainNeedsVFIO(vm->def) &&
         qemuCgroupDenyDevicePath(vm, QEMU_DEV_VFIO,
                                  VIR_CGROUP_DEVICE_RWM, false) < 0) {
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index 15b543dbff..f25ccaf1a4 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -130,14 +130,6 @@ qemuHostdevUpdateActiveDomainDevices(virQEMUDriver *driver,
 }
 
 
-bool
-qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev)
-{
-    return virHostdevIsPCIDevice(hostdev) ||
-        virHostdevIsMdevDevice(hostdev);
-}
-
-
 bool
 qemuHostdevHostSupportsPassthroughVFIO(void)
 {
diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h
index 3e9adc57a9..bbf7bb11e7 100644
--- a/src/qemu/qemu_hostdev.h
+++ b/src/qemu/qemu_hostdev.h
@@ -23,8 +23,6 @@
 
 #include "qemu_conf.h"
 
-bool qemuHostdevNeedsVFIO(const virDomainHostdevDef *hostdev);
-
 bool qemuHostdevHostSupportsPassthroughVFIO(void);
 
 int qemuHostdevUpdateActiveNVMeDisks(virQEMUDriver *driver,
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
index bbe3d5a1f7..5c92b5547e 100644
--- a/src/qemu/qemu_namespace.c
+++ b/src/qemu/qemu_namespace.c
@@ -339,7 +339,7 @@ qemuDomainSetupHostdev(virDomainObj *vm,
     if (path)
         *paths = g_slist_prepend(*paths, g_steal_pointer(&path));
 
-    if (qemuHostdevNeedsVFIO(hostdev) &&
+    if (virHostdevNeedsVFIO(hostdev) &&
         (!hotplug || !qemuDomainNeedsVFIO(vm->def)))
         *paths = g_slist_prepend(*paths, g_strdup(QEMU_DEV_VFIO));
 
-- 
2.44.0



[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