[PATCH v6 07/25] iommufd/access: Add internal APIs for HW queue to use

Jason Gunthorpe jgg at nvidia.com
Tue Jun 17 04:55:15 PDT 2025


On Tue, Jun 17, 2025 at 12:23:20PM +0800, Baolu Lu wrote:
> On 6/17/25 10:25, Nicolin Chen wrote:
> > > >   struct iommufd_eventq {
> > > >   	struct iommufd_object obj;
> > > >   	struct iommufd_ctx *ictx;
> > > > diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
> > > > index 9293722b9cff..ad33f1e41a24 100644
> > > > --- a/drivers/iommu/iommufd/device.c
> > > > +++ b/drivers/iommu/iommufd/device.c
> > > > @@ -1084,7 +1084,39 @@ void iommufd_access_destroy_object(struct iommufd_object *obj)
> > > >   	if (access->ioas)
> > > >   		WARN_ON(iommufd_access_change_ioas(access, NULL));
> > > >   	mutex_unlock(&access->ioas_lock);
> > > > -	iommufd_ctx_put(access->ictx);
> > > > +	if (access->ops)
> > > > +		iommufd_ctx_put(access->ictx);
> > > I was hoping we could null the ictx to signal internal? That didn't
> > > work out?
> > access->ictx should be NULL for internal. It should have been:
> > +	if (access->ictx)
> > +		iommufd_ctx_put(access->ictx);
> 
> access->ictx could be treated as user ownership token. If it's NULL,
> there is no user ownership, indicating it's owned by the kernel. This is
> the concept here?

Yes

Jason



More information about the linux-arm-kernel mailing list