Skip to content

Commit 487df68

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Remove has_iotlb_device flag
The has_iotlb_device flag was used to indicate if a domain had attached devices with ATS enabled. Domains without this flag didn't require device TLB invalidation during unmap operations, optimizing performance by avoiding unnecessary device iteration. With the introduction of cache tags, this flag is no longer needed. The code to iterate over attached devices was removed by commit 06792d0 ("iommu/vt-d: Cleanup use of iommu_flush_iotlb_psi()"). Remove has_iotlb_device to avoid unnecessary code. Suggested-by: Jason Gunthorpe <[email protected]> Signed-off-by: Lu Baolu <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 2c13012 commit 487df68

File tree

3 files changed

+1
-37
lines changed

3 files changed

+1
-37
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ void domain_update_iommu_cap(struct dmar_domain *domain)
485485
domain->domain.geometry.aperture_end = __DOMAIN_MAX_ADDR(domain->gaw);
486486

487487
domain->domain.pgsize_bitmap |= domain_super_pgsize_bitmap(domain);
488-
domain_update_iotlb(domain);
489488
}
490489

491490
struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
@@ -1263,32 +1262,6 @@ domain_lookup_dev_info(struct dmar_domain *domain,
12631262
return NULL;
12641263
}
12651264

1266-
void domain_update_iotlb(struct dmar_domain *domain)
1267-
{
1268-
struct dev_pasid_info *dev_pasid;
1269-
struct device_domain_info *info;
1270-
bool has_iotlb_device = false;
1271-
unsigned long flags;
1272-
1273-
spin_lock_irqsave(&domain->lock, flags);
1274-
list_for_each_entry(info, &domain->devices, link) {
1275-
if (info->ats_enabled) {
1276-
has_iotlb_device = true;
1277-
break;
1278-
}
1279-
}
1280-
1281-
list_for_each_entry(dev_pasid, &domain->dev_pasids, link_domain) {
1282-
info = dev_iommu_priv_get(dev_pasid->dev);
1283-
if (info->ats_enabled) {
1284-
has_iotlb_device = true;
1285-
break;
1286-
}
1287-
}
1288-
domain->has_iotlb_device = has_iotlb_device;
1289-
spin_unlock_irqrestore(&domain->lock, flags);
1290-
}
1291-
12921265
/*
12931266
* The extra devTLB flush quirk impacts those QAT devices with PCI device
12941267
* IDs ranging from 0x4940 to 0x4943. It is exempted from risky_device()
@@ -1325,10 +1298,8 @@ static void iommu_enable_pci_caps(struct device_domain_info *info)
13251298
info->pasid_enabled = 1;
13261299

13271300
if (info->ats_supported && pci_ats_page_aligned(pdev) &&
1328-
!pci_enable_ats(pdev, VTD_PAGE_SHIFT)) {
1301+
!pci_enable_ats(pdev, VTD_PAGE_SHIFT))
13291302
info->ats_enabled = 1;
1330-
domain_update_iotlb(info->domain);
1331-
}
13321303
}
13331304

13341305
static void iommu_disable_pci_caps(struct device_domain_info *info)
@@ -1343,7 +1314,6 @@ static void iommu_disable_pci_caps(struct device_domain_info *info)
13431314
if (info->ats_enabled) {
13441315
pci_disable_ats(pdev);
13451316
info->ats_enabled = 0;
1346-
domain_update_iotlb(info->domain);
13471317
}
13481318

13491319
if (info->pasid_enabled) {
@@ -1517,7 +1487,6 @@ static struct dmar_domain *alloc_domain(unsigned int type)
15171487
domain->nid = NUMA_NO_NODE;
15181488
if (first_level_by_default(type))
15191489
domain->use_first_level = true;
1520-
domain->has_iotlb_device = false;
15211490
INIT_LIST_HEAD(&domain->devices);
15221491
INIT_LIST_HEAD(&domain->dev_pasids);
15231492
INIT_LIST_HEAD(&domain->cache_tags);
@@ -3518,7 +3487,6 @@ static struct dmar_domain *paging_domain_alloc(struct device *dev, bool first_st
35183487
xa_init(&domain->iommu_array);
35193488

35203489
domain->nid = dev_to_node(dev);
3521-
domain->has_iotlb_device = info->ats_enabled;
35223490
domain->use_first_level = first_stage;
35233491

35243492
/* calculate the address width */

drivers/iommu/intel/iommu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,6 @@ struct dmar_domain {
588588
int nid; /* node id */
589589
struct xarray iommu_array; /* Attached IOMMU array */
590590

591-
u8 has_iotlb_device: 1;
592591
u8 iommu_coherency: 1; /* indicate coherency of iommu access */
593592
u8 force_snooping : 1; /* Create IOPTEs with snoop control */
594593
u8 set_pte_snp:1;
@@ -1104,7 +1103,6 @@ int qi_submit_sync(struct intel_iommu *iommu, struct qi_desc *desc,
11041103
*/
11051104
#define QI_OPT_WAIT_DRAIN BIT(0)
11061105

1107-
void domain_update_iotlb(struct dmar_domain *domain);
11081106
int domain_attach_iommu(struct dmar_domain *domain, struct intel_iommu *iommu);
11091107
void domain_detach_iommu(struct dmar_domain *domain, struct intel_iommu *iommu);
11101108
void device_block_translation(struct device *dev);

drivers/iommu/intel/nested.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ static int intel_nested_attach_dev(struct iommu_domain *domain,
6666
list_add(&info->link, &dmar_domain->devices);
6767
spin_unlock_irqrestore(&dmar_domain->lock, flags);
6868

69-
domain_update_iotlb(dmar_domain);
70-
7169
return 0;
7270
unassign_tag:
7371
cache_tag_unassign_domain(dmar_domain, dev, IOMMU_NO_PASID);

0 commit comments

Comments
 (0)