Re: [PATCH 1/3] iommu/vt-d: Use ida to manage domain id

From: Baolu Lu
Date: Thu Apr 24 2025 - 04:16:48 EST


On 4/23/2025 11:10 AM, Lu Baolu wrote:
@@ -2042,7 +1998,7 @@ static int copy_context_table(struct intel_iommu *iommu,
did = context_domain_id(&ce);
if (did >= 0 && did < cap_ndoms(iommu->cap))
- set_bit(did, iommu->domain_ids);
+ ida_alloc_range(&iommu->domain_ida, did, did + 1, GFP_KERNEL);

ida allocation range is inclusive, thus here it should be,

ida_alloc_range(&iommu->domain_ida, did, did, GFP_KERNEL);

set_context_copied(iommu, bus, devfn);
new_ce[idx] = ce;

Thanks,
baolu