> From: Jason Gunthorpe <jgg@xxxxxxxxxx> > Sent: Wednesday, September 22, 2021 9:32 PM > > On Wed, Sep 22, 2021 at 12:51:38PM +0000, Liu, Yi L wrote: > > > From: Jason Gunthorpe <jgg@xxxxxxxxxx> > > > Sent: Wednesday, September 22, 2021 1:45 AM > > > > > [...] > > > > diff --git a/drivers/iommu/iommufd/iommufd.c > > > b/drivers/iommu/iommufd/iommufd.c > > > > index 641f199f2d41..4839f128b24a 100644 > > > > +++ b/drivers/iommu/iommufd/iommufd.c > > > > @@ -24,6 +24,7 @@ > > > > struct iommufd_ctx { > > > > refcount_t refs; > > > > struct mutex lock; > > > > + struct xarray ioasid_xa; /* xarray of ioasids */ > > > > struct xarray device_xa; /* xarray of bound devices */ > > > > }; > > > > > > > > @@ -42,6 +43,16 @@ struct iommufd_device { > > > > u64 dev_cookie; > > > > }; > > > > > > > > +/* Represent an I/O address space */ > > > > +struct iommufd_ioas { > > > > + int ioasid; > > > > > > xarray id's should consistently be u32s everywhere. > > > > sure. just one more check, this id is supposed to be returned to > > userspace as the return value of ioctl(IOASID_ALLOC). That's why > > I chose to use "int" as its prototype to make it aligned with the > > return type of ioctl(). Based on this, do you think it's still better > > to use "u32" here? > > I suggest not using the return code from ioctl to exchange data.. The > rest of the uAPI uses an in/out struct, everything should do > that consistently. got it. Thanks, Yi Liu