From nobody Wed Oct 29 17:16:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525384073879253.73712933424122; Thu, 3 May 2018 14:47:53 -0700 (PDT) Received: from localhost ([::1]:59246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEM4k-0002ot-CG for importer@patchew.org; Thu, 03 May 2018 17:47:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fELzN-00076I-7m for qemu-devel@nongnu.org; Thu, 03 May 2018 17:42:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fELzM-0008WC-7N for qemu-devel@nongnu.org; Thu, 03 May 2018 17:42:09 -0400 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:42021) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fELzL-0008VX-RY for qemu-devel@nongnu.org; Thu, 03 May 2018 17:42:08 -0400 Received: by mail-lf0-x243.google.com with SMTP id u21-v6so28121320lfu.9 for ; Thu, 03 May 2018 14:42:07 -0700 (PDT) Received: from localhost.localdomain (94-255-130-40.cust.bredband2.com. [94.255.130.40]) by smtp.gmail.com with ESMTPSA id y24-v6sm2998362ljy.21.2018.05.03.14.42.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 14:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SBvzpw9PHv/yAwtzYVam4yZ6hnu1De0n2acTIHOJrAU=; b=DV8qrDHVQSHCC510SjaBQoRzaOwTuG8h8kv7qYIbz6JZt03iTHni4FasGm68U7TRd1 Mv0dWtahk/PTT0ilvHJuH0olZq37l88Awuy4SBbsfRLeA9jlno/5vhEmTMz186qsMbDp FXYyLTpoD5MWkoyDYqkcUUF1vjLhBkGR5x56W7I6iXdQMckOxrNm6VZVECiMe2QL7+Ql 21OZfaQjyQdZygS4WSvFZMXGEOjRvOZ0/TYKrW6z2kxuoORML8gj57DyUs4dDgmRJngL i4LHHJhD2JY9iMXrc+2BdgC65XQd1sDftsD+YDMlVDK0ufahQHpiKbqBES+zrq5IVmin YQHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SBvzpw9PHv/yAwtzYVam4yZ6hnu1De0n2acTIHOJrAU=; b=BkAGwjjaLtSav1IrFlA0UWrqG7mNuwAcRurETNPgiwDWLmiMzv2wokkOYqr4vvdRed VulCAsSkGwp9BDV3ISfe/XGwyN/vRF+U60oteRbj3iaVM8BLnkUnlwKlK8EgRP/Puypw BBCp7xBmS/Wa13uG1nCBwFHmIXXKQc2f+Cln60kvPQCr/qeMYoXUAkgFf23wIL+zwNQp 8uFpujomiezgsy9Ke0JZEnCIPFmd8Lpu0onMwkCDD5zvF9Cc0JWxO9l1wgnk0CAHbLTD jDsMtCM1sU+U5QL/Y0KdCBKdgfHu4ujS4seH3re6n3vDNx7q/wD8UIY77s4aCW/so+Jw f/GQ== X-Gm-Message-State: ALQs6tAOncdwzGlCpRO+3y/jH/BVo8ZtDsm1GbZp0Dd/59wSq1MbE8nF Pxe9BszuKpYUXlkBH3V5XVLszmFd X-Google-Smtp-Source: AB8JxZoWF0wxiHPpB652Up82b+ZlxxEO7QztNDE8jj+yxr9+ebZH8Y7vuB6ETwcbaEIfGlJGm5h5tw== X-Received: by 2002:a2e:2a45:: with SMTP id q66-v6mr11366741ljq.40.1525383726286; Thu, 03 May 2018 14:42:06 -0700 (PDT) From: Francisco Iglesias To: qemu-devel@nongnu.org Date: Thu, 3 May 2018 23:42:01 +0200 Message-Id: <20180503214201.29082-3-frasse.iglesias@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180503214201.29082-1-frasse.iglesias@gmail.com> References: <20180503214201.29082-1-frasse.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::243 Subject: [Qemu-devel] [PATCH v3 2/2] xlnx-zynqmp: Connect the ZynqMP GDMA and ADMA 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: peter.maydell@linaro.org, francisco.iglesias@feimtech.se, sai.pavan.boddu@xilinx.com, alistair@alistair23.me, edgari@xilinx.com, alistair23@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ZynqMP contains two instances of a generic DMA, the GDMA, located in the FPD (full power domain), and the ADMA, located in LPD (low power domain). = This patch adds these two DMAs to the ZynqMP board. Signed-off-by: Francisco Iglesias Reviewed-by: Alistair Francis Reviewed-by: Edgar E. Iglesias --- hw/arm/xlnx-zynqmp.c | 53 ++++++++++++++++++++++++++++++++++++++++= ++++ include/hw/arm/xlnx-zynqmp.h | 5 +++++ 2 files changed, 58 insertions(+) diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index 505253e0d2..2045b9d71e 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -90,6 +90,24 @@ static const int spi_intr[XLNX_ZYNQMP_NUM_SPIS] =3D { 19, 20, }; =20 +static const uint64_t gdma_ch_addr[XLNX_ZYNQMP_NUM_GDMA_CH] =3D { + 0xFD500000, 0xFD510000, 0xFD520000, 0xFD530000, + 0xFD540000, 0xFD550000, 0xFD560000, 0xFD570000 +}; + +static const int gdma_ch_intr[XLNX_ZYNQMP_NUM_GDMA_CH] =3D { + 124, 125, 126, 127, 128, 129, 130, 131 +}; + +static const uint64_t adma_ch_addr[XLNX_ZYNQMP_NUM_ADMA_CH] =3D { + 0xFFA80000, 0xFFA90000, 0xFFAA0000, 0xFFAB0000, + 0xFFAC0000, 0xFFAD0000, 0xFFAE0000, 0xFFAF0000 +}; + +static const int adma_ch_intr[XLNX_ZYNQMP_NUM_ADMA_CH] =3D { + 77, 78, 79, 80, 81, 82, 83, 84 +}; + typedef struct XlnxZynqMPGICRegion { int region_index; uint32_t address; @@ -197,6 +215,16 @@ static void xlnx_zynqmp_init(Object *obj) =20 object_initialize(&s->rtc, sizeof(s->rtc), TYPE_XLNX_ZYNQMP_RTC); qdev_set_parent_bus(DEVICE(&s->rtc), sysbus_get_default()); + + for (i =3D 0; i < XLNX_ZYNQMP_NUM_GDMA_CH; i++) { + object_initialize(&s->gdma[i], sizeof(s->gdma[i]), TYPE_XLNX_ZDMA); + qdev_set_parent_bus(DEVICE(&s->gdma[i]), sysbus_get_default()); + } + + for (i =3D 0; i < XLNX_ZYNQMP_NUM_ADMA_CH; i++) { + object_initialize(&s->adma[i], sizeof(s->adma[i]), TYPE_XLNX_ZDMA); + qdev_set_parent_bus(DEVICE(&s->adma[i]), sysbus_get_default()); + } } =20 static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) @@ -492,6 +520,31 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Erro= r **errp) } sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, RTC_ADDR); sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0, gic_spi[RTC_IRQ]); + + for (i =3D 0; i < XLNX_ZYNQMP_NUM_GDMA_CH; i++) { + object_property_set_uint(OBJECT(&s->gdma[i]), 128, "bus-width", &e= rr); + object_property_set_bool(OBJECT(&s->gdma[i]), true, "realized", &e= rr); + if (err) { + error_propagate(errp, err); + return; + } + + sysbus_mmio_map(SYS_BUS_DEVICE(&s->gdma[i]), 0, gdma_ch_addr[i]); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->gdma[i]), 0, + gic_spi[gdma_ch_intr[i]]); + } + + for (i =3D 0; i < XLNX_ZYNQMP_NUM_ADMA_CH; i++) { + object_property_set_bool(OBJECT(&s->adma[i]), true, "realized", &e= rr); + if (err) { + error_propagate(errp, err); + return; + } + + sysbus_mmio_map(SYS_BUS_DEVICE(&s->adma[i]), 0, adma_ch_addr[i]); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->adma[i]), 0, + gic_spi[adma_ch_intr[i]]); + } } =20 static Property xlnx_zynqmp_props[] =3D { diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h index 3b613e364d..82b6ec2486 100644 --- a/include/hw/arm/xlnx-zynqmp.h +++ b/include/hw/arm/xlnx-zynqmp.h @@ -27,6 +27,7 @@ #include "hw/sd/sdhci.h" #include "hw/ssi/xilinx_spips.h" #include "hw/dma/xlnx_dpdma.h" +#include "hw/dma/xlnx-zdma.h" #include "hw/display/xlnx_dp.h" #include "hw/intc/xlnx-zynqmp-ipi.h" #include "hw/timer/xlnx-zynqmp-rtc.h" @@ -41,6 +42,8 @@ #define XLNX_ZYNQMP_NUM_UARTS 2 #define XLNX_ZYNQMP_NUM_SDHCI 2 #define XLNX_ZYNQMP_NUM_SPIS 2 +#define XLNX_ZYNQMP_NUM_GDMA_CH 8 +#define XLNX_ZYNQMP_NUM_ADMA_CH 8 =20 #define XLNX_ZYNQMP_NUM_QSPI_BUS 2 #define XLNX_ZYNQMP_NUM_QSPI_BUS_CS 2 @@ -94,6 +97,8 @@ typedef struct XlnxZynqMPState { XlnxDPDMAState dpdma; XlnxZynqMPIPI ipi; XlnxZynqMPRTC rtc; + XlnxZDMA gdma[XLNX_ZYNQMP_NUM_GDMA_CH]; + XlnxZDMA adma[XLNX_ZYNQMP_NUM_ADMA_CH]; =20 char *boot_cpu; ARMCPU *boot_cpu_ptr; --=20 2.11.0