Hi Jerry,

On 2020/2/7 7:16, Jerry Snitselaar wrote:

Hi Baolu,

Would something along these lines makes sense?

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 9dc37672bf89..40cc8f5a3ebb 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3614,6 +3614,20 @@ static bool iommu_need_mapping(struct device *dev)
              }
              dmar_remove_one_dev_info(dev);
              get_private_domain_for_dev(dev);
+        } else {
+            if (dev->archdata.iommu == NULL) {
+                struct iommu_domain *domain;
+                struct iommu_group *group;
+                struct dmar_domain *dmar_domain, *tmp;
+
+                group = iommu_group_get_for_dev(dev);
+                domain = iommu_group_default_domain(group);
+                dmar_domain = to_dmar_domain(domain);
+                tmp = set_domain_for_dev(dev, dmar_domain);
+            }
          }

          dev_info(dev, "32bit DMA uses non-identity mapping\n");

Thanks for reporting.

Actually, I prefer to removing this domain switch as long as users are
able to make a 32-bit device use DMA domain while system default is
identity or it breaks anything. 32-bit devices (or normally devices
with limited addressing capability over the whole system memory) using
DMA domain helps by removing the swiotlb performance overhead, which is
the original motivation of this code.

Best regards,
baolu
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to