qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC v4 19/20] intel_iommu: unmap existing pages


From: Jason Wang
Subject: Re: [Qemu-devel] [PATCH RFC v4 19/20] intel_iommu: unmap existing pages before replay
Date: Mon, 23 Jan 2017 18:40:12 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1



On 2017年01月20日 21:08, Peter Xu wrote:
  static int vtd_replay_hook(IOMMUTLBEntry *entry, void *private)
  {
      memory_region_notify_one((IOMMUNotifier *)private, entry);
@@ -2711,13 +2768,16 @@ static void vtd_iommu_replay(MemoryRegion *mr, 
IOMMUNotifier *n)
if (vtd_dev_to_context_entry(s, bus_n, vtd_as->devfn, &ce) == 0) {
          /*
-         * Scanned a valid context entry, walk over the pages and
-         * notify when needed.
+         * Scanned a valid context entry, we first make sure to remove
+         * all existing mappings in old domain, by sending UNMAP to
+         * all the notifiers. Then, we walk over the pages and notify
+         * with existing mapped new entries in the new domain.
           */

A question is what if the context cache was invalidated but the device were not moved to a new domain. Then the code here does not do anything I believe? I think we should move vtd_address_space_unmap() in the context entry invalidation processing.

Thanks

          trace_vtd_replay_ce_valid(bus_n, PCI_SLOT(vtd_as->devfn),
                                    PCI_FUNC(vtd_as->devfn),
                                    VTD_CONTEXT_ENTRY_DID(ce.hi),
                                    ce.hi, ce.lo);
+        vtd_address_space_unmap(vtd_as, n);
          vtd_page_walk(&ce, 0, ~0, vtd_replay_hook, (void *)n, false);
      } else {
          trace_vtd_replay_ce_invalid(bus_n, PCI_SLOT(vtd_as->devfn),
diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_intern




reply via email to

[Prev in Thread] Current Thread [Next in Thread]