Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp97859imm; Fri, 19 Oct 2018 18:33:36 -0700 (PDT) X-Google-Smtp-Source: ACcGV62dsvqCGs8mmUpuyFdsKl8ydXqPJE0201QPe1btGbLqrjAB4w1N+MGjmd2XXweupq7GgFfG X-Received: by 2002:a63:ce56:: with SMTP id r22-v6mr34255679pgi.217.1539999216859; Fri, 19 Oct 2018 18:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539999216; cv=none; d=google.com; s=arc-20160816; b=W6IyDmJvwjjjqUe8wu6cKBVX4iv38YkCMVaWHWK2W9hE/2Kd9BJHm2cKs2U1TqyZH0 /rDtO0RRdprB0udvVZ/uQKvSvTMMaYlrGdOGRGbxuzL6k/UQAylxHvWH6E0MupyJEK2p hD4DZ8bBNgf+nB6kuBqs6HeKZGU3aM7i1TzjI1nM192dHhjPA7Wy2lxERmxz3YcX4Aq3 rQnnE8bJOsT1XC/tPhmcKwd/RyCqWmKuEkkLhN/mBnsxI82LCD1oUKB6JYv7GUshcNO+ MJpNiymO+RxI6/KsnN2JlLjewZSRNkKEC6hhKcgDcf0maLufCySfHkTDy6r+kyBH08nE 1n2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=lfBCY+jVm4meyIF8di3VTswfLB3IYpoyXhqqSGzYHKM=; b=wvJLSNynVuPEUmr3oAhOrYq4dNep5RKRHbXVTSWR81OMq1DS/7KSBffHzwQa23tjDD V3zZHWDAU0KqBFDtRZY98JZyw2qg0ltr3P3sSxtsu1eRT6JaHpCnqQ4HLjOediobMNsD K37EzgQlQf0ZMmeCbZ6lqjWgW4bwOReL8R8XOZv1cxoyMMrcpEFuBboRL08XFjl7AbNv 4YokEbt7Ii7Y/W93R/dQrRthz4d4g6jDKdof+sy6alJDA0fkizby6sg07LOyMTpEH0Bj 0eZTHoduzu49dWOfXQ+iGrQuggkNxLnvhGxvX/vPkqVjn9onhIUq3QjO2XmuqTkPDqx1 t+Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ettus-com.20150623.gappssmtp.com header.s=20150623 header.b=RtPT6U+j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v67-v6si27001159pfk.264.2018.10.19.18.33.21; Fri, 19 Oct 2018 18:33:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ettus-com.20150623.gappssmtp.com header.s=20150623 header.b=RtPT6U+j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727433AbeJTJkl (ORCPT + 99 others); Sat, 20 Oct 2018 05:40:41 -0400 Received: from mail-yb1-f194.google.com ([209.85.219.194]:41616 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726758AbeJTJkl (ORCPT ); Sat, 20 Oct 2018 05:40:41 -0400 Received: by mail-yb1-f194.google.com with SMTP id e16-v6so13986032ybk.8 for ; Fri, 19 Oct 2018 18:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ettus-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lfBCY+jVm4meyIF8di3VTswfLB3IYpoyXhqqSGzYHKM=; b=RtPT6U+jllUQt+zhl5SoXN1ejmWfx2rvWy3loHdvFuUSHZXRjumN3UlqfVCkQYAbTS eXJz/f6aHsu2foDvM3JzWdiUYJin0CBzfxkwFMl3SOqhfTjjGjxILhbEMmTg9txm8Iyq dYcfl9HTlCkOmQAU2KiSy+9uOt0gIFeBCmCtUHbpgzBdjA11S4yIjEXGnJ6GNHKxXxXt PgVTtVQQDQqyLTMG1oPjlO9FarrKZ+WbAAPwoCikodwLmex7E4M8tBnkZhrmvhSYikaj AFquzD9iTNHfUT4LpKPgLzae1kKU868M0u4+Bjo6TsBFB0bNvJm7xtSrX9JhRzbiSWWh gGmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lfBCY+jVm4meyIF8di3VTswfLB3IYpoyXhqqSGzYHKM=; b=mxBf6YoyqWwD1nTh7B0UtDMf7INj0tZVsJI/y9xYuNH4P/d9py574Xz/jTAtLLQXWG 5CTZCNzMq17M3KFLC3O0zNKa25T50ueRGgspG1v137bTUKuAKUMeRMCicguP9n8PRMbr FiSDL02ikD5EbGZ1Et/uo518WWvT7ywHiV/QTO+G0lY5QaSE8pt64bnxJskHNZ91DcM/ Bg9llEFdEP+QZUB0k3LQpXmxMZdei3AfL0Z3eK+x/iWcqLe9vgCBPvNQouIg95Q0Ffzl Bzw5+jlsKUo+wyey8f+5L7ePriPTXXRJcQDBNyCw0aLxtr4eOk43x2qVeEY9IH8c8cVL aSBQ== X-Gm-Message-State: ABuFfoiMzXd5HEBSCzfwD7TJ6aZZj2J+gO7pTiz5B7yapTMdLOXNBUAW DwZwmuRy/wVDqGpPchiaES3Uhj5PKPTXlbjQhFBx/g== X-Received: by 2002:a25:948:: with SMTP id u8-v6mr23962381ybm.301.1539999123896; Fri, 19 Oct 2018 18:32:03 -0700 (PDT) MIME-Version: 1.0 References: <20181020084805.29103-1-nava.manne@xilinx.com> <20181020084805.29103-4-nava.manne@xilinx.com> In-Reply-To: From: Moritz Fischer Date: Fri, 19 Oct 2018 18:31:52 -0700 Message-ID: Subject: Re: [PATCH 3/3] fpga manager: Adding FPGA Manager support for Xilinx zynqmp To: Moritz Fischer Cc: nava.manne@xilinx.com, Alan Tull , Rob Herring , Mark Rutland , Michal Simek , rajanv@xilinx.com, Jolly Shah , linux-fpga@vger.kernel.org, Devicetree List , linux-arm-kernel , Linux Kernel Mailing List , chinnikishore369@gmail.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 19, 2018 at 2:33 PM Moritz Fischer wrote: > > Hi Nava, > > Looks good to me, a couple of nits inline below. > > On Fri, Oct 19, 2018 at 1:50 AM Nava kishore Manne > wrote: > > > > This patch adds FPGA Manager support for the Xilinx > > ZynqMp chip. > > Isn't it ZynqMP ? > > > > Signed-off-by: Nava kishore Manne > > --- > > Changes for v1: > > -None. > > > > Changes for RFC-V2: > > -Updated the Fpga Mgr registrations call's > > to 4.18 > > > > drivers/fpga/Kconfig | 9 +++ > > drivers/fpga/Makefile | 1 + > > drivers/fpga/zynqmp-fpga.c | 159 +++++++++++++++++++++++++++++++++++++ > > 3 files changed, 169 insertions(+) > > create mode 100644 drivers/fpga/zynqmp-fpga.c > > > > diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig > > index 1ebcef4bab5b..26ebbcf3d3a3 100644 > > --- a/drivers/fpga/Kconfig > > +++ b/drivers/fpga/Kconfig > > @@ -56,6 +56,15 @@ config FPGA_MGR_ZYNQ_FPGA > > help > > FPGA manager driver support for Xilinx Zynq FPGAs. > > > > +config FPGA_MGR_ZYNQMP_FPGA > > + tristate "Xilinx Zynqmp FPGA" > > + depends on ARCH_ZYNQMP || COMPILE_TEST > > + help > > + FPGA manager driver support for Xilinx ZynqMP FPGAs. > > + This driver uses processor configuration port(PCAP) > This driver uses *the* processor configuration port. > > > + to configure the programmable logic(PL) through PS > > + on ZynqMP SoC. > > + > > config FPGA_MGR_XILINX_SPI > > tristate "Xilinx Configuration over Slave Serial (SPI)" > > depends on SPI > > diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile > > index 7a2d73ba7122..3488ebbaee46 100644 > > --- a/drivers/fpga/Makefile > > +++ b/drivers/fpga/Makefile > > @@ -16,6 +16,7 @@ obj-$(CONFIG_FPGA_MGR_SOCFPGA_A10) += socfpga-a10.o > > obj-$(CONFIG_FPGA_MGR_TS73XX) += ts73xx-fpga.o > > obj-$(CONFIG_FPGA_MGR_XILINX_SPI) += xilinx-spi.o > > obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o > > +obj-$(CONFIG_FPGA_MGR_ZYNQMP_FPGA) += zynqmp-fpga.o > > obj-$(CONFIG_ALTERA_PR_IP_CORE) += altera-pr-ip-core.o > > obj-$(CONFIG_ALTERA_PR_IP_CORE_PLAT) += altera-pr-ip-core-plat.o > > > > diff --git a/drivers/fpga/zynqmp-fpga.c b/drivers/fpga/zynqmp-fpga.c > > new file mode 100644 > > index 000000000000..2760d7e3872a > > --- /dev/null > > +++ b/drivers/fpga/zynqmp-fpga.c > > @@ -0,0 +1,159 @@ > > +// SPDX-License-Identifier: GPL-2.0+ > > +/* > > + * Copyright (C) 2018 Xilinx, Inc. > > + */ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +/* Constant Definitions */ > > +#define IXR_FPGA_DONE_MASK 0X00000008U > > + > > +/** > > + * struct zynqmp_fpga_priv - Private data structure > > + * @dev: Device data structure > > + * @flags: flags which is used to identify the bitfile type > > + */ > > +struct zynqmp_fpga_priv { > > + struct device *dev; > > + u32 flags; > > +}; > > + > > +static int zynqmp_fpga_ops_write_init(struct fpga_manager *mgr, > > + struct fpga_image_info *info, > > + const char *buf, size_t size) > > +{ > > + struct zynqmp_fpga_priv *priv; > > + > > + priv = mgr->priv; > > + priv->flags = info->flags; > > + > > + return 0; > > +} > > + > > +static int zynqmp_fpga_ops_write(struct fpga_manager *mgr, > > + const char *buf, size_t size) > > +{ > > + struct zynqmp_fpga_priv *priv; > > + char *kbuf; > > + dma_addr_t dma_addr; > > + int ret; > > + const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops(); > > Reverse xmas-tree please, i.e. long lines first. > > > + > > + if (!eemi_ops || !eemi_ops->fpga_load) > > + return -ENXIO; > > + > > + priv = mgr->priv; > > + > > + kbuf = dma_alloc_coherent(priv->dev, size, &dma_addr, GFP_KERNEL); > > + if (!kbuf) > > + return -ENOMEM; > > + > > + memcpy(kbuf, buf, size); > > + > > + wmb(); /* ensure all writes are done before initiate FW call */ > > + > > + ret = eemi_ops->fpga_load(dma_addr, size, priv->flags); Don't you have to do anything with the flags? Is it really just a pass-through of FPGA manager flags to eemi calls? Don't you want to make partial bitstreams e.g. use a flags value that you export in your firmware header (xlnx-zynqmp.h) and set those based on what flags get passed in, i.e. explicitely translate FPGA Manager flags to your firmware flags? Thanks, Moritz