[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB527619C7106BE91167B9EC118C37A@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Thu, 13 Jul 2023 07:42:01 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Jacob Pan <jacob.jun.pan@...ux.intel.com>,
LKML <linux-kernel@...r.kernel.org>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
Lu Baolu <baolu.lu@...ux.intel.com>,
Joerg Roedel <joro@...tes.org>,
Jean-Philippe Brucker <jean-philippe@...aro.com>,
"Robin Murphy" <robin.murphy@....com>
CC: Jason Gunthorpe <jgg@...dia.com>, Will Deacon <will@...nel.org>,
"Liu, Yi L" <yi.l.liu@...el.com>,
"Yu, Fenghua" <fenghua.yu@...el.com>,
"Luck, Tony" <tony.luck@...el.com>
Subject: RE: [PATCH v10 2/7] iommu: Move global PASID allocation from SVA to
core
> From: Jacob Pan <jacob.jun.pan@...ux.intel.com>
> 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.
Powered by blists - more mailing lists