Re: [PATCH v6 06/25] iommufd/access: Allow access->ops to be NULL for internal use

From: Pranjal Shrivastava
Date: Thu Jun 19 2025 - 05:17:36 EST


On Mon, Jun 16, 2025 at 07:21:28PM -0700, Nicolin Chen wrote:
> On Mon, Jun 16, 2025 at 10:33:05AM -0300, Jason Gunthorpe wrote:
> > On Sat, Jun 14, 2025 at 12:14:31AM -0700, Nicolin Chen wrote:
> > > @@ -1321,7 +1328,7 @@ int iommufd_access_pin_pages(struct iommufd_access *access, unsigned long iova,
> > >
> > > /* Driver's ops don't support pin_pages */
> > > if (IS_ENABLED(CONFIG_IOMMUFD_TEST) &&
> > > - WARN_ON(access->iova_alignment != PAGE_SIZE || !access->ops->unmap))
> > > + WARN_ON(access->iova_alignment != PAGE_SIZE))
> > > return -EINVAL;
> >
> > I don't want to loose this check, continuing blocking mdevs is still
> > important. Only the internal access should be able to use this
> > mechanism.
>
> OK. So, it probably should be
> if (IS_ENABLED(CONFIG_IOMMUFD_TEST) &&
> WARN_ON(access->iova_alignment != PAGE_SIZE ||
> (access->ictx && !access->ops->unmap))
>

Nit: Probably worth mentioning in a comment that access->ops shouldn't
be NULL during selftests and hence we avoid checking for !access->ops?

If you feel it's too verbose, you can let be as well.

Reviewed-by: Pranjal Shrivastava <praan@xxxxxxxxxx>

> Thanks
> Nicolin