From patchwork Tue Aug 30 03:06:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 663980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sNYW21kRKz9s5l for ; Tue, 30 Aug 2016 13:13:18 +1000 (AEST) Received: from localhost ([::1]:46698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beZUB-0006uE-Vy for incoming@patchwork.ozlabs.org; Mon, 29 Aug 2016 23:13:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beZOt-0001XQ-AU for qemu-devel@nongnu.org; Mon, 29 Aug 2016 23:07:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1beZOr-0006Bi-7g for qemu-devel@nongnu.org; Mon, 29 Aug 2016 23:07:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56230) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1beZOr-0006Be-1n for qemu-devel@nongnu.org; Mon, 29 Aug 2016 23:07:45 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA66D8111C; Tue, 30 Aug 2016 03:07:44 +0000 (UTC) Received: from jason-ThinkPad-T450s.redhat.com (vpn1-6-61.pek2.redhat.com [10.72.6.61]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7U370dq027913; Mon, 29 Aug 2016 23:07:41 -0400 From: Jason Wang To: mst@redhat.com, qemu-devel@nongnu.org Date: Tue, 30 Aug 2016 11:06:57 +0800 Message-Id: <1472526419-5900-10-git-send-email-jasowang@redhat.com> In-Reply-To: <1472526419-5900-1-git-send-email-jasowang@redhat.com> References: <1472526419-5900-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 30 Aug 2016 03:07:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for 2.8 09/11] memory: handle alias for iommu notifier X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , peterx@redhat.com, vkaplans@redhat.com, wexu@redhat.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Paolo Bonzini Signed-off-by: Jason Wang Reviewed-by: Peter Xu --- 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)) {