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

[libvirt] [RFC PATCH v2 14/18] qemu: namespace: Hook up the discovery of mdevs into the namespace code



Again, as for all the other hostdev device types, make sure that the
/dev/vfio/<mdev_iommu_group> device will be added to the qemu namespace.

Signed-off-by: Erik Skultety <eskultet redhat com>
---
 src/qemu/qemu_domain.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c4d7a47..eb86385 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6852,10 +6852,12 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
     virDomainHostdevSubsysPCIPtr pcisrc = &dev->source.subsys.u.pci;
     virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
     virDomainHostdevSubsysSCSIVHostPtr hostsrc = &dev->source.subsys.u.scsi_host;
+    virDomainHostdevSubsysMediatedDevPtr mdevsrc = &dev->source.subsys.u.mdev;
     virPCIDevicePtr pci = NULL;
     virUSBDevicePtr usb = NULL;
     virSCSIDevicePtr scsi = NULL;
     virSCSIVHostDevicePtr host = NULL;
+    virMediatedDevicePtr mdev = NULL;
     char *tmpPath = NULL;
     bool freeTmpPath = false;
 
@@ -6930,6 +6932,14 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
         }
 
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+            if (!(mdev = virMediatedDeviceNew(mdevsrc->uuidstr)))
+                goto cleanup;
+
+            if (!(tmpPath = virMediatedDeviceGetIOMMUGroupDev(mdev)))
+                goto cleanup;
+
+            freeTmpPath = true;
+            break;
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
             break;
         }
@@ -6950,6 +6960,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
     virUSBDeviceFree(usb);
     virSCSIDeviceFree(scsi);
     virSCSIVHostDeviceFree(host);
+    virMediatedDeviceFree(mdev);
     if (freeTmpPath)
         VIR_FREE(tmpPath);
     return ret;
-- 
2.10.2


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