diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2013-05-14 19:13:56 +1000 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2013-06-20 16:32:47 +0200 |
commit | 068665757da047d7d2980c17bba0659eb0ea0a89 (patch) | |
tree | a796657fa689e04bd28489c05c5d99e0e1981ebd /memory.c | |
parent | 30951157441aed950ad8ca326500b4986d431c7a (diff) | |
download | qemu-068665757da047d7d2980c17bba0659eb0ea0a89.zip |
memory: Add iommu map/unmap notifiers
This patch adds a NotifierList to MemoryRegions which represent IOMMUs
allowing other parts of the code to register interest in mappings or
unmappings from the IOMMU. All IOMMU implementations will need to call
memory_region_notify_iommu() to inform those waiting on the notifier list,
whenever an IOMMU mapping is made or removed.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r-- | memory.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -1072,6 +1072,7 @@ void memory_region_init_iommu(MemoryRegion *mr, memory_region_init(mr, name, size); mr->iommu_ops = ops, mr->terminates = true; /* then re-forwards */ + notifier_list_init(&mr->iommu_notify); } void memory_region_init_reservation(MemoryRegion *mr, @@ -1124,6 +1125,23 @@ bool memory_region_is_iommu(MemoryRegion *mr) return mr->iommu_ops; } +void memory_region_register_iommu_notifier(MemoryRegion *mr, Notifier *n) +{ + notifier_list_add(&mr->iommu_notify, n); +} + +void memory_region_unregister_iommu_notifier(Notifier *n) +{ + notifier_remove(n); +} + +void memory_region_notify_iommu(MemoryRegion *mr, + IOMMUTLBEntry entry) +{ + assert(memory_region_is_iommu(mr)); + notifier_list_notify(&mr->iommu_notify, &entry); +} + void memory_region_set_log(MemoryRegion *mr, bool log, unsigned client) { uint8_t mask = 1 << client; |