summaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/memory.c b/memory.c
index 7eb8d461b9..2a94d7de2c 100644
--- a/memory.c
+++ b/memory.c
@@ -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;