Commit 512fa408 authored by Peter Xu's avatar Peter Xu Committed by Eduardo Habkost
Browse files

memory: provide IOMMU_NOTIFIER_FOREACH macro



A new macro is provided to iterate all the IOMMU notifiers hooked
under specific IOMMU memory region.

Reviewed-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
Reviewed-by: default avatarEric Auger <eric.auger@redhat.com>
Reviewed-by: default avatar\"Michael S. Tsirkin\" <mst@redhat.com>
Signed-off-by: default avatarPeter Xu <peterx@redhat.com>
Message-Id: <1491562755-23867-3-git-send-email-peterx@redhat.com>
Signed-off-by: default avatarEduardo Habkost <ehabkost@redhat.com>
parent 698feb5e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -239,6 +239,9 @@ struct MemoryRegion {
    IOMMUNotifierFlag iommu_notify_flags;
};

#define IOMMU_NOTIFIER_FOREACH(n, mr) \
    QLIST_FOREACH((n), &(mr)->iommu_notify, node)

/**
 * MemoryListener: callbacks structure for updates to the physical memory map
 *
+2 −2
Original line number Diff line number Diff line
@@ -1583,7 +1583,7 @@ static void memory_region_update_iommu_notify_flags(MemoryRegion *mr)
    IOMMUNotifierFlag flags = IOMMU_NOTIFIER_NONE;
    IOMMUNotifier *iommu_notifier;

    QLIST_FOREACH(iommu_notifier, &mr->iommu_notify, node) {
    IOMMU_NOTIFIER_FOREACH(iommu_notifier, mr) {
        flags |= iommu_notifier->notifier_flags;
    }

@@ -1667,7 +1667,7 @@ void memory_region_notify_iommu(MemoryRegion *mr,
        request_flags = IOMMU_NOTIFIER_UNMAP;
    }

    QLIST_FOREACH(iommu_notifier, &mr->iommu_notify, node) {
    IOMMU_NOTIFIER_FOREACH(iommu_notifier, mr) {
        /*
         * Skip the notification if the notification does not overlap
         * with registered range.