[Intel-gfx] [PATCH v4 7/9] vfio-iommufd: Add helper to retrieve iommufd_ctx and devid for vfio_device
Liu, Yi L
yi.l.liu at intel.com
Thu Apr 27 07:15:31 UTC 2023
> From: Tian, Kevin <kevin.tian at intel.com>
> Sent: Thursday, April 27, 2023 2:46 PM
>
> > From: Yi Liu
> > Sent: Wednesday, April 26, 2023 10:54 PM
> > +
> > +/*
> > + * Return devid for devices that have been bound with iommufd,
> > + * returns 0 if not bound yet.
> > + */
> > +u32 vfio_iommufd_physical_devid(struct vfio_device *vdev)
> > +{
> > + if (WARN_ON(!vdev->iommufd_device && !vdev->iommufd_access))
> > + return 0;
>
> is WARN_ON too restrictive?
This originated from a comment from Eric[1]. At that time, this helper is
void type, hence there is no message when there is no devid. Now, this returns
0 if the device is not bound. Maybe checking it in the caller and warn on
there?
[1] https://lore.kernel.org/kvm/702c2883-1d51-b609-1e99-337295e6e307@redhat.com/
Regards,
Yi Liu
More information about the Intel-gfx
mailing list