Skip to content

Commit 6e6c6d6

Browse files
LuBaolujoergroedel
authored andcommitted
iommu: Avoid unnecessary cache invalidations
The iommu_create_device_direct_mappings() only needs to flush the caches when the mappings are changed in the affected domain. This is not true for non-DMA domains, or for devices attached to the domain that have no reserved regions. To avoid unnecessary cache invalidations, add a check before iommu_flush_iotlb_all(). Fixes: a48ce36 ("iommu: Prevent RESV_DIRECT devices from blocking domains") Signed-off-by: Lu Baolu <[email protected]> Tested-by: Henry Willard <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 05d3ef8 commit 6e6c6d6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/iommu/iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,8 @@ static int iommu_create_device_direct_mappings(struct iommu_domain *domain,
11081108

11091109
}
11101110

1111-
iommu_flush_iotlb_all(domain);
1111+
if (!list_empty(&mappings) && iommu_is_dma_domain(domain))
1112+
iommu_flush_iotlb_all(domain);
11121113

11131114
out:
11141115
iommu_put_resv_regions(dev, &mappings);

0 commit comments

Comments
 (0)