From patchwork Thu Jan 18 18:37:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 863088 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="opRc/PNx"; dkim-atps=neutral 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 3zMtGx6rWMz9s7M for ; Fri, 19 Jan 2018 05:47:05 +1100 (AEDT) Received: from localhost ([::1]:47257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecFDM-0002ZX-2r for incoming@patchwork.ozlabs.org; Thu, 18 Jan 2018 13:47:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41568) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecF8n-0007Wy-P3 for qemu-devel@nongnu.org; Thu, 18 Jan 2018 13:42:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecF8m-0002uI-KC for qemu-devel@nongnu.org; Thu, 18 Jan 2018 13:42:21 -0500 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:33886) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecF8m-0002tK-EO; Thu, 18 Jan 2018 13:42:20 -0500 Received: by mail-pg0-x244.google.com with SMTP id r19so9226053pgn.1; Thu, 18 Jan 2018 10:42:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=4PD0rX+ehRqeGVEgZCEmzpG5PrlM5EKNAZ23K4vpNvQ=; b=opRc/PNxQc0MWY9CU0B/i9E3fl6fkqfI/F96KwOjevhyvpJ55w7VnX9iuyfaqivpFq eAJMr9T/wAdTXWH68hY8O+J7nwQ8FSB4MeXQdPOqehFF90llrcl0Pf7hkZsn71v9YupX ZgAzkUH4Egl9ijIFWIyB8FwB8CpSdTW9W1uB9e4sBQquhVlRX6VGEYfXHGJ5wqh66EIN H2llbcH7KOMv5iEIaOvp0Jq8F1NxoJj+NCDUbfiHHKFK0YTXHGUtPrIQGV0pLK+Z8Z8K L+tl1UwdwTghoLMgAFMW5ujndKFYu5COa26qEa78QGDGUNowffOev2sc3eukhJ19QpVL +ayg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=4PD0rX+ehRqeGVEgZCEmzpG5PrlM5EKNAZ23K4vpNvQ=; b=qQajT6KTXIchRVGRpK3qKzf5B/H/jYA2HwvKe8yjqxLZ4keQdTA3vQjRi7fqxF7kWA 5RCuwdu2PHmDbsdOeVFNyFqbA3FU5MwdaY7ysOCLK+5dNbsuOPK7gyMF2oWJs35zBxaX 2HxeOPGETg4i9YU3UpubEmCEYgLJ22Mhj2NcNsw/gYRAfrQfNP+YLdp+lVam7W+wv2Ak dvDuh+yMhuV/8kN72HewPPelkjVi5y8thrKstNJMIRD5wkFo6o1T8xeHNYCVv4UZlmgU +s1tMU6WbJW9AaJqDg2geUDqwhMRFkoZxJFlmKMs15ri765Z+G0zlI0ZDsxSvGGTusLo XYpg== X-Gm-Message-State: AKwxytc/Qa7wCv/7QDvN8NgnNYWadxYkrtqQubV4uEX0m9ra/+vurQrQ tRpvL6IswqydPfc+5fl/lIN0GOMG74k= X-Google-Smtp-Source: ACJfBotRxFAeNfsOMVr4sURBpQx/S/FgPJ85AI1nIJY9GbE9lBt751W+7QUHL/Wj3e51k6IO1nzbvQ== X-Received: by 10.98.73.76 with SMTP id w73mr19994486pfa.61.1516300939137; Thu, 18 Jan 2018 10:42:19 -0800 (PST) Received: from localhost ([149.199.62.254]) by smtp.gmail.com with ESMTPSA id s3sm12715091pgo.80.2018.01.18.10.42.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Jan 2018 10:42:18 -0800 (PST) From: Alistair Francis To: qemu-devel@nongnu.org, edgar.iglesias@xilinx.com, edgar.iglesias@gmail.com Date: Thu, 18 Jan 2018 10:37:53 -0800 Message-Id: <2e485623ed9b03113e937c9687553bb2cad22515.1516300623.git.alistair.francis@xilinx.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH v6 2/9] xlnx-zynqmp-pmu: Initial commit of the ZynqMP PMU X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alistair23@gmail.com, qemu-arm@nongnu.org, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The Xilinx ZynqMP SoC has two main processing systems in it. The ARM processing system (which is already modeled in QEMU) and the MicroBlaze Power Management Unit (PMU). This is the inital work for adding support for the PMU. The PMU susbsystem runs along side the ARM system on hardware, but due to architecture limitations in QEMU the two instances are seperate for the time being. Let's follow the same setup we do with the ARM system, where there is an SoC device and a ZCU102 board. Although the PMU is less board specific we are still going to follow the same split as maybe in future we can connect the PMU device to the ARM ZCU102 board. As the machine will be fairly small let's keep them both together in one file. Signed-off-by: Alistair Francis Reviewed-by: Edgar E. Iglesias --- V4: - Rename to remove ZCU102 name hw/microblaze/xlnx-zynqmp-pmu.c | 83 +++++++++++++++++++++++++++++++++++++++++ hw/microblaze/Makefile.objs | 1 + 2 files changed, 84 insertions(+) create mode 100644 hw/microblaze/xlnx-zynqmp-pmu.c diff --git a/hw/microblaze/xlnx-zynqmp-pmu.c b/hw/microblaze/xlnx-zynqmp-pmu.c new file mode 100644 index 0000000000..ac0f78928a --- /dev/null +++ b/hw/microblaze/xlnx-zynqmp-pmu.c @@ -0,0 +1,83 @@ +/* + * Xilinx Zynq MPSoC PMU (Power Management Unit) emulation + * + * Copyright (C) 2017 Xilinx Inc + * Written by Alistair Francis + * + * 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 "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu-common.h" +#include "hw/boards.h" +#include "cpu.h" + +/* Define the PMU device */ + +#define TYPE_XLNX_ZYNQMP_PMU_SOC "xlnx,zynqmp-pmu-soc" +#define XLNX_ZYNQMP_PMU_SOC(obj) OBJECT_CHECK(XlnxZynqMPPMUSoCState, (obj), \ + TYPE_XLNX_ZYNQMP_PMU_SOC) + +typedef struct XlnxZynqMPPMUSoCState { + /*< private >*/ + DeviceState parent_obj; + + /*< public >*/ +} XlnxZynqMPPMUSoCState; + +static void xlnx_zynqmp_pmu_soc_init(Object *obj) +{ + +} + +static void xlnx_zynqmp_pmu_soc_realize(DeviceState *dev, Error **errp) +{ + +} + +static void xlnx_zynqmp_pmu_soc_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(oc); + + dc->realize = xlnx_zynqmp_pmu_soc_realize; +} + +static const TypeInfo xlnx_zynqmp_pmu_soc_type_info = { + .name = TYPE_XLNX_ZYNQMP_PMU_SOC, + .parent = TYPE_DEVICE, + .instance_size = sizeof(XlnxZynqMPPMUSoCState), + .instance_init = xlnx_zynqmp_pmu_soc_init, + .class_init = xlnx_zynqmp_pmu_soc_class_init, +}; + +static void xlnx_zynqmp_pmu_soc_register_types(void) +{ + type_register_static(&xlnx_zynqmp_pmu_soc_type_info); +} + +type_init(xlnx_zynqmp_pmu_soc_register_types) + +/* Define the PMU Machine */ + +static void xlnx_zynqmp_pmu_init(MachineState *machine) +{ + +} + +static void xlnx_zynqmp_pmu_machine_init(MachineClass *mc) +{ + mc->desc = "Xilinx ZynqMP PMU machine"; + mc->init = xlnx_zynqmp_pmu_init; +} + +DEFINE_MACHINE("xlnx-zynqmp-pmu", xlnx_zynqmp_pmu_machine_init) + diff --git a/hw/microblaze/Makefile.objs b/hw/microblaze/Makefile.objs index b2517d87fe..ae9fd40de7 100644 --- a/hw/microblaze/Makefile.objs +++ b/hw/microblaze/Makefile.objs @@ -1,3 +1,4 @@ obj-y += petalogix_s3adsp1800_mmu.o obj-y += petalogix_ml605_mmu.o +obj-y += xlnx-zynqmp-pmu.o obj-y += boot.o