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 c0f060b0a3..d1ac1d641b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6999,10 +6999,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;
@@ -7103,6 +7105,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;
}
@@ -7152,6 +7165,7 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
virUSBDeviceFree(usb);
virSCSIDeviceFree(scsi);
virSCSIVHostDeviceFree(host);
+ virMediatedDeviceFree(mdev);
if (freeTmpPath)
VIR_FREE(tmpPath);
return ret;
--
2.12.1