diff mbox

[for,2.8,09/11] memory: handle alias for iommu notifier

Message ID 1472526419-5900-10-git-send-email-jasowang@redhat.com
State New
Headers show

Commit Message

Jason Wang Aug. 30, 2016, 3:06 a.m. UTC
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 memory.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Peter Xu Aug. 30, 2016, 1:28 p.m. UTC | #1
On Tue, Aug 30, 2016 at 11:06:57AM +0800, Jason Wang wrote:
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Reviewed-by: Peter Xu <peterx@redhat.com>

> ---
>  memory.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/memory.c b/memory.c
> index 0eb6895..ca0a698 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -1515,6 +1515,11 @@ bool memory_region_is_logging(MemoryRegion *mr, uint8_t client)
>  
>  void memory_region_register_iommu_notifier(MemoryRegion *mr, Notifier *n)
>  {
> +    if (mr->alias) {
> +        memory_region_register_iommu_notifier(mr->alias, n);
> +        return;
> +    }
> +
>      if (mr->iommu_ops->notify_started &&
>          QLIST_EMPTY(&mr->iommu_notify.notifiers)) {
>          mr->iommu_ops->notify_started(mr);
> @@ -1554,6 +1559,10 @@ void memory_region_iommu_replay(MemoryRegion *mr, Notifier *n, bool is_write)
>  
>  void memory_region_unregister_iommu_notifier(MemoryRegion *mr, Notifier *n)
>  {
> +    if (mr->alias) {
> +        memory_region_unregister_iommu_notifier(mr->alias, n);
> +        return;
> +    }
>      notifier_remove(n);
>      if (mr->iommu_ops->notify_stopped &&
>          QLIST_EMPTY(&mr->iommu_notify.notifiers)) {
> -- 
> 2.7.4
> 

-- peterx
diff mbox

Patch

diff --git a/memory.c b/memory.c
index 0eb6895..ca0a698 100644
--- a/memory.c
+++ b/memory.c
@@ -1515,6 +1515,11 @@  bool memory_region_is_logging(MemoryRegion *mr, uint8_t client)
 
 void memory_region_register_iommu_notifier(MemoryRegion *mr, Notifier *n)
 {
+    if (mr->alias) {
+        memory_region_register_iommu_notifier(mr->alias, n);
+        return;
+    }
+
     if (mr->iommu_ops->notify_started &&
         QLIST_EMPTY(&mr->iommu_notify.notifiers)) {
         mr->iommu_ops->notify_started(mr);
@@ -1554,6 +1559,10 @@  void memory_region_iommu_replay(MemoryRegion *mr, Notifier *n, bool is_write)
 
 void memory_region_unregister_iommu_notifier(MemoryRegion *mr, Notifier *n)
 {
+    if (mr->alias) {
+        memory_region_unregister_iommu_notifier(mr->alias, n);
+        return;
+    }
     notifier_remove(n);
     if (mr->iommu_ops->notify_stopped &&
         QLIST_EMPTY(&mr->iommu_notify.notifiers)) {