From patchwork Tue Mar 3 00:28:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 445521 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 F1E20140146 for ; Tue, 3 Mar 2015 12:04:21 +1100 (AEDT) Received: from localhost ([::1]:60892 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSbFz-0002Q1-Uv for incoming@patchwork.ozlabs.org; Mon, 02 Mar 2015 20:04:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSbDs-0006TI-1a for qemu-devel@nongnu.org; Mon, 02 Mar 2015 20:02:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YSbDi-0005Aq-3t for qemu-devel@nongnu.org; Mon, 02 Mar 2015 20:02:07 -0500 Received: from mail-bl2on0081.outbound.protection.outlook.com ([65.55.169.81]:7788 helo=na01-bl2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YSbDh-0005AI-Ts for qemu-devel@nongnu.org; Mon, 02 Mar 2015 20:01:58 -0500 Received: from BY2FFO11FD027.protection.gbl (10.1.14.32) by BY2FFO11HUB044.protection.gbl (10.1.15.225) with Microsoft SMTP Server (TLS) id 15.1.99.6; Tue, 3 Mar 2015 00:28:51 +0000 Received: from xsj-tvapsmtpgw01 (149.199.60.96) by BY2FFO11FD027.mail.protection.outlook.com (10.1.15.216) with Microsoft SMTP Server (TLS) id 15.1.99.6 via Frontend Transport; Tue, 3 Mar 2015 00:28:51 +0000 Received: from 172-16-1-203.xilinx.com ([172.16.1.203]:53778 helo=xsj-tvapsmtp02.xilinx.com) by xsj-tvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1YSadl-0001r4-5O; Mon, 02 Mar 2015 16:24:49 -0800 Received: from [127.0.0.1] (port=51353 helo=xsj-tvapsmtp02) by xsj-tvapsmtp02.xilinx.com with esmtp (Exim 4.63) (envelope-from ) id 1YSahf-00048s-1G; Mon, 02 Mar 2015 16:28:51 -0800 Received: from [172.19.74.49] (port=37633 helo=xsjsorenbubuntu.xilinx.com) by xsj-tvapsmtp02 with esmtp (Exim 4.63) (envelope-from ) id 1YSahe-00048p-OT; Mon, 02 Mar 2015 16:28:50 -0800 From: Peter Crosthwaite To: Date: Mon, 2 Mar 2015 16:28:50 -0800 Message-ID: X-Mailer: git-send-email 2.3.0.1.g27a12f1 In-Reply-To: References: X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-7.5.0.1018-21366.005 X-TM-AS-Result: No--6.154-7.0-31-10 X-imss-scan-details: No--6.154-7.0-31-10 X-TMASE-MatchedRID: DfRUKk+cPEN37FC663+5p1z+axQLnAVBQPCWRE0Lo8IXGHD9U1OuR/2B QpWTK4KNjBDXS4YxDzSgGOZ3m2LY56epdpfrXbSjxcKSVmpc2sPDHSNFHFxB85e6URBiqLEnaMv zMbGvEKvC+tSZjRp5PAJnEQZnzKHQnJra0Su7THud4hCa7xSZoZ20dShmm+V5QtAmhdC/04uiQ0 QxVRsW5ueJ5evGGEmfau5NTRwKrytZT98H9cWYnELhYg/sa1gsBGvINcfHqhejC1E/zCEIr1UnQ AOplXiG24H8UfXjxqzzCPLlhTGnu5UxWI+YhDOFngIgpj8eDcAZ1CdBJOsoY8RB0bsfrpPIfiAq rjYtFiQkR82q1jnf8gBrpY08GQbWcp65CD4pnx9cwZN1fPEAzn7cGd19dSFd X-EOPAttributedMessage: 0 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; Authentication-Results: spf=fail (sender IP is 149.199.60.96) smtp.mailfrom=peter.crosthwaite@xilinx.com; nongnu.org; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:149.199.60.96; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(339900001)(189002)(199003)(64026002)(50466002)(48376002)(118296001)(36756003)(33646002)(47776003)(16796002)(76176999)(46102003)(2351001)(50986999)(85426001)(77156002)(19580405001)(6806004)(105606002)(50226001)(62966003)(77096005)(110136001)(106466001)(92566002)(2950100001)(86362001)(19580395003)(87936001)(229853001)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2FFO11HUB044; H:xsj-tvapsmtpgw01; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2FFO11HUB044; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006); SRVR:BY2FFO11HUB044; BCL:0; PCL:0; RULEID:; SRVR:BY2FFO11HUB044; X-Forefront-PRVS: 0504F29D72 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Mar 2015 00:28:51.5143 (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] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2FFO11HUB044 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 65.55.169.81 Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, zach.pfeffer@xilinx.com, ozaki.ryota@gmail.com, alistair.francis@xilinx.com, michals@xilinx.com Subject: [Qemu-devel] [PATCH target-arm v2 03/15] arm: Introduce Xilinx ZynqMP SoC 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 With quad Cortex-A53 CPUs. Signed-off-by: Peter Crosthwaite --- changed since v1: Add &error_abort to CPU child adder call. default-configs/aarch64-softmmu.mak | 2 +- hw/arm/Makefile.objs | 1 + hw/arm/xlnx-zynqmp.c | 71 +++++++++++++++++++++++++++++++++++++ include/hw/arm/xlnx-zynqmp.h | 21 +++++++++++ 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 hw/arm/xlnx-zynqmp.c create mode 100644 include/hw/arm/xlnx-zynqmp.h diff --git a/default-configs/aarch64-softmmu.mak b/default-configs/aarch64-softmmu.mak index 6d3b5c7..96dd994 100644 --- a/default-configs/aarch64-softmmu.mak +++ b/default-configs/aarch64-softmmu.mak @@ -3,4 +3,4 @@ # We support all the 32 bit boards so need all their config include arm-softmmu.mak -# Currently no 64-bit specific config requirements +CONFIG_XLNX_ZYNQMP=y diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs index 6088e53..7c6266f 100644 --- a/hw/arm/Makefile.objs +++ b/hw/arm/Makefile.objs @@ -8,3 +8,4 @@ obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o obj-$(CONFIG_DIGIC) += digic.o obj-y += omap1.o omap2.o strongarm.o obj-$(CONFIG_ALLWINNER_A10) += allwinner-a10.o cubieboard.o +obj-$(CONFIG_XLNX_ZYNQMP) += xlnx-zynqmp.o diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c new file mode 100644 index 0000000..1b58d65 --- /dev/null +++ b/hw/arm/xlnx-zynqmp.c @@ -0,0 +1,71 @@ +/* + * Xilinx Zynq MPSoC emulation + * + * Copyright (C) 2015 Xilinx Inc + * Written by Peter Crosthwaite + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include "hw/arm/xlnx-zynqmp.h" + +static void xlnx_zynqmp_init(Object *obj) +{ + XlnxZynqMPState *s = XLNX_ZYNQMP(obj); + int i; + + for (i = 0; i < XLNX_ZYNQMP_NUM_CPUS; i++) { + object_initialize(&s->cpu[i], sizeof(s->cpu[i]), + "cortex-a53-" TYPE_ARM_CPU); + object_property_add_child(obj, "cpu", OBJECT(&s->cpu[i]), &error_abort); + } +} + +#define ERR_PROP_CHECK_RETURN(err, errp) do { \ + if (err) { \ + error_propagate((errp), (err)); \ + return; \ + } \ +} while (0) + +static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) +{ + XlnxZynqMPState *s = XLNX_ZYNQMP(dev); + uint8_t i; + Error *err = NULL; + + for (i = 0; i < XLNX_ZYNQMP_NUM_CPUS; i++) { + object_property_set_bool(OBJECT(&s->cpu[i]), true, "realized", &err); + ERR_PROP_CHECK_RETURN(err, errp); + } +} + +static void xlnx_zynqmp_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + + dc->realize = xlnx_zynqmp_realize; +} + +static const TypeInfo xlnx_zynqmp_type_info = { + .name = TYPE_XLNX_ZYNQMP, + .parent = TYPE_DEVICE, + .instance_size = sizeof(XlnxZynqMPState), + .instance_init = xlnx_zynqmp_init, + .class_init = xlnx_zynqmp_class_init, +}; + +static void xlnx_zynqmp_register_types(void) +{ + type_register_static(&xlnx_zynqmp_type_info); +} + +type_init(xlnx_zynqmp_register_types) diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h new file mode 100644 index 0000000..d6b3b92 --- /dev/null +++ b/include/hw/arm/xlnx-zynqmp.h @@ -0,0 +1,21 @@ +#ifndef XLNX_ZYNQMP_H_ + +#include "qemu-common.h" +#include "hw/arm/arm.h" + +#define TYPE_XLNX_ZYNQMP "xlnx,zynqmp" +#define XLNX_ZYNQMP(obj) OBJECT_CHECK(XlnxZynqMPState, (obj), \ + TYPE_XLNX_ZYNQMP) + +#define XLNX_ZYNQMP_NUM_CPUS 4 + +typedef struct XlnxZynqMPState { + /*< private >*/ + DeviceState parent_obj; + /*< public >*/ + + ARMCPU cpu[XLNX_ZYNQMP_NUM_CPUS]; +} XlnxZynqMPState; + +#define XLNX_ZYNQMP_H_ +#endif