From patchwork Sun Oct 7 12:38:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 189828 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 E38162C01C2 for ; Mon, 8 Oct 2012 00:36:50 +1100 (EST) Received: from localhost ([::1]:60601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKq92-0008Fh-9O for incoming@patchwork.ozlabs.org; Sun, 07 Oct 2012 08:39:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKq8V-0007yM-1U for qemu-devel@nongnu.org; Sun, 07 Oct 2012 08:39:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TKq8T-0002qJ-2F for qemu-devel@nongnu.org; Sun, 07 Oct 2012 08:39:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TKq8S-0002q9-RR for qemu-devel@nongnu.org; Sun, 07 Oct 2012 08:39:09 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q97Cd6iE024681 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 7 Oct 2012 08:39:06 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q97CcVYf002159; Sun, 7 Oct 2012 08:39:04 -0400 From: Avi Kivity To: qemu-devel@nongnu.org, Anthony Liguori , liu ping fan , "Michael S. Tsirkin" , Paolo Bonzini , Blue Swirl Date: Sun, 7 Oct 2012 14:38:20 +0200 Message-Id: <1349613508-22980-16-git-send-email-avi@redhat.com> In-Reply-To: <1349613508-22980-1-git-send-email-avi@redhat.com> References: <1349613508-22980-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v1 15/23] memory: move address_space_memory and address_space_io out of memory core 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 With this change, memory.c no longer knows anything about special address spaces, so it is prepared for AddressSpace based DMA. Reviewed-by: Anthony Liguori Signed-off-by: Avi Kivity --- exec-memory.h | 6 ------ exec.c | 9 +++++++-- memory.c | 16 ---------------- 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/exec-memory.h b/exec-memory.h index 1cd92ee..6707e40 100644 --- a/exec-memory.h +++ b/exec-memory.h @@ -33,12 +33,6 @@ MemoryRegion *get_system_memory(void); */ MemoryRegion *get_system_io(void); -/* Set the root memory region. This region is the system memory map. */ -void set_system_memory_map(MemoryRegion *mr); - -/* Set the I/O memory region. This region is the I/O memory map. */ -void set_system_io_map(MemoryRegion *mr); - #endif #endif diff --git a/exec.c b/exec.c index 51a32e7..e5f26fb 100644 --- a/exec.c +++ b/exec.c @@ -116,6 +116,9 @@ static MemoryRegion *system_memory; static MemoryRegion *system_io; +static AddressSpace address_space_io; +static AddressSpace address_space_memory; + MemoryRegion io_mem_ram, io_mem_rom, io_mem_unassigned, io_mem_notdirty; static MemoryRegion io_mem_subpage_ram; @@ -3245,11 +3248,13 @@ static void memory_map_init(void) { system_memory = g_malloc(sizeof(*system_memory)); memory_region_init(system_memory, "system", INT64_MAX); - set_system_memory_map(system_memory); + address_space_init(&address_space_memory, system_memory); + address_space_memory.name = "memory"; system_io = g_malloc(sizeof(*system_io)); memory_region_init(system_io, "io", 65536); - set_system_io_map(system_io); + address_space_init(&address_space_io, system_io); + address_space_io.name = "I/O"; memory_listener_register(&core_memory_listener, system_memory); memory_listener_register(&io_memory_listener, system_io); diff --git a/memory.c b/memory.c index eb75349..7bc5a32 100644 --- a/memory.c +++ b/memory.c @@ -358,8 +358,6 @@ static void access_with_adjusted_size(target_phys_addr_t addr, } } -static AddressSpace address_space_memory; - static const MemoryRegionPortio *find_portio(MemoryRegion *mr, uint64_t offset, unsigned width, bool write) { @@ -448,8 +446,6 @@ static void memory_region_iorange_destructor(IORange *iorange) .destructor = memory_region_iorange_destructor, }; -static AddressSpace address_space_io; - static AddressSpace *memory_region_to_address_space(MemoryRegion *mr) { AddressSpace *as; @@ -1556,18 +1552,6 @@ void address_space_init(AddressSpace *as, MemoryRegion *root) memory_region_transaction_commit(); } -void set_system_memory_map(MemoryRegion *mr) -{ - address_space_init(&address_space_memory, mr); - address_space_memory.name = "memory"; -} - -void set_system_io_map(MemoryRegion *mr) -{ - address_space_init(&address_space_io, mr); - address_space_io.name = "I/O"; -} - uint64_t io_mem_read(MemoryRegion *mr, target_phys_addr_t addr, unsigned size) { return memory_region_dispatch_read(mr, addr, size);