[Intel-gfx] [PATCH v4 6/9] iommufd: Reserved -1 in the iommufd xarray

Jason Gunthorpe jgg at nvidia.com
Thu Apr 27 11:55:19 UTC 2023


On Thu, Apr 27, 2023 at 07:09:38AM +0000, Liu, Yi L wrote:
> > > @@ -50,7 +53,7 @@ struct iommufd_object *_iommufd_object_alloc(struct
> > > iommufd_ctx *ictx,
> > >  	 * before calling iommufd_object_finalize().
> > >  	 */
> > >  	rc = xa_alloc(&ictx->objects, &obj->id, XA_ZERO_ENTRY,
> > > -		      xa_limit_32b, GFP_KERNEL_ACCOUNT);
> > > +		      iommufd_xa_limit_32b, GFP_KERNEL_ACCOUNT);
> > 
> > Just direct use XA_LIMIT() here.
> 
> Ok.
> 
> > btw do we need a contract so vfio can learn 0 and -1 are reserved or
> > fine to have a fixed assumption in later patches?
> 
> I doubt how to do it. ☹ @Jason? What about your opinion?

It is probably fine to use xa_limit_31b and just say that -ve values
are reserved in a comment near the define for 0

Jason


More information about the Intel-gfx mailing list