Skip to content

Commit bdb46d1

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Remove global g_iommus array
The g_iommus and g_num_of_iommus is not used anywhere. Remove them to avoid dead code. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Reviewed-by: Steve Wahl <steve.wahl@hpe.com> Link: https://lore.kernel.org/r/20220702015610.2849494-6-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 97a79de commit bdb46d1

1 file changed

Lines changed: 0 additions & 44 deletions

File tree

drivers/iommu/intel/iommu.c

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,6 @@ static inline unsigned long virt_to_dma_pfn(void *p)
126126
return page_to_dma_pfn(virt_to_page(p));
127127
}
128128

129-
/* global iommu list, set NULL for ignored DMAR units */
130-
static struct intel_iommu **g_iommus;
131-
132129
static void __init check_tylersburg_isoch(void);
133130
static int rwbf_quirk;
134131

@@ -287,9 +284,6 @@ static LIST_HEAD(dmar_satc_units);
287284
#define for_each_rmrr_units(rmrr) \
288285
list_for_each_entry(rmrr, &dmar_rmrr_units, list)
289286

290-
/* bitmap for indexing intel_iommus */
291-
static int g_num_of_iommus;
292-
293287
static void dmar_remove_one_dev_info(struct device *dev);
294288

295289
int dmar_disabled = !IS_ENABLED(CONFIG_INTEL_IOMMU_DEFAULT_ON);
@@ -1694,8 +1688,6 @@ static void free_dmar_iommu(struct intel_iommu *iommu)
16941688
iommu->domain_ids = NULL;
16951689
}
16961690

1697-
g_iommus[iommu->seq_id] = NULL;
1698-
16991691
/* free context mapping */
17001692
free_context_table(iommu);
17011693

@@ -2898,36 +2890,6 @@ static int __init init_dmars(void)
28982890
struct intel_iommu *iommu;
28992891
int ret;
29002892

2901-
/*
2902-
* for each drhd
2903-
* allocate root
2904-
* initialize and program root entry to not present
2905-
* endfor
2906-
*/
2907-
for_each_drhd_unit(drhd) {
2908-
/*
2909-
* lock not needed as this is only incremented in the single
2910-
* threaded kernel __init code path all other access are read
2911-
* only
2912-
*/
2913-
if (g_num_of_iommus < DMAR_UNITS_SUPPORTED) {
2914-
g_num_of_iommus++;
2915-
continue;
2916-
}
2917-
pr_err_once("Exceeded %d IOMMUs\n", DMAR_UNITS_SUPPORTED);
2918-
}
2919-
2920-
/* Preallocate enough resources for IOMMU hot-addition */
2921-
if (g_num_of_iommus < DMAR_UNITS_SUPPORTED)
2922-
g_num_of_iommus = DMAR_UNITS_SUPPORTED;
2923-
2924-
g_iommus = kcalloc(g_num_of_iommus, sizeof(struct intel_iommu *),
2925-
GFP_KERNEL);
2926-
if (!g_iommus) {
2927-
ret = -ENOMEM;
2928-
goto error;
2929-
}
2930-
29312893
ret = intel_cap_audit(CAP_AUDIT_STATIC_DMAR, NULL);
29322894
if (ret)
29332895
goto free_iommu;
@@ -2950,8 +2912,6 @@ static int __init init_dmars(void)
29502912
intel_pasid_max_id);
29512913
}
29522914

2953-
g_iommus[iommu->seq_id] = iommu;
2954-
29552915
intel_iommu_init_qi(iommu);
29562916

29572917
ret = iommu_init_domains(iommu);
@@ -3077,9 +3037,6 @@ static int __init init_dmars(void)
30773037
free_dmar_iommu(iommu);
30783038
}
30793039

3080-
kfree(g_iommus);
3081-
3082-
error:
30833040
return ret;
30843041
}
30853042

@@ -3483,7 +3440,6 @@ static int intel_iommu_add(struct dmar_drhd_unit *dmaru)
34833440
if (iommu->gcmd & DMA_GCMD_TE)
34843441
iommu_disable_translation(iommu);
34853442

3486-
g_iommus[iommu->seq_id] = iommu;
34873443
ret = iommu_init_domains(iommu);
34883444
if (ret == 0)
34893445
ret = iommu_alloc_root_entry(iommu);

0 commit comments

Comments
 (0)