mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
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: a48ce36e27
("iommu: Prevent RESV_DIRECT devices from blocking domains")
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Tested-by: Henry Willard <henry.willard@oracle.com>
Link: https://lore.kernel.org/r/20231026084942.17387-1-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
05d3ef8bba
commit
6e6c6d6bc6
1 changed files with 2 additions and 1 deletions
|
@ -1108,7 +1108,8 @@ static int iommu_create_device_direct_mappings(struct iommu_domain *domain,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iommu_flush_iotlb_all(domain);
|
if (!list_empty(&mappings) && iommu_is_dma_domain(domain))
|
||||||
|
iommu_flush_iotlb_all(domain);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
iommu_put_resv_regions(dev, &mappings);
|
iommu_put_resv_regions(dev, &mappings);
|
||||||
|
|
Loading…
Reference in a new issue