Commit 6e6c6d6b authored by Lu Baolu's avatar Lu Baolu Committed by Joerg Roedel
Browse files

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: a48ce36e ("iommu: Prevent RESV_DIRECT devices from blocking domains")
Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Tested-by: default avatarHenry Willard <henry.willard@oracle.com>
Link: https://lore.kernel.org/r/20231026084942.17387-1-baolu.lu@linux.intel.com


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 05d3ef8b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1108,6 +1108,7 @@ static int iommu_create_device_direct_mappings(struct iommu_domain *domain,

	}

	if (!list_empty(&mappings) && iommu_is_dma_domain(domain))
		iommu_flush_iotlb_all(domain);

out: