Skip to content

Commit d973795

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Remove the obsolete per iommu pasid tables
The obsolete per iommu pasid tables are no longer used. Hence, clean up them. Cc: Ashok Raj <[email protected]> Cc: Jacob Pan <[email protected]> Cc: Kevin Tian <[email protected]> Cc: Liu Yi L <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Liu Yi L <[email protected]> Signed-off-by: Joerg Roedel <[email protected]>
1 parent 4774cc5 commit d973795

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed

drivers/iommu/intel-iommu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,7 @@ static void free_dmar_iommu(struct intel_iommu *iommu)
17561756
if (pasid_enabled(iommu)) {
17571757
if (ecap_prs(iommu->ecap))
17581758
intel_svm_finish_prq(iommu);
1759-
intel_svm_free_pasid_tables(iommu);
1759+
intel_svm_exit(iommu);
17601760
}
17611761
#endif
17621762
}
@@ -3337,7 +3337,7 @@ static int __init init_dmars(void)
33373337
hw_pass_through = 0;
33383338
#ifdef CONFIG_INTEL_IOMMU_SVM
33393339
if (pasid_enabled(iommu))
3340-
intel_svm_alloc_pasid_tables(iommu);
3340+
intel_svm_init(iommu);
33413341
#endif
33423342
}
33433343

@@ -4300,7 +4300,7 @@ static int intel_iommu_add(struct dmar_drhd_unit *dmaru)
43004300

43014301
#ifdef CONFIG_INTEL_IOMMU_SVM
43024302
if (pasid_enabled(iommu))
4303-
intel_svm_alloc_pasid_tables(iommu);
4303+
intel_svm_init(iommu);
43044304
#endif
43054305

43064306
if (dmaru->ignored) {

drivers/iommu/intel-svm.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct pasid_state_entry {
3838
u64 val;
3939
};
4040

41-
int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu)
41+
int intel_svm_init(struct intel_iommu *iommu)
4242
{
4343
struct page *pages;
4444
int order;
@@ -63,15 +63,6 @@ int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu)
6363
iommu->pasid_max = 0x20000;
6464

6565
order = get_order(sizeof(struct pasid_entry) * iommu->pasid_max);
66-
pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
67-
if (!pages) {
68-
pr_warn("IOMMU: %s: Failed to allocate PASID table\n",
69-
iommu->name);
70-
return -ENOMEM;
71-
}
72-
iommu->pasid_table = page_address(pages);
73-
pr_info("%s: Allocated order %d PASID table.\n", iommu->name, order);
74-
7566
if (ecap_dis(iommu->ecap)) {
7667
/* Just making it explicit... */
7768
BUILD_BUG_ON(sizeof(struct pasid_entry) != sizeof(struct pasid_state_entry));
@@ -86,14 +77,10 @@ int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu)
8677
return 0;
8778
}
8879

89-
int intel_svm_free_pasid_tables(struct intel_iommu *iommu)
80+
int intel_svm_exit(struct intel_iommu *iommu)
9081
{
9182
int order = get_order(sizeof(struct pasid_entry) * iommu->pasid_max);
9283

93-
if (iommu->pasid_table) {
94-
free_pages((unsigned long)iommu->pasid_table, order);
95-
iommu->pasid_table = NULL;
96-
}
9784
if (iommu->pasid_state_table) {
9885
free_pages((unsigned long)iommu->pasid_state_table, order);
9986
iommu->pasid_state_table = NULL;

include/linux/intel-iommu.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ struct intel_iommu {
453453
* devices away to userspace processes (e.g. for DPDK) and don't
454454
* want to trust that userspace will use *only* the PASID it was
455455
* told to. But while it's all driver-arbitrated, we're fine. */
456-
struct pasid_entry *pasid_table;
457456
struct pasid_state_entry *pasid_state_table;
458457
struct page_req_dsc *prq;
459458
unsigned char prq_name[16]; /* Name for PRQ interrupt */
@@ -526,8 +525,8 @@ int for_each_device_domain(int (*fn)(struct device_domain_info *info,
526525
void *data), void *data);
527526

528527
#ifdef CONFIG_INTEL_IOMMU_SVM
529-
extern int intel_svm_alloc_pasid_tables(struct intel_iommu *iommu);
530-
extern int intel_svm_free_pasid_tables(struct intel_iommu *iommu);
528+
int intel_svm_init(struct intel_iommu *iommu);
529+
int intel_svm_exit(struct intel_iommu *iommu);
531530
extern int intel_svm_enable_prq(struct intel_iommu *iommu);
532531
extern int intel_svm_finish_prq(struct intel_iommu *iommu);
533532

0 commit comments

Comments
 (0)