Re: [PATCH v10 2/7] iommu: Move global PASID allocation from SVA to core
From: Jacob Pan
Date: Thu Jul 13 2023 - 11:55:17 EST
Hi Kevin,
On Thu, 13 Jul 2023 07:42:01 +0000, "Tian, Kevin" <kevin.tian@xxxxxxxxx>
wrote:
> > From: Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx>
> > Sent: Thursday, July 13, 2023 12:34 AM
> >
> > }
> > +
> > +ioasid_t iommu_alloc_global_pasid_dev(struct device *dev)
> > +{
> > + int ret;
> > +
> > + /* max_pasids == 0 means that the device does not support
> > PASID */
> > + if (!dev->iommu->max_pasids)
> > + return IOMMU_PASID_INVALID;
> > +
> > + /*
> > + * max_pasids is set up by vendor driver based on number of
> > PASID bits
> > + * supported but the IDA allocation is inclusive.
> > + */
> > + ret = ida_alloc_range(&iommu_global_pasid_ida,
> > IOMMU_FIRST_GLOBAL_PASID,
> > + dev->iommu->max_pasids - 1, GFP_KERNEL);
> > + return ret < 0 ? IOMMU_PASID_INVALID : ret;
> > +}
> > +EXPORT_SYMBOL_GPL(iommu_alloc_global_pasid_dev);
>
> nit. Just call it iommu_alloc_global_pasid.
will do. it will be symmetric.
Thanks,
Jacob