From patchwork Tue Nov 24 05:00:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 547821 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D48911402A9 for ; Tue, 24 Nov 2015 16:02:37 +1100 (AEDT) Received: from localhost ([::1]:36079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a15kR-00013q-Oo for incoming@patchwork.ozlabs.org; Tue, 24 Nov 2015 00:02:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a15kC-0000ew-LP for qemu-devel@nongnu.org; Tue, 24 Nov 2015 00:02:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a15k8-0004oH-Mh for qemu-devel@nongnu.org; Tue, 24 Nov 2015 00:02:20 -0500 Received: from mail-sn1nam02on0089.outbound.protection.outlook.com ([104.47.36.89]:17216 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a15k8-0004nr-Hu for qemu-devel@nongnu.org; Tue, 24 Nov 2015 00:02:16 -0500 Received: from SN1NAM02FT014.eop-nam02.prod.protection.outlook.com (10.152.72.51) by SN1NAM02HT170.eop-nam02.prod.protection.outlook.com (10.152.72.100) with Microsoft SMTP Server (TLS) id 15.1.331.11; Tue, 24 Nov 2015 05:02:14 +0000 Authentication-Results: spf=fail (sender IP is 149.199.60.96) smtp.mailfrom=xilinx.com; gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=xilinx.com; Received-SPF: Fail (protection.outlook.com: domain of xilinx.com does not designate 149.199.60.96 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.96; helo=xsj-tvapsmtpgw01; Received: from xsj-tvapsmtpgw01 (149.199.60.96) by SN1NAM02FT014.mail.protection.outlook.com (10.152.72.106) with Microsoft SMTP Server (TLS) id 15.1.337.8 via Frontend Transport; Tue, 24 Nov 2015 05:02:14 +0000 Received: from 172-16-1-203.xilinx.com ([172.16.1.203]:50554 helo=xsj-tvapsmtp02.xilinx.com) by xsj-tvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1a15k5-00057K-GH; Mon, 23 Nov 2015 21:02:13 -0800 Received: from [127.0.0.1] (port=57276 helo=tsj-smtp-dlp1.xlnx.xilinx.com) by xsj-tvapsmtp02.xilinx.com with esmtp (Exim 4.63) (envelope-from ) id 1a15k5-0008Qk-7x; Mon, 23 Nov 2015 21:02:13 -0800 Received: from xsj-tvapsmtp02 (xsj-tvapsmtp02.xilinx.com [172.16.1.203]) by tsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id tAO4uxAd012225; Mon, 23 Nov 2015 20:56:59 -0800 Received: from [172.19.74.182] (port=39824 helo=xsjalistai50.xlnx.xilinx.com) by xsj-tvapsmtp02 with esmtp (Exim 4.63) (envelope-from ) id 1a15k4-0008Qh-DN; Mon, 23 Nov 2015 21:02:12 -0800 From: Alistair Francis To: Date: Mon, 23 Nov 2015 21:00:02 -0800 Message-ID: X-Mailer: git-send-email 2.5.0 X-RCIS-Action: ALLOW X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-8.0.0.1202-21958.005 X-TM-AS-Result: No--9.590-7.0-31-10 X-imss-scan-details: No--9.590-7.0-31-10 X-TMASE-MatchedRID: MUwxCotCix+bGHSBj+j5WWlHv4vQHqYTeJelx5/HhZbiFxcREnURUvJs l+USu3BF7COu1VvmI4YLop34GdsaxxDuooXos5VesK+WWVTsOXWQoBr+SFneJHREeOro/O+vilv Ab18i4hPW7zYc2G55QldTP5dw4GERk76zTpeJgoTJ5W6OZe5hhVgy2ozNthE2mKInQ61iaANxVk X02ZUV+pXl0jnm1bqLHyjPkE/KyqTRHZlD1yPBcZ4CIKY/Hg3AaZGo0EeYG96i9JVLbqc4Fyq2r l3dzGQ1tbM9w0ov2rYi9L71J/TkhtZ5JhQ8Spr4Ytqo3BaACdkTlTHutVcGKQ== X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.96; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(50986999)(5003600100002)(33646002)(118296001)(5007970100001)(47776003)(5001960100002)(86362001)(5003940100001)(105606002)(92566002)(81156007)(229853001)(2351001)(11100500001)(106466001)(586003)(50226001)(85426001)(19580395003)(189998001)(6806005)(110136002)(71366001)(64026002)(15975445007)(36756003)(19580405001)(48376002)(87936001)(15188445003)(50466002)(5008740100001)(77096005)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1NAM02HT170; H:xsj-tvapsmtpgw01; FPR:; SPF:Fail; PTR:unknown-60-96.xilinx.com; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1NAM02HT170; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(520078)(3002001)(10201501046); SRVR:SN1NAM02HT170; BCL:0; PCL:0; RULEID:; SRVR:SN1NAM02HT170; X-Forefront-PRVS: 0770F75EA9 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Nov 2015 05:02:14.2820 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.96]; Helo=[xsj-tvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1NAM02HT170 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.36.89 Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, crosthwaitepeter@gmail.com, edgar.iglesias@gmail.com, alistair.francis@xilinx.com Subject: [Qemu-devel] [PATCH v1 1/1] xlnx-ep108: Add support for high DDR memory regions 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 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 --- 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;