Re: [RFC 2/7] iommu/vt-d: Remove iova handling code from non-dma ops path

From
Lu Baolu <baolu.lu@linux.intel.com>
Date
2019-05-05 01:29:18
Also in
kvm, linux-arm-msm, linux-iommu, linux-mediatek, linux-rockchip, linux-s390, linux-samsung-soc, linux-tegra, lkml
Reply to
Lu Baolu, 2019-05-05
Hi,

On 5/5/19 9:19 AM, Lu Baolu wrote:
Hi,

On 5/4/19 9:23 PM, Tom Murphy via iommu wrote:
quoted
@@ -4181,58 +4168,37 @@ static int intel_iommu_memory_notifier(struct notifier_block *nb,
                         unsigned long val, void *v)
  {
      struct memory_notify *mhp = v;
-    unsigned long long start, end;
-    unsigned long start_vpfn, last_vpfn;
+    unsigned long start_vpfn = mm_to_dma_pfn(mhp->start_pfn);
+    unsigned long last_vpfn = mm_to_dma_pfn(mhp->start_pfn +
+            mhp->nr_pages - 1);
      switch (val) {
      case MEM_GOING_ONLINE:
-        start = mhp->start_pfn << PAGE_SHIFT;
-        end = ((mhp->start_pfn + mhp->nr_pages) << PAGE_SHIFT) - 1;
-        if (iommu_domain_identity_map(si_domain, start, end)) {
-            pr_warn("Failed to build identity map for [%llx-%llx]\n",
-                start, end);
+        if (iommu_domain_identity_map(si_domain, start_vpfn,
+                    last_vpfn)) {
+            pr_warn("Failed to build identity map for [%lx-%lx]\n",
+                start_vpfn, last_vpfn);
              return NOTIFY_BAD;
          }
          break;
Actually we don't need to update the si_domain if iommu hardware
supports pass-through mode. This should be made in a separated patch
anyway.
Oh! please ignore it.

This callback is only registered when hardware doesn't support pass
through mode.

        if (si_domain && !hw_pass_through)
                register_memory_notifier(&intel_iommu_memory_nb);

Best regards,
Lu Baolu


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (15 messages) 15 messages, 2 authors, last reply 2019-05-06
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help