From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNhyP-0003Zh-RU for qemu-devel@nongnu.org; Fri, 07 Aug 2015 09:46:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZNhyK-0001mw-75 for qemu-devel@nongnu.org; Fri, 07 Aug 2015 09:46:13 -0400 Received: from mail-vk0-f41.google.com ([209.85.213.41]:33795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZNhyK-0001mB-3I for qemu-devel@nongnu.org; Fri, 07 Aug 2015 09:46:08 -0400 Received: by vkhl6 with SMTP id l6so38246762vkh.1 for ; Fri, 07 Aug 2015 06:46:07 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <84eb5a74233f317b36f41963e465851328972355.1437080501.git.jcd@tribudubois.net> References: <84eb5a74233f317b36f41963e465851328972355.1437080501.git.jcd@tribudubois.net> From: Peter Maydell Date: Fri, 7 Aug 2015 14:45:47 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v13 13/19] i.MX: KZM now uses the standalone i.MX31 SOC support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jean-Christophe Dubois Cc: QEMU Developers On 16 July 2015 at 22:21, Jean-Christophe Dubois wrote: > Tested by booting a minimal Linux system on the emulated platform > > Signed-off-by: Jean-Christophe Dubois > --- This said: > - * 0x80000000-0x87ffffff RAM EMULATED > - * 0x88000000-0x8fffffff RAM Aliasing EMULATED but your patch changes it: > + * 0x00000000-0x7fffffff See i.MX31 SOC for support > + * 0x80000000-0x8fffffff RAM EMULATED > + * 0x90000000-0x9fffffff RAM EMULATED > + /* initialize our memory */ > + for (i=0, ram_size = machine->ram_size; (i<2) && ram_size; i++) { > + unsigned int size; > + char ram_name[20]; > + static const struct { > + hwaddr addr; > + unsigned int size; > + } ram[2] = { > + { FSL_IMX31_SDRAM0_ADDR, FSL_IMX31_SDRAM0_SIZE }, > + { FSL_IMX31_SDRAM1_ADDR, FSL_IMX31_SDRAM1_SIZE }, > + }; > + > + if (ram_size > ram[i].size) { > + size = ram[i].size; > + } else { > + size = ram_size; > + } > + > + sprintf(ram_name, "kzm.ram%d", i); > + > + ram_size -= size; > + > + memory_region_allocate_system_memory(&s->ram[i], NULL, ram_name, size); memory_region_allocate_system_memory() needs to be called once and only once by a board init. You're going to end up calling it twice here. > + memory_region_add_subregion(get_system_memory(), ram[i].addr, > + &s->ram[i]); > + if (size < ram[i].size) { > + memory_region_init_alias(&s->ram_alias, NULL, "ram.alias", > + &s->ram[i], 0, ram[i].size - size); > + memory_region_add_subregion(get_system_memory(), > + ram[i].addr + size, &s->ram_alias); > + } > + } What is this code trying to do with that alias? It looks very odd. (Are we trying to model under-decoded address bits?) My instinct is to say that rather than modelling two separate lumps of RAM we should just have one region -- they're contiguous, after all. thanks -- PMM