iommu: Avoid unnecessary cache invalidations
[platform/kernel/linux-starfive.git] / drivers / iommu / iommu.c
index 3bfc56d..c146378 100644 (file)
@@ -1108,7 +1108,8 @@ map_end:
 
        }
 
-       iommu_flush_iotlb_all(domain);
+       if (!list_empty(&mappings) && iommu_is_dma_domain(domain))
+               iommu_flush_iotlb_all(domain);
 
 out:
        iommu_put_resv_regions(dev, &mappings);