The Xilinx EP108 supports three memory regions: - A 2GB region starting at 0 - A 32GB region starting at 32GB - A 256GB region starting at 768GB
This patch adds support for the middle memory region, which is automatically created based on the size specified by the QEMU memory command line argument. Signed-off-by: Alistair Francis <alistair.fran...@xilinx.com> --- Also, the Xilinx ZynqMP TRM has been released, if anyone is interested it is avalibale at: http://www.xilinx.com/products/silicon-devices/soc/zynq-ultrascale-mpsoc.html?resultsTablePreSelect=documenttype:User%20Guides#documentation hw/arm/xlnx-ep108.c | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-ep108.c index 2899698..8c59d6d 100644 --- a/hw/arm/xlnx-ep108.c +++ b/hw/arm/xlnx-ep108.c @@ -22,17 +22,22 @@ typedef struct XlnxEP108 { XlnxZynqMPState soc; - MemoryRegion ddr_ram; + MemoryRegion ddr_ram_low; + MemoryRegion ddr_ram_high; } XlnxEP108; -/* Max 2GB RAM */ -#define EP108_MAX_RAM_SIZE 0x80000000ull +/* Maximum size of the low memory region */ +#define EP108_MAX_LOW_RAM_SIZE 0x80000000ull +/* Total maximum size of the EP108 memory */ +#define EP108_MAX_RAM_SIZE 0x880000000ull +#define EP108_HIGH_RAM_START 0x800000000ull static struct arm_boot_info xlnx_ep108_binfo; static void xlnx_ep108_init(MachineState *machine) { XlnxEP108 *s = g_new0(XlnxEP108, 1); + ram_addr_t ddr_low_size, ddr_high_size; Error *err = NULL; object_initialize(&s->soc, sizeof(s->soc), TYPE_XLNX_ZYNQMP); @@ -45,20 +50,38 @@ static void xlnx_ep108_init(MachineState *machine) exit(1); } - if (machine->ram_size > EP108_MAX_RAM_SIZE) { - error_report("WARNING: RAM size " RAM_ADDR_FMT " above max supported, " - "reduced to %llx", machine->ram_size, EP108_MAX_RAM_SIZE); - machine->ram_size = EP108_MAX_RAM_SIZE; - } - if (machine->ram_size <= 0x08000000) { qemu_log("WARNING: RAM size " RAM_ADDR_FMT " is small for EP108", machine->ram_size); } - memory_region_allocate_system_memory(&s->ddr_ram, NULL, "ddr-ram", - machine->ram_size); - memory_region_add_subregion(get_system_memory(), 0, &s->ddr_ram); + if (machine->ram_size > EP108_MAX_LOW_RAM_SIZE) { + ddr_low_size = EP108_MAX_LOW_RAM_SIZE; + + /* The RAM size is above the maximum avaliable for the low DDR. + * Create the high DDR memory region as well + */ + if (machine->ram_size > EP108_MAX_RAM_SIZE) { + error_report("WARNING: RAM size " RAM_ADDR_FMT " above max " + "supported, reduced to %llx", machine->ram_size, + EP108_MAX_RAM_SIZE); + ddr_high_size = EP108_MAX_RAM_SIZE - EP108_MAX_LOW_RAM_SIZE; + } else { + ddr_high_size = machine->ram_size - EP108_MAX_LOW_RAM_SIZE; + } + + memory_region_allocate_system_memory(&s->ddr_ram_high, NULL, + "ddr-ram-high", + ddr_high_size); + memory_region_add_subregion(get_system_memory(), EP108_HIGH_RAM_START, + &s->ddr_ram_high); + } else { + ddr_low_size = machine->ram_size; + } + + memory_region_allocate_system_memory(&s->ddr_ram_low, NULL, "ddr-ram-low", + ddr_low_size); + memory_region_add_subregion(get_system_memory(), 0, &s->ddr_ram_low); xlnx_ep108_binfo.ram_size = machine->ram_size; xlnx_ep108_binfo.kernel_filename = machine->kernel_filename; -- 2.5.0