From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfvPB-0002NH-DR for qemu-devel@nongnu.org; Fri, 24 May 2013 13:03:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfvP6-00018R-PY for qemu-devel@nongnu.org; Fri, 24 May 2013 13:03:49 -0400 Received: from mail-ee0-f44.google.com ([74.125.83.44]:46229) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfvP6-00018G-GW for qemu-devel@nongnu.org; Fri, 24 May 2013 13:03:44 -0400 Received: by mail-ee0-f44.google.com with SMTP id b57so2864821eek.31 for ; Fri, 24 May 2013 10:03:43 -0700 (PDT) Received: from playground.lan (net-37-117-138-128.cust.dsl.vodafone.it. [37.117.138.128]) by mx.google.com with ESMTPSA id z52sm24872219eea.1.2013.05.24.10.03.42 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 24 May 2013 10:03:42 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Fri, 24 May 2013 19:03:06 +0200 Message-Id: <1369414987-8839-15-git-send-email-pbonzini@redhat.com> In-Reply-To: <1369414987-8839-1-git-send-email-pbonzini@redhat.com> References: <1369414987-8839-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 14/15] memory: populate FlatView for new address spaces List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Even a new address space might have a non-empty FlatView. In order to initialize it properly, address_space_init should (a) call memory_region_transaction_commit after the address space is inserted into the list; (b) force memory_region_transaction_commit to do something. This bug was latent so far because all address spaces started empty, including the PCI address space where the bus master region is initially disabled. However, the target address space of an IOMMU is usually rooted at get_system_memory(), which might not be empty at the time the IOMMU is created. Reviewed-by: Peter Maydell Signed-off-by: Paolo Bonzini --- memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/memory.c b/memory.c index 9478f98..99f046d 100644 --- a/memory.c +++ b/memory.c @@ -1576,8 +1576,9 @@ void address_space_init(AddressSpace *as, MemoryRegion *root) as->ioeventfds = NULL; QTAILQ_INSERT_TAIL(&address_spaces, as, address_spaces_link); as->name = NULL; - memory_region_transaction_commit(); address_space_init_dispatch(as); + memory_region_update_pending |= root->enabled; + memory_region_transaction_commit(); } void address_space_destroy(AddressSpace *as) -- 1.8.1.4