From patchwork Wed May 6 22:50:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 469167 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 C96F214027C for ; Thu, 7 May 2015 08:58:40 +1000 (AEST) Received: from localhost ([::1]:47418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq8H1-0006fm-4f for incoming@patchwork.ozlabs.org; Wed, 06 May 2015 18:58:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq89Q-0002Xj-V8 for qemu-devel@nongnu.org; Wed, 06 May 2015 18:50:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yq89L-00067w-DW for qemu-devel@nongnu.org; Wed, 06 May 2015 18:50:48 -0400 Received: from mail-by2on0057.outbound.protection.outlook.com ([207.46.100.57]:49488 helo=na01-by2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yq89L-000673-34 for qemu-devel@nongnu.org; Wed, 06 May 2015 18:50:43 -0400 Received: from BN1BFFO11FD018.protection.gbl (10.58.144.31) by BN1BFFO11HUB012.protection.gbl (10.58.144.159) with Microsoft SMTP Server (TLS) id 15.1.160.8; Wed, 6 May 2015 22:50:41 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; nongnu.org; dkim=none (message not signed) header.d=none; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by BN1BFFO11FD018.mail.protection.outlook.com (10.58.144.81) with Microsoft SMTP Server (TLS) id 15.1.160.8 via Frontend Transport; Wed, 6 May 2015 22:50:40 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:43684 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1Yq80g-0006ZR-BH; Wed, 06 May 2015 15:41:46 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1Yq89H-00029R-7a; Wed, 06 May 2015 15:50:39 -0700 Received: from xsj-pvapsmtp01 (xsj-smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id t46MoBh1014241; Wed, 6 May 2015 15:50:11 -0700 Received: from [172.19.74.49] (helo=xsjsorenbubuntu.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1Yq897-00027l-9E; Wed, 06 May 2015 15:50:29 -0700 From: Peter Crosthwaite To: Date: Wed, 6 May 2015 15:50:29 -0700 Message-ID: X-Mailer: git-send-email 2.4.0.3.ge0ccc3b.dirty In-Reply-To: References: X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-7.5.0.1018-21524.005 X-TM-AS-User-Approved-Sender: Yes;Yes;Yes X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.100; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(438002)(189002)(199003)(6806004)(46102003)(2950100001)(33646002)(106466001)(50466002)(50986999)(76176999)(2351001)(63266004)(92566002)(5001960100002)(19580395003)(229853001)(19580405001)(118296001)(110136002)(47776003)(107886002)(50226001)(87936001)(36386004)(77096005)(62966003)(77156002)(48376002)(36756003)(575784001)(189998001)(86362001)(450100001)(107986001)(4001430100001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1BFFO11HUB012; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1BFFO11HUB012; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BN1BFFO11HUB012; BCL:0; PCL:0; RULEID:; SRVR:BN1BFFO11HUB012; X-Forefront-PRVS: 0568F32D91 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2015 22:50:40.6045 (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.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1BFFO11HUB012 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 207.46.100.57 Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, zach.pfeffer@xilinx.com, jues@xilinx.com, ozaki.ryota@gmail.com, alistair.francis@xilinx.com, michals@xilinx.com Subject: [Qemu-devel] [PATCH target-arm v7 14/15] arm: xlnx-ep108: Add external RAM 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 Zynq MPSoC supports external DDR RAM. Add a RAM at 0 to the model. Reviewed-by: Alistair Francis Tested-by: Alistair Francis Signed-off-by: Peter Crosthwaite --- changed since v4: Use memory_region_allocate_system_memory Change too-small warning to be qemu_log changed since v1: Add ram size clamps and warnings hw/arm/xlnx-ep108.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/hw/arm/xlnx-ep108.c b/hw/arm/xlnx-ep108.c index 81704bb..46f145b 100644 --- a/hw/arm/xlnx-ep108.c +++ b/hw/arm/xlnx-ep108.c @@ -18,11 +18,16 @@ #include "hw/arm/xlnx-zynqmp.h" #include "hw/boards.h" #include "qemu/error-report.h" +#include "exec/address-spaces.h" typedef struct XlnxEP108 { XlnxZynqMPState soc; + MemoryRegion ddr_ram; } XlnxEP108; +/* Max 2GB RAM */ +#define EP108_MAX_RAM_SIZE 0x80000000ull + static void xlnx_ep108_init(MachineState *machine) { XlnxEP108 *s = g_new0(XlnxEP108, 1); @@ -37,6 +42,21 @@ static void xlnx_ep108_init(MachineState *machine) error_report("%s", error_get_pretty(err)); 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); } static QEMUMachine xlnx_ep108_machine = {