|
From: | Jean-Christophe DUBOIS |
Subject: | Re: [Qemu-devel] [PATCH v13 13/19] i.MX: KZM now uses the standalone i.MX31 SOC support |
Date: | Mon, 10 Aug 2015 18:15:03 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 |
Le 07/08/2015 15:45, Peter Maydell a
écrit :
The i.MX31 has 2 SDRAM controllers:On 16 July 2015 at 22:21, Jean-Christophe Dubois <address@hidden> wrote:Tested by booting a minimal Linux system on the emulated platform Signed-off-by: Jean-Christophe Dubois <address@hidden> ---This said:- * 0x80000000-0x87ffffff RAM EMULATED - * 0x88000000-0x8fffffff RAM Aliasing EMULATEDbut 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. Actually, I may be calling it up 3 time because there is also an internal (16KB) memory range that is allocated during the SOC init (fsl-imx31.c file). Now as my memory (the 3 memory banks) is (partially) discontiguous how am I suppose to init all of it in one call? And if memory_region_allocate_system_memory() should really be called only once, why is it not enforced in this function? After all, memory_region_allocate_system_memory() only calls memory_region_init_ram() and vmstate_register_ram_global() in one step ... Yes in case the RAM size does not take all of the SDRAM controller window size (this is more or less what was done in the previous kzm code but for only one SDRAM controller).+ 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?) Actually I am trying to allow a KZM board with a memory that can vary from 0MB to 512MB (instead of 0MB to 256 MB as before). This might be more than what the real board allow (I am not sure) but why not if the user needs more memory? If the requested RAM is smaller than the SDRAM controller window, the function is only called once. It is called twice here if the requested RAM exceed the SDRAM first controller window.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. And I still have this 16 KB internal memory to allocate/initialize. thanks -- PMM |
[Prev in Thread] | Current Thread | [Next in Thread] |