From patchwork Tue May 21 10:57:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 245276 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7640C2C008A for ; Tue, 21 May 2013 21:06:26 +1000 (EST) Received: from localhost ([::1]:57149 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UekOd-0007XU-ID for incoming@patchwork.ozlabs.org; Tue, 21 May 2013 07:06:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UekGg-0004Ob-Ol for qemu-devel@nongnu.org; Tue, 21 May 2013 06:58:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UekGf-0005K2-Qg for qemu-devel@nongnu.org; Tue, 21 May 2013 06:58:10 -0400 Received: from mail-ea0-x229.google.com ([2a00:1450:4013:c01::229]:44875) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UekGf-0005Ik-Jl for qemu-devel@nongnu.org; Tue, 21 May 2013 06:58:09 -0400 Received: by mail-ea0-f169.google.com with SMTP id m14so292994eaj.14 for ; Tue, 21 May 2013 03:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=D0wjHA3FgAe7NwcxbdimUVZdOs1zxaVsOvaiE0srvuk=; b=NxX/Mw4YIVePJNPI/QpQGIPueU3A2u7uGxI4+xM+SEnatJowux60IlxiCIDNkNAU+a e9OG3/7ySLzqFSm0iucvgeJ1PQlx1OHXkzutGfWkSCeiOwtFIT1shyxmewQwxTHvsk87 iwZcmwrlv6vxcR5vE0DgdkJZQOV/2mUwChMAPLZgmc16FACeHV1VJs/rY3jxZd+2e7/Z iqexfZOC7oFXpnLnPyUGMAFGaTKX7w0QAS6O3EC7AXxijZCv8xxtfpRdlSBIuF0vRrlJ hJJqybeuPvt/TMHULtUNBZDJpRK4rSkjc8+qQOzoMv36+ZJee9kGKuoOr/VLLqTdHrwX Ikeg== X-Received: by 10.14.38.198 with SMTP id a46mr5347032eeb.11.1369133888729; Tue, 21 May 2013 03:58:08 -0700 (PDT) Received: from playground.lan (net-37-116-223-193.cust.dsl.vodafone.it. [37.116.223.193]) by mx.google.com with ESMTPSA id a5sm2754398ees.6.2013.05.21.03.58.06 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 21 May 2013 03:58:07 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 21 May 2013 12:57:15 +0200 Message-Id: <1369133851-1894-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1369133851-1894-1-git-send-email-pbonzini@redhat.com> References: <1369133851-1894-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::229 Cc: peter.maydell@linaro.org, jan.kiszka@gmail.com, David Gibson Subject: [Qemu-devel] [PATCH 14/30] memory: create FlatView for new address spaces X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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. Signed-off-by: Paolo Bonzini Reviewed-by: Peter Maydell --- 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)