Skip to content

Commit 129dab6

Browse files
LuBaolujoergroedel
authored andcommitted
iommu/vt-d: Use cache_tag_flush_range_np() in iotlb_sync_map
The iotlb_sync_map callback is called by the iommu core after non-present to present mappings are created. The iommu driver uses this callback to invalidate caches if IOMMU is working in caching mode and second-only translation is used for the domain. Use cache_tag_flush_range_np() in this callback. Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Link: https://lore.kernel.org/r/20240416080656.60968-7-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent a600ccd commit 129dab6

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

drivers/iommu/intel/iommu.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,20 +1501,6 @@ static void iommu_flush_iotlb_psi(struct intel_iommu *iommu,
15011501
iommu_flush_dev_iotlb(domain, addr, mask);
15021502
}
15031503

1504-
/* Notification for newly created mappings */
1505-
static void __mapping_notify_one(struct intel_iommu *iommu, struct dmar_domain *domain,
1506-
unsigned long pfn, unsigned int pages)
1507-
{
1508-
/*
1509-
* It's a non-present to present mapping. Only flush if caching mode
1510-
* and second level.
1511-
*/
1512-
if (cap_caching_mode(iommu->cap) && !domain->use_first_level)
1513-
iommu_flush_iotlb_psi(iommu, domain, pfn, pages, 0, 1);
1514-
else
1515-
iommu_flush_write_buffer(iommu);
1516-
}
1517-
15181504
/*
15191505
* Flush the relevant caches in nested translation if the domain
15201506
* also serves as a parent
@@ -4544,14 +4530,8 @@ static bool risky_device(struct pci_dev *pdev)
45444530
static int intel_iommu_iotlb_sync_map(struct iommu_domain *domain,
45454531
unsigned long iova, size_t size)
45464532
{
4547-
struct dmar_domain *dmar_domain = to_dmar_domain(domain);
4548-
unsigned long pages = aligned_nrpages(iova, size);
4549-
unsigned long pfn = iova >> VTD_PAGE_SHIFT;
4550-
struct iommu_domain_info *info;
4551-
unsigned long i;
4533+
cache_tag_flush_range_np(to_dmar_domain(domain), iova, iova + size - 1);
45524534

4553-
xa_for_each(&dmar_domain->iommu_array, i, info)
4554-
__mapping_notify_one(info->iommu, dmar_domain, pfn, pages);
45554535
return 0;
45564536
}
45574537

0 commit comments

Comments
 (0)