Re: [PATCH v4 10/14] qemu: cgroup: Adjust cgroups' logic to allow mediated devices

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

 



On 03/22/2017 11:27 AM, Erik Skultety wrote:
> 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@xxxxxxxxxx>
> ---
>  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;
> 


Yep. Faithful recreation of what's done to PCI devices.

ACK.

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



[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