Re: [PATCH 18/23] iommu: Express DMA strictness via the domain type

From: Robin Murphy
Date: Mon Jul 26 2021 - 08:43:50 EST


On 2021-07-26 13:29, Lu Baolu wrote:
[...]
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index b1af1ff324c5..a114a7ad88ec 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -363,13 +363,15 @@ static int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
      init_iova_domain(iovad, 1UL << order, base_pfn);
-    if (!cookie->fq_domain && !dev_is_untrusted(dev) &&
-        domain->ops->flush_iotlb_all && !iommu_get_dma_strict(domain)) {
+    if (domain->type == IOMMU_DOMAIN_DMA_FQ && !cookie->fq_domain &&
+        domain->ops->flush_iotlb_all) {

Perhaps we can remove the ops->flush_iotlb_all check with the
assumption that any vendor iommu driver with DMA_FQ domain support
should always provides this callback?

Oh yes, indeed it wouldn't make sense for a driver to claim IOMMU_DOMAIN_DMA_FQ support but not implement the one thing that that needs the driver to provide. That's yet another neat little cleanup, thanks!

Robin.