iommu: Avoid unnecessary cache invalidations
authorLu Baolu <baolu.lu@linux.intel.com>
Thu, 26 Oct 2023 08:49:42 +0000 (16:49 +0800)
committerJoerg Roedel <jroedel@suse.de>
Fri, 27 Oct 2023 06:57:09 +0000 (08:57 +0200)
commit6e6c6d6bc6c96c2477ddfea24a121eb5ee12b7a3
treed76aa2991d69cbdf9790df77862f2445b05194c1
parent05d3ef8bba77c1b5f98d941d8b2d4aeab8118ef1
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: a48ce36e2786 ("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>
drivers/iommu/iommu.c