As goes for all the other hostdev device types, grant the qemu process
access to /dev/vfio/<mediated_device_iommu_group>.
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/qemu/qemu_domain.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 11157184b7..da59652dc0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6957,10 +6957,12 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
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;
bool includeVFIO = false;
@@ -7061,6 +7063,17 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
}
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+ if (!(mdev = virMediatedDeviceNew(mdevsrc->uuidstr,
+ mdevsrc->model)))
+ goto cleanup;
+
+ if (!(tmpPath = virMediatedDeviceGetIOMMUGroupDev(mdev)))
+ goto cleanup;
+
+ freeTmpPath = true;
+ includeVFIO = true;
+ perm = VIR_CGROUP_DEVICE_RW;
+ break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
break;
}
@@ -7110,6 +7123,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
virUSBDeviceFree(usb);
virSCSIDeviceFree(scsi);
virSCSIVHostDeviceFree(host);
+ virMediatedDeviceFree(mdev);
if (freeTmpPath)
VIR_FREE(tmpPath);
return ret;
--
2.12.0