diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2015-10-08 16:50:34 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2015-10-08 16:50:34 +0100 |
| commit | 1d27b91723c252d9a97151dc1959cfd89c5816cb (patch) | |
| tree | a63a4ed5c4071c44628160f20b22e20fee003bb4 /memory.c | |
| parent | 31c9bd164ddb653915b9029ba0edd40cd57530d9 (diff) | |
| parent | 508ce5eb00070809f0d19917a1b2960dfcf5a64b (diff) | |
| download | focaccia-qemu-1d27b91723c252d9a97151dc1959cfd89c5816cb.tar.gz focaccia-qemu-1d27b91723c252d9a97151dc1959cfd89c5816cb.zip | |
Merge remote-tracking branch 'remotes/awilliam/tags/vfio-update-20151007.0' into staging
VFIO updates 2015-10-07 - Change platform device IRQ setup sequence for compatibility with upcoming IRQ forwarding (Eric Auger) - Extensions to support vfio-pci devices on spapr-pci-host-bridge (David Gibson) [clang problem patch dropped] # gpg: Signature made Wed 07 Oct 2015 16:30:52 BST using RSA key ID 3BB08B22 # gpg: Good signature from "Alex Williamson <alex.williamson@redhat.com>" # gpg: aka "Alex Williamson <alex@shazbot.org>" # gpg: aka "Alex Williamson <alwillia@redhat.com>" # gpg: aka "Alex Williamson <alex.l.williamson@gmail.com>" * remotes/awilliam/tags/vfio-update-20151007.0: vfio: Allow hotplug of containers onto existing guest IOMMU mappings memory: Allow replay of IOMMU mapping notifications vfio: Record host IOMMU's available IO page sizes vfio: Check guest IOVA ranges against host IOMMU capabilities vfio: Generalize vfio_listener_region_add failure path vfio: Remove unneeded union from VFIOContainer hw/vfio/platform: do not set resamplefd for edge-sensitive IRQS hw/vfio/platform: change interrupt/unmask fields into pointer hw/vfio/platform: irqfd setup sequence update Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'memory.c')
| -rw-r--r-- | memory.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/memory.c b/memory.c index ef87363067..1b03d2251c 100644 --- a/memory.c +++ b/memory.c @@ -1403,6 +1403,26 @@ void memory_region_register_iommu_notifier(MemoryRegion *mr, Notifier *n) notifier_list_add(&mr->iommu_notify, n); } +void memory_region_iommu_replay(MemoryRegion *mr, Notifier *n, + hwaddr granularity, bool is_write) +{ + hwaddr addr; + IOMMUTLBEntry iotlb; + + for (addr = 0; addr < memory_region_size(mr); addr += granularity) { + iotlb = mr->iommu_ops->translate(mr, addr, is_write); + if (iotlb.perm != IOMMU_NONE) { + n->notify(n, &iotlb); + } + + /* if (2^64 - MR size) < granularity, it's possible to get an + * infinite loop here. This should catch such a wraparound */ + if ((addr + granularity) < addr) { + break; + } + } +} + void memory_region_unregister_iommu_notifier(Notifier *n) { notifier_remove(n); |