[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR11MB527656492CD69CA4EA0EC7338C852@BN9PR11MB5276.namprd11.prod.outlook.com>
Date: Thu, 24 Apr 2025 07:37:16 +0000
From: "Tian, Kevin" <kevin.tian@...el.com>
To: Lu Baolu <baolu.lu@...ux.intel.com>, Joerg Roedel <joro@...tes.org>, "Will
Deacon" <will@...nel.org>, Robin Murphy <robin.murphy@....com>, "Jason
Gunthorpe" <jgg@...pe.ca>
CC: "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 1/3] iommu/vt-d: Use ida to manage domain id
> From: Lu Baolu <baolu.lu@...ux.intel.com>
> Sent: Wednesday, April 23, 2025 11:10 AM
>
> static void free_dmar_iommu(struct intel_iommu *iommu)
> {
> - if (iommu->domain_ids) {
> - bitmap_free(iommu->domain_ids);
> - iommu->domain_ids = NULL;
> - }
> + ida_destroy(&iommu->domain_ida);
since ida_init() is in alloc_iommu() now, the destroy can be
moved to free_iommu().
> @@ -1399,14 +1356,13 @@ int domain_attach_iommu(struct dmar_domain
> *domain, struct intel_iommu *iommu)
> return 0;
> }
>
> - ndomains = cap_ndoms(iommu->cap);
> - num = find_first_zero_bit(iommu->domain_ids, ndomains);
> - if (num >= ndomains) {
> + num = ida_alloc_range(&iommu->domain_ida, FLPT_DEFAULT_DID +
> 1,
> + cap_ndoms(iommu->cap) - 1, GFP_ATOMIC);
let's define a macro e.g. FIRST_DID for min.
Reviewed-by: Kevin Tian <kevin.tian@...el.com>
Powered by blists - more mailing lists