summaryrefslogtreecommitdiff
path: root/drivers/iommu/amd/init.c
diff options
context:
space:
mode:
authorSairaj Kodilkar <sarunkod@amd.com>2025-11-21 14:41:16 +0530
committerJoerg Roedel <joerg.roedel@amd.com>2025-12-19 11:23:49 +0100
commitc7fe9384c85d31e35bb61574d7a742ba59fb27c3 (patch)
treedbd0b7c85d36bbb768b471a5b95f368635d58464 /drivers/iommu/amd/init.c
parentc2e8dc1222c2136e714d5d972dce7e64924e4ed8 (diff)
amd/iommu: Make protection domain ID functions non-static
So that both iommu.c and init.c can utilize them. Also define a new function 'pdom_id_destroy()' to destroy 'pdom_ids' instead of directly calling ida functions. Signed-off-by: Sairaj Kodilkar <sarunkod@amd.com> Reviewed-by: Vasant Hegde <vasant.hegde@amd.com> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/iommu/amd/init.c')
-rw-r--r--drivers/iommu/amd/init.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 106ee3cf3038..384c90b4f90a 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -1142,7 +1142,6 @@ static bool __reuse_device_table(struct amd_iommu *iommu)
u16 dom_id;
bool dte_v;
u64 entry;
- int ret;
/* Each IOMMU use separate device table with the same size */
lo = readl(iommu->mmio_base + MMIO_DEV_TABLE_OFFSET);
@@ -1189,8 +1188,7 @@ static bool __reuse_device_table(struct amd_iommu *iommu)
* are multiple devices present in the same domain,
* hence check only for -ENOMEM.
*/
- ret = ida_alloc_range(&pdom_ids, dom_id, dom_id, GFP_KERNEL);
- if (ret == -ENOMEM)
+ if (amd_iommu_pdom_id_reserve(dom_id, GFP_KERNEL) == -ENOMEM)
return false;
}
@@ -3148,8 +3146,7 @@ static bool __init check_ioapic_information(void)
static void __init free_dma_resources(void)
{
- ida_destroy(&pdom_ids);
-
+ amd_iommu_pdom_id_destroy();
free_unity_maps();
}