From patchwork Thu Feb 27 15:44:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11407685 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9FBE714D5 for ; Thu, 27 Feb 2020 03:18:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7673821D7E for ; Thu, 27 Feb 2020 03:18:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DxqWc6eq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7673821D7E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j79h1-0000Uk-MH for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Feb 2020 22:18:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53148) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j79gP-0007ux-Jy for qemu-devel@nongnu.org; Wed, 26 Feb 2020 22:17:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j79gO-0003QU-G2 for qemu-devel@nongnu.org; Wed, 26 Feb 2020 22:17:53 -0500 Received: from mail-lj1-x243.google.com ([2a00:1450:4864:20::243]:40777) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j79gO-0003OJ-8q; Wed, 26 Feb 2020 22:17:52 -0500 Received: by mail-lj1-x243.google.com with SMTP id 143so1474800ljj.7; Wed, 26 Feb 2020 19:17:52 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=omqTFTu+qINNVRrQ0hgXY5Qb04TvdzoxDE5V+PXlLMs=; b=DxqWc6eqRVj2+DzM+VQYfasbcUT3aDE4zTAd60arnk/2B0HqtOK/5Ll3+PHD5Zf5wo vYh0vI6OUE5XJ2Hxce/RSHgNq6+RYHmMEqB15zTLc4BWn7qh956fmNwJA4IWkntfE9lh J9ovzPhySV0PztqNeQj5e/X22TMxoATuMfP+amN7ohvU8oNTNEu/DH/qyMIkzi6+ym7I VbwXUmoXzYAGW6JnwluaNLNgEwEzqLqy6oJVT3qFEMopIkbyvjJuZ/Q5Q+BKRnfbHSyz MQpP84ODKxrfKWdDKy+RML72MR/IHIPHB4EvB2qFuwLIWd46PXjmCXy3xQoAxRLejGuM uHHQ== 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:mime-version:content-transfer-encoding; bh=omqTFTu+qINNVRrQ0hgXY5Qb04TvdzoxDE5V+PXlLMs=; b=CZUJXVqd1tJ285umpgCMZccbLEMBTrBwW5OMrQj9pMMNa1bievP63Q/A3970YSsCTN 15AdTETHetm1tZuwHf3DbaiLCxue6XtfcT5ndsEzj0kCxCfgXzxr0U1CJbZItOyhV+pK YL7BS6dmtf96/DHrCTIuuyu7qD2JAelzuz3fsIz/VvGIpoNjW6sgNyAVQ3tD0HGp0gQ7 of6eUYH1n377RYrRtRDqaDummv5SpX2JGpjxk94/Rd86AMeb9W9ZXi4iIKGbcG0zPNsY tCdk1iQl/5JZMz10Az6Vh4bU+3yPp3LR4QO1R1P40gJceU3KK91jI7xJ+q9MyOBPZlwd Ap3A== X-Gm-Message-State: ANhLgQ1aarViYBWh/onMoiU/6BxJaJozh0Xr5242FRUx9qw/XnpsvDfC Siqss4ziyVTmm8rM9FTKX2NsNbn0wb3vAA== X-Google-Smtp-Source: ADFU+vt7eaqVtqadKqzqDTJW/hcfAPfflg8YHsOLceQui3dlITuuM8ZJ9H8yi8Z7ADSSAf6q7orazQ== X-Received: by 2002:a05:651c:1049:: with SMTP id x9mr1347752ljm.233.1582773470222; Wed, 26 Feb 2020 19:17:50 -0800 (PST) Received: from localhost (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id 23sm2178619ljw.31.2020.02.26.19.17.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 19:17:49 -0800 (PST) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PATCH v1 1/2] hw/arm: versal: Add support for the LPD ADMAs Date: Thu, 27 Feb 2020 16:44:23 +0100 Message-Id: <20200227154424.6849-2-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227154424.6849-1-edgar.iglesias@gmail.com> References: <20200227154424.6849-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::243 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: figlesia@xilinx.com, peter.maydell@linaro.org, sstabellini@kernel.org, edgar.iglesias@xilinx.com, sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com, alistair@alistair23.me, richard.henderson@linaro.org, frederic.konrad@adacore.com, qemu-arm@nongnu.org, philmd@redhat.com, luc.michel@greensocs.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Add support for the Versal LPD ADMAs. Signed-off-by: Edgar E. Iglesias Reviewed-by: KONRAD Frederic Reviewed-by: Francisco Iglesias Reviewed-by: Luc Michel --- hw/arm/xlnx-versal.c | 24 ++++++++++++++++++++++++ include/hw/arm/xlnx-versal.h | 6 ++++++ 2 files changed, 30 insertions(+) diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index 1cf3daaf4f..f9beba07ed 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -193,6 +193,29 @@ static void versal_create_gems(Versal *s, qemu_irq *pic) } } +static void versal_create_admas(Versal *s, qemu_irq *pic) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(s->lpd.iou.adma); i++) { + char *name = g_strdup_printf("adma%d", i); + DeviceState *dev; + MemoryRegion *mr; + + dev = qdev_create(NULL, "xlnx.zdma"); + s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev); + object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal); + qdev_init_nofail(dev); + + mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0); + memory_region_add_subregion(&s->mr_ps, + MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr); + + sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 + i]); + g_free(name); + } +} + /* This takes the board allocated linear DDR memory and creates aliases * for each split DDR range/aperture on the Versal address map. */ @@ -274,6 +297,7 @@ static void versal_realize(DeviceState *dev, Error **errp) versal_create_apu_gic(s, pic); versal_create_uarts(s, pic); versal_create_gems(s, pic); + versal_create_admas(s, pic); versal_map_ddr(s); versal_unimp(s); diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h index d844c4ffe4..6c0a692b2f 100644 --- a/include/hw/arm/xlnx-versal.h +++ b/include/hw/arm/xlnx-versal.h @@ -22,6 +22,7 @@ #define XLNX_VERSAL_NR_ACPUS 2 #define XLNX_VERSAL_NR_UARTS 2 #define XLNX_VERSAL_NR_GEMS 2 +#define XLNX_VERSAL_NR_ADMAS 8 #define XLNX_VERSAL_NR_IRQS 192 typedef struct Versal { @@ -50,6 +51,7 @@ typedef struct Versal { struct { SysBusDevice *uart[XLNX_VERSAL_NR_UARTS]; SysBusDevice *gem[XLNX_VERSAL_NR_GEMS]; + SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS]; } iou; } lpd; @@ -74,6 +76,7 @@ typedef struct Versal { #define VERSAL_GEM0_WAKE_IRQ_0 57 #define VERSAL_GEM1_IRQ_0 58 #define VERSAL_GEM1_WAKE_IRQ_0 59 +#define VERSAL_ADMA_IRQ_0 60 /* Architecturally reserved IRQs suitable for virtualization. */ #define VERSAL_RSVD_IRQ_FIRST 111 @@ -96,6 +99,9 @@ typedef struct Versal { #define MM_GEM1 0xff0d0000U #define MM_GEM1_SIZE 0x10000 +#define MM_ADMA_CH0 0xffa80000U +#define MM_ADMA_CH0_SIZE 0x10000 + #define MM_OCM 0xfffc0000U #define MM_OCM_SIZE 0x40000 From patchwork Thu Feb 27 15:44:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 11407687 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C4558138D for ; Thu, 27 Feb 2020 03:19:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 99E3324672 for ; Thu, 27 Feb 2020 03:19:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dkcsCSMD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 99E3324672 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:53366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j79hz-0001np-Me for patchwork-qemu-devel@patchwork.kernel.org; Wed, 26 Feb 2020 22:19:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53215) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j79gX-00087C-M6 for qemu-devel@nongnu.org; Wed, 26 Feb 2020 22:18:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j79gW-0003dH-Ky for qemu-devel@nongnu.org; Wed, 26 Feb 2020 22:18:01 -0500 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]:46632) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j79gW-0003bj-DX; Wed, 26 Feb 2020 22:18:00 -0500 Received: by mail-lj1-x242.google.com with SMTP id w19so1557856lje.13; Wed, 26 Feb 2020 19:18:00 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=FoZhsAb+/1S+pgpJASq34rn2TkwqgMpwQN0+sRMg6Pw=; b=dkcsCSMD510WAEd8KKw29IhV5MR6L/gd8wBue1RRUd1yjkkBekXN4U2YxqSxy6nNkx KTEzU1sE0Rg8PyE2D5GrAt5J3ykL+q68OHRKZ9/9fpDdh8NG1D7ejLI+pqAowCNlRhCD jgkc34v05obb4LIvUwMghQPM2lCcRFTr8MxixRDdEcx422Vx00ScTTDxIcOJFKY8yDy0 J9UCrTVggMkIBUCJmCvbsV6loKhnlxnYs1X9c5on1P51cxriTmh/mXqMYyuAXqIZMiAQ SGd0022QseUJfkcZRXsnIBfpsrxHZw06MdkKzN7RBV20Mx+liIhDsJkpKm1cAiPoZiz7 5Cjg== 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:mime-version:content-transfer-encoding; bh=FoZhsAb+/1S+pgpJASq34rn2TkwqgMpwQN0+sRMg6Pw=; b=Lu/2X7+DrhDq7TCc9mnHqJLIdy2TJOFwgHIw43NG7rA7DAtHWjNZ//hskESadyc8S9 MD0OSsrfkS/pcJNuzSuoonUCb2bM1/ldggJNko6/8QvTk+m4635khwIgIz/LeCz2G12H sxuNVosxbNCiCLbk4N1xV71Uz9vI+2YjKZ1GIcGKSUcWiFWc8QXAVzlEEGsn8sOFm/h9 B+12wDz7UMpm/JVxhvsVOqLYPqAV07R7TrZv4PJdit31ZJNDNPwkbYc9/kQ2tom0jKhS XOP/DkKL87JNSyERRkvhmoPIHNsu+q9apqOrZhizgEiaRmk5vmYDXh1Let7d6JjI5oWQ /Zdg== X-Gm-Message-State: ANhLgQ1luuxlFl4iY7S02k74TaDSbWOUO3hvtIeYdi1qTCf6xkCbrmrM TC1tuaS/S4ASdvEk/SasvqOETK6y5FWWoA== X-Google-Smtp-Source: ADFU+vuHmHZskKpuGVVzWzwESf2ltMZvLz5q8TSWSaDaxCrcnVNFSOUqKSZp3rCctp8+C/IqTzA6yw== X-Received: by 2002:a2e:b017:: with SMTP id y23mr1309319ljk.229.1582773479032; Wed, 26 Feb 2020 19:17:59 -0800 (PST) Received: from localhost (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id x1sm1071115lfq.46.2020.02.26.19.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Feb 2020 19:17:58 -0800 (PST) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Subject: [PATCH v1 2/2] hw/arm: versal: Generate xlnx-versal-virt zdma FDT nodes Date: Thu, 27 Feb 2020 16:44:24 +0100 Message-Id: <20200227154424.6849-3-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200227154424.6849-1-edgar.iglesias@gmail.com> References: <20200227154424.6849-1-edgar.iglesias@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::242 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: figlesia@xilinx.com, peter.maydell@linaro.org, sstabellini@kernel.org, edgar.iglesias@xilinx.com, sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com, alistair@alistair23.me, richard.henderson@linaro.org, frederic.konrad@adacore.com, qemu-arm@nongnu.org, philmd@redhat.com, luc.michel@greensocs.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Generate xlnx-versal-virt zdma FDT nodes. Signed-off-by: Edgar E. Iglesias Reviewed-by: KONRAD Frederic Reviewed-by: Francisco Iglesias Reviewed-by: Luc Michel --- hw/arm/xlnx-versal-virt.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index e7f4ca8bf9..878a275140 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -229,6 +229,33 @@ static void fdt_add_gem_nodes(VersalVirt *s) } } +static void fdt_add_zdma_nodes(VersalVirt *s) +{ + const char clocknames[] = "clk_main\0clk_apb"; + const char compat[] = "xlnx,zynqmp-dma-1.0"; + int i; + + for (i = XLNX_VERSAL_NR_ADMAS - 1; i >= 0; i--) { + uint64_t addr = MM_ADMA_CH0 + MM_ADMA_CH0_SIZE * i; + char *name = g_strdup_printf("/dma@%" PRIx64, addr); + + qemu_fdt_add_subnode(s->fdt, name); + + qemu_fdt_setprop_cell(s->fdt, name, "xlnx,bus-width", 64); + qemu_fdt_setprop_cells(s->fdt, name, "clocks", + s->phandle.clk_25Mhz, s->phandle.clk_25Mhz); + qemu_fdt_setprop(s->fdt, name, "clock-names", + clocknames, sizeof(clocknames)); + qemu_fdt_setprop_cells(s->fdt, name, "interrupts", + GIC_FDT_IRQ_TYPE_SPI, VERSAL_ADMA_IRQ_0 + i, + GIC_FDT_IRQ_FLAGS_LEVEL_HI); + qemu_fdt_setprop_sized_cells(s->fdt, name, "reg", + 2, addr, 2, 0x1000); + qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat)); + g_free(name); + } +} + static void fdt_nop_memory_nodes(void *fdt, Error **errp) { Error *err = NULL; @@ -427,6 +454,7 @@ static void versal_virt_init(MachineState *machine) fdt_add_uart_nodes(s); fdt_add_gic_nodes(s); fdt_add_timer_nodes(s); + fdt_add_zdma_nodes(s); fdt_add_cpu_nodes(s, psci_conduit); fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz); fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);