]> git.proxmox.com Git - mirror_qemu.git/commit - hw/i386/intel_iommu.c
intel_iommu: provide its own replay() callback
authorPeter Xu <peterx@redhat.com>
Fri, 7 Apr 2017 10:59:13 +0000 (18:59 +0800)
committerEduardo Habkost <ehabkost@redhat.com>
Thu, 20 Apr 2017 18:22:41 +0000 (15:22 -0300)
commitf06a696dc958dd80f7eaf5be66fdefac77741ee0
tree07cc14f116759afb5659eadaabac4d55afde01a9
parent10315b9b28c28655ce64500281f4a028d0f8c5ff
intel_iommu: provide its own replay() callback

The default replay() don't work for VT-d since vt-d will have a huge
default memory region which covers address range 0-(2^64-1). This will
normally consumes a lot of time (which looks like a dead loop).

The solution is simple - we don't walk over all the regions. Instead, we
jump over the regions when we found that the page directories are empty.
It'll greatly reduce the time to walk the whole region.

To achieve this, we provided a page walk helper to do that, invoking
corresponding hook function when we found an page we are interested in.
vtd_page_walk_level() is the core logic for the page walking. It's
interface is designed to suite further use case, e.g., to invalidate a
range of addresses.

Reviewed-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: \"Michael S. Tsirkin\" <mst@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1491562755-23867-8-git-send-email-peterx@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
hw/i386/intel_iommu.c
hw/i386/trace-events
include/exec/memory.h