Re: [Intel-gfx] [PATCH v12 21/24] vfio: Determine noiommu device in __vfio_register_dev()

Tian, Kevin
2023-06-14T06:20:57Z

> From: Liu, Yi L <yi.l.liu@intel.com>
> Sent: Wednesday, June 14, 2023 2:14 PM
>
>
> > With that I think Jason's suggestion is to lift that test into main.c:
> >
> > int vfio_register_group_dev(struct vfio_device *device)
> > {
> > /*
> > * VFIO always sets IOMMU_CACHE because we offer no way for
> userspace to
> > * restore cache coherency. It has to be checked here because it is
> only
> > * valid for cases where we are using iommu groups.
> > */
> > if (type == VFIO_IOMMU && !vfio_device_is_noiommu(device) &&
> > !device_iommu_capable(dev, IOMMU_CAP_CACHE_COHERENCY))
> > return ERR_PTR(-EINVAL);
>
> vfio_device_is_noiommu() needs to be called after vfio_device_set_group().
> Otherwise, it's always false. So still needs to call it in the
> __vfio_register_dev().

yes