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 <eskul...@redhat.com>
---
 src/qemu/qemu_domain.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 3006d78..afc7d07 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6824,10 +6824,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;
 
@@ -6902,6 +6904,15 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
         }
 
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+            if (!(mdev = virMediatedDeviceNew(&mdevsrc->addr,
+                                              mdevsrc->uuidstr)))
+                goto cleanup;
+
+            if (!(tmpPath = virMediatedDeviceGetIOMMUGroupDev(mdev)))
+                goto cleanup;
+
+            freeTmpPath = true;
+            break;
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
             break;
         }
@@ -6922,6 +6933,7 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev,
     virUSBDeviceFree(usb);
     virSCSIDeviceFree(scsi);
     virSCSIVHostDeviceFree(host);
+    virMediatedDeviceFree(mdev);
     if (freeTmpPath)
         VIR_FREE(tmpPath);
     return ret;
-- 
2.10.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to