XRT Alveo driver overview
Subsystems (2)
v2 cover XRT Alveo driver overview
Hello,
This is V2 of patch series which adds management physical function driver for Xilinx Alveo PCIe accelerator cards,
https://www.xilinx.com/products/boards-and-kits/alveo.html
This driver is part of Xilinx Runtime (XRT) open source stack.
The patch series depends on libfdt patches which were posted before:
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
ALVEO PLATFORM ARCHITECTURE
Alveo PCIe FPGA based platforms have a static *shell* partition and a partial re-configurable *user* partition. The shell partition is automatically loaded from flash when host is booted and PCIe is enumerated by BIOS. Shell cannot be changed till the next cold reboot. The shell exposes two PCIe physical functions:
1. management physical function
2. user physical function
The patch series includes Documentation/xrt.rst which describes Alveo platform, XRT driver architecture and deployment model in more detail.
Users compile their high level design in C/C++/OpenCL or RTL into FPGA image using Vitis https://www.xilinx.com/products/design-tools/vitis/vitis-platform.html
tools. The compiled image is packaged as xclbin and contains partial bitstream for the user partition and necessary metadata. Users can dynamically swap the image running on the user partition in order to switch between different workloads.
XRT DRIVERS FOR ALVEO
XRT Linux kernel driver *xmgmt* binds to management physical function of Alveo platform. The modular driver framework is organized into several platform drivers which primarily handle the following functionality:
1. Loading firmware container also called xsabin at driver attach time 2. Loading of user compiled xclbin with FPGA Manager integration 3. Clock scaling of image running on user partition 4. In-band sensors: temp, voltage, power, etc. 5. Device reset and rescan 6. Flash upgrade of static *shell* partition
The platform drivers are packaged into *xrt-lib* helper module with a well defined interfaces the details of which can be found in Documentation/xrt.rst.
User physical function driver is not included in this patch series.
TESTING AND VALIDATION
xmgmt driver can be tested with full XRT open source stack which includes user space libraries, board utilities and (out of tree) first generation user physical function driver xocl. XRT open source runtime stack is available at https://github.com/Xilinx/XRT
Complete documentation for XRT open source stack including sections on Alveo/XRT security and platform architecture can be found here:
https://xilinx.github.io/XRT/master/html/index.html
https://xilinx.github.io/XRT/master/html/security.html
https://xilinx.github.io/XRT/master/html/platforms_partitions.html
Changes since v1:
- Updated the driver to use fpga_region and fpga_bridge for FPGA programming
- Dropped subdev drivers not related to PR programming to focus on XRT core framework
- Updated Documentation/fpga/xrt.rst with information on XRT core framework
- Addressed checkpatch issues
- Dropped xrt- prefix from some header files
For reference V1 version of patch series can be found here--
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
Thanks,
-Sonal
Sonal Santan (6):
Documentation: fpga: Add a document describing XRT Alveo drivers
fpga: xrt: infrastructure support for xmgmt driver
fpga: xrt: core infrastructure for xrt-lib module
fpga: xrt: XRT Alveo management physical function driver
fpga: xrt: platform drivers for subsystems in shell partition
fpga: xrt: Kconfig and Makefile updates for XRT drivers
Documentation/fpga/index.rst | 1 + Documentation/fpga/xrt.rst | 649 +++++++++++ drivers/fpga/Kconfig | 2 + drivers/fpga/Makefile | 4 + drivers/fpga/xrt/Kconfig | 7 + drivers/fpga/xrt/Makefile | 21 + drivers/fpga/xrt/common/xrt-metadata.c | 590 ++++++++++ drivers/fpga/xrt/common/xrt-root.c | 737 +++++++++++++ drivers/fpga/xrt/common/xrt-root.h | 26 + drivers/fpga/xrt/common/xrt-xclbin.c | 387 +++++++ drivers/fpga/xrt/common/xrt-xclbin.h | 48 + drivers/fpga/xrt/include/metadata.h | 184 ++++ drivers/fpga/xrt/include/parent.h | 103 ++ drivers/fpga/xrt/include/partition.h | 33 + drivers/fpga/xrt/include/subdev.h | 333 ++++++ drivers/fpga/xrt/include/subdev/axigate.h | 31 + drivers/fpga/xrt/include/subdev/calib.h | 28 + drivers/fpga/xrt/include/subdev/clkfreq.h | 21 + drivers/fpga/xrt/include/subdev/clock.h | 29 + drivers/fpga/xrt/include/subdev/gpio.h | 41 + drivers/fpga/xrt/include/subdev/icap.h | 27 + drivers/fpga/xrt/include/subdev/ucs.h | 22 + drivers/fpga/xrt/include/xmgmt-main.h | 34 + drivers/fpga/xrt/lib/Kconfig | 11 + drivers/fpga/xrt/lib/Makefile | 30 + drivers/fpga/xrt/lib/subdevs/xrt-axigate.c | 298 ++++++ drivers/fpga/xrt/lib/subdevs/xrt-calib.c | 226 ++++ drivers/fpga/xrt/lib/subdevs/xrt-clkfreq.c | 214 ++++ drivers/fpga/xrt/lib/subdevs/xrt-clock.c | 638 +++++++++++ drivers/fpga/xrt/lib/subdevs/xrt-gpio.c | 198 ++++ drivers/fpga/xrt/lib/subdevs/xrt-icap.c | 306 ++++++ drivers/fpga/xrt/lib/subdevs/xrt-partition.c | 261 +++++ drivers/fpga/xrt/lib/subdevs/xrt-ucs.c | 238 +++++ drivers/fpga/xrt/lib/subdevs/xrt-vsec.c | 337 ++++++ drivers/fpga/xrt/lib/xrt-cdev.c | 234 ++++ drivers/fpga/xrt/lib/xrt-main.c | 270 +++++ drivers/fpga/xrt/lib/xrt-main.h | 46 + drivers/fpga/xrt/lib/xrt-subdev.c | 1007 ++++++++++++++++++ drivers/fpga/xrt/mgmt/Kconfig | 11 + drivers/fpga/xrt/mgmt/Makefile | 27 + drivers/fpga/xrt/mgmt/xmgmt-fmgr-drv.c | 179 ++++ drivers/fpga/xrt/mgmt/xmgmt-fmgr.h | 29 + drivers/fpga/xrt/mgmt/xmgmt-main-impl.h | 35 + drivers/fpga/xrt/mgmt/xmgmt-main-region.c | 476 +++++++++ drivers/fpga/xrt/mgmt/xmgmt-main.c | 738 +++++++++++++ drivers/fpga/xrt/mgmt/xmgmt-root.c | 375 +++++++ include/uapi/linux/xrt/xclbin.h | 386 +++++++ include/uapi/linux/xrt/xmgmt-ioctl.h | 72 ++ 48 files changed, 10000 insertions(+) create mode 100644 Documentation/fpga/xrt.rst create mode 100644 drivers/fpga/xrt/Kconfig create mode 100644 drivers/fpga/xrt/Makefile create mode 100644 drivers/fpga/xrt/common/xrt-metadata.c create mode 100644 drivers/fpga/xrt/common/xrt-root.c create mode 100644 drivers/fpga/xrt/common/xrt-root.h create mode 100644 drivers/fpga/xrt/common/xrt-xclbin.c create mode 100644 drivers/fpga/xrt/common/xrt-xclbin.h create mode 100644 drivers/fpga/xrt/include/metadata.h create mode 100644 drivers/fpga/xrt/include/parent.h create mode 100644 drivers/fpga/xrt/include/partition.h create mode 100644 drivers/fpga/xrt/include/subdev.h create mode 100644 drivers/fpga/xrt/include/subdev/axigate.h create mode 100644 drivers/fpga/xrt/include/subdev/calib.h create mode 100644 drivers/fpga/xrt/include/subdev/clkfreq.h create mode 100644 drivers/fpga/xrt/include/subdev/clock.h create mode 100644 drivers/fpga/xrt/include/subdev/gpio.h create mode 100644 drivers/fpga/xrt/include/subdev/icap.h create mode 100644 drivers/fpga/xrt/include/subdev/ucs.h create mode 100644 drivers/fpga/xrt/include/xmgmt-main.h create mode 100644 drivers/fpga/xrt/lib/Kconfig create mode 100644 drivers/fpga/xrt/lib/Makefile create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-axigate.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-calib.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-clkfreq.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-clock.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-gpio.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-icap.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-partition.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-ucs.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-vsec.c create mode 100644 drivers/fpga/xrt/lib/xrt-cdev.c create mode 100644 drivers/fpga/xrt/lib/xrt-main.c create mode 100644 drivers/fpga/xrt/lib/xrt-main.h create mode 100644 drivers/fpga/xrt/lib/xrt-subdev.c create mode 100644 drivers/fpga/xrt/mgmt/Kconfig create mode 100644 drivers/fpga/xrt/mgmt/Makefile create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-fmgr-drv.c create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-fmgr.h create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-main-impl.h create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-main-region.c create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-main.c create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-root.c create mode 100644 include/uapi/linux/xrt/xclbin.h create mode 100644 include/uapi/linux/xrt/xmgmt-ioctl.h
Signature · 1 line
2.17.1
PATCH v2 1/6 Documentation: fpga: Add a document describing XRT Alveo drivers
From: Sonal Santan <[email protected]>
Describe XRT driver architecture and provide basic overview of Xilinx Alveo platform.
--- Documentation/fpga/index.rst | 1 + Documentation/fpga/xrt.rst | 649 +++++++++++++++++++++++++++++++++++ 2 files changed, 650 insertions(+) create mode 100644 Documentation/fpga/xrt.rst
Documentation/fpga/index.rst +1 -0
@@ -8,6 +8,7 @@ fpga :maxdepth: 1 dfl + xrt .. only:: subproject and html
Documentation/fpga/xrt.rst new file +649 -0
649 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 2/6 fpga: xrt: infrastructure support for xmgmt driver
In reply to Sonal SantanFrom: Sonal Santan <[email protected]>
Add infrastructure code for XRT management physical function driver. This provides support for enumerating and extracting sections from xclbin files, interacting with device tree nodes found in xclbin and working with Alveo partitions.
--- drivers/fpga/xrt/common/xrt-metadata.c | 590 ++++++++++++++++++++ drivers/fpga/xrt/common/xrt-root.c | 737 +++++++++++++++++++++++++ drivers/fpga/xrt/common/xrt-root.h | 26 + drivers/fpga/xrt/common/xrt-xclbin.c | 387 +++++++++++++ drivers/fpga/xrt/common/xrt-xclbin.h | 48 ++ include/uapi/linux/xrt/xclbin.h | 386 +++++++++++++ 6 files changed, 2174 insertions(+) create mode 100644 drivers/fpga/xrt/common/xrt-metadata.c create mode 100644 drivers/fpga/xrt/common/xrt-root.c create mode 100644 drivers/fpga/xrt/common/xrt-root.h create mode 100644 drivers/fpga/xrt/common/xrt-xclbin.c create mode 100644 drivers/fpga/xrt/common/xrt-xclbin.h create mode 100644 include/uapi/linux/xrt/xclbin.h
drivers/fpga/xrt/common/xrt-metadata.c new file +590 -0
@@ -0,0 +1,590 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Xilinx Alveo FPGA Metadata parse APIs +* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Lizhi Hou <[email protected]> +*/ + +#include <linux/libfdt_env.h> +#include "libfdt.h" +#include "metadata.h" + +#define MAX_BLOB_SIZE (4096 * 25) + +#define md_err(dev, fmt, args...) \ + dev_err(dev, "%s: "fmt, __func__, ##args) +#define md_warn(dev, fmt, args...) \ + dev_warn(dev, "%s: "fmt, __func__, ##args) +#define md_info(dev, fmt, args...) \ + dev_info(dev, "%s: "fmt, __func__, ##args) +#define md_dbg(dev, fmt, args...) \ + dev_dbg(dev, "%s: "fmt, __func__, ##args) + +static int xrt_md_setprop (struct device *dev,char *blob,int offset, +const char *prop,const void *val,int size); +static int xrt_md_overlay (struct device *dev,char *blob,int target, +const char *overlay_blob,int overlay_offset); +static int xrt_md_get_endpoint (struct device *dev,const char *blob, +const char *ep_name,const char *regmap_name,int *ep_offset); + +long xrt_md_size (struct device *dev,const char *blob) +{ +long len = (long )fdt_totalsize (blob); + +return (len >MAX_BLOB_SIZE ) ? -EINVAL : len; +} + +int xrt_md_create (struct device *dev,char **blob) +{ +int ret =0 ; + +WARN_ON (!blob); + + *blob =vmalloc (MAX_BLOB_SIZE ); +if (!*blob) +return -ENOMEM ; + + ret =fdt_create_empty_tree (*blob,MAX_BLOB_SIZE ); +if (ret) { +md_err (dev,"format blob failed, ret = %d" , ret); + goto failed; + } + + ret =fdt_next_node (*blob,-1 ,NULL ); +if (ret <0 ) { +md_err (dev,"No Node, ret = %d" , ret); + goto failed; + } + + ret =fdt_add_subnode (*blob, ret,NODE_ENDPOINTS ); +if (ret <0 ) +md_err (dev,"add node failed, ret = %d" , ret); + +failed: +if (ret <0 ) { +vfree (*blob); + *blob =NULL ; + }else + ret =0 ; + +return ret; +} + +int xrt_md_add_node (struct device *dev,char *blob,int parent_offset, +const char *ep_name) +{ +int ret; + + ret =fdt_add_subnode (blob, parent_offset, ep_name); +if (ret <0 && ret != -FDT_ERR_EXISTS ) +md_err (dev,"failed to add node %s. %d" , ep_name, ret); + +return ret; +} + +int xrt_md_del_endpoint (struct device *dev,char *blob,const char *ep_name, +char *regmap_name) +{ +int ret; +int ep_offset; + + ret =xrt_md_get_endpoint (dev, blob, ep_name, regmap_name, &ep_offset); +if (ret) { +md_err (dev,"can not find ep %s" , ep_name); +return -EINVAL ; + } + + ret =fdt_del_node (blob, ep_offset); +if (ret) +md_err (dev,"delete node %s failed, ret %d" , ep_name, ret); + +return ret; +} + +static int __xrt_md_add_endpoint (struct device *dev,char *blob, +struct xrt_md_endpoint *ep,int *offset,bool root) +{ +int ret =0 ; +int ep_offset; +u32 val, count =0 ; +u64 io_range[2 ]; +char comp[128 ]; + +if (!ep->ep_name) { +md_err (dev,"empty name" ); +return -EINVAL ; + } + +if (!root) { + ret =xrt_md_get_endpoint (dev, blob,NODE_ENDPOINTS ,NULL , + &ep_offset); +if (ret) { +md_err (dev,"invalid blob, ret = %d" , ret); +return -EINVAL ; + } + }else { + ep_offset =0 ; + } + + ep_offset =xrt_md_add_node (dev, blob, ep_offset, ep->ep_name); +if (ep_offset <0 ) { +md_err (dev,"add endpoint failed, ret = %d" , ret); +return -EINVAL ; + } +if (offset) + *offset = ep_offset; + +if (ep->size !=0 ) { + val =cpu_to_be32 (ep->bar); + ret =xrt_md_setprop (dev, blob, ep_offset,PROP_BAR_IDX , + &val,sizeof (u32)); +if (ret) { +md_err (dev,"set %s failed, ret %d" , +PROP_BAR_IDX , ret); + goto failed; + } + io_range[0 ] =cpu_to_be64 ((u64 )ep->bar_off); + io_range[1 ] =cpu_to_be64 ((u64 )ep->size); + ret =xrt_md_setprop (dev, blob, ep_offset,PROP_IO_OFFSET , + io_range,sizeof (io_range)); +if (ret) { +md_err (dev,"set %s failed, ret %d" , +PROP_IO_OFFSET , ret); + goto failed; + } + } + +if (ep->regmap) { +if (ep->regmap_ver) { + count =snprintf (comp,sizeof (comp), +"%s-%s" , ep->regmap, ep->regmap_ver); + count++; + } + + count +=snprintf (comp + count,sizeof (comp) - count, +"%s" , ep->regmap); + count++; + + ret =xrt_md_setprop (dev, blob, ep_offset,PROP_COMPATIBLE , + comp, count); +if (ret) { +md_err (dev,"set %s failed, ret %d" , +PROP_COMPATIBLE , ret); + goto failed; + } + } + +failed: +if (ret) +xrt_md_del_endpoint (dev, blob, ep->ep_name,NULL ); + +return ret; +} + +int xrt_md_add_endpoint (struct device *dev,char *blob, +struct xrt_md_endpoint *ep) +{ +return __xrt_md_add_endpoint (dev, blob, ep,NULL , false); +} + +static int xrt_md_get_endpoint (struct device *dev,const char *blob, +const char *ep_name,const char *regmap_name,int *ep_offset) +{ +int offset; +const char *name; + +for (offset =fdt_next_node (blob,-1 ,NULL ); + offset >=0 ; + offset =fdt_next_node (blob, offset,NULL )) { + name =fdt_get_name (blob, offset,NULL ); +if (!name ||strncmp (name, ep_name,strlen (ep_name) +1 )) +continue ; +if (!regmap_name || + !fdt_node_check_compatible (blob, offset, regmap_name)) +break ; + } +if (offset <0 ) +return -ENODEV ; + + *ep_offset = offset; + +return 0 ; +} + +int xrt_md_get_epname_pointer (struct device *dev,const char *blob, +const char *ep_name,const char *regmap_name,const char **epname) +{ +int offset; +int ret; + + ret =xrt_md_get_endpoint (dev, blob, ep_name, regmap_name, + &offset); +if (!ret && epname && offset >=0 ) + *epname =fdt_get_name (blob, offset,NULL ); + +return ret; +} + +int xrt_md_get_prop (struct device *dev,const char *blob,const char *ep_name, +const char *regmap_name,const char *prop,const void **val,int *size) +{ +int offset; +int ret; + +if (val) + *val =NULL ; +if (ep_name) { + ret =xrt_md_get_endpoint (dev, blob, ep_name, regmap_name, + &offset); +if (ret) { +md_err (dev,"cannot get ep %s, regmap %s, ret = %d" , + ep_name, regmap_name, ret); +return -EINVAL ; + } + }else { + offset =fdt_next_node (blob,-1 ,NULL ); +if (offset <0 ) { +md_err (dev,"internal error, ret = %d" , offset); +return -EINVAL ; + } + } + +if (val) { + *val =fdt_getprop (blob, offset, prop, size); +if (!*val) { +md_dbg (dev,"get ep %s, prop %s failed" , ep_name, prop); +return -EINVAL ; + } + } + +return 0 ; +} + +static int xrt_md_setprop (struct device *dev,char *blob,int offset, +const char *prop,const void *val,int size) +{ +int ret; + + ret =fdt_setprop (blob, offset, prop, val, size); +if (ret) +md_err (dev,"failed to set prop %d" , ret); + +return ret; +} + +int xrt_md_set_prop (struct device *dev,char *blob, +const char *ep_name,const char *regmap_name, +const char *prop,const void *val,int size) +{ +int offset; +int ret; + +if (ep_name) { + ret =xrt_md_get_endpoint (dev, blob, ep_name, + regmap_name, &offset); +if (ret) { +md_err (dev,"cannot get node %s, ret = %d" , + ep_name, ret); +return -EINVAL ; + } + }else { + offset =fdt_next_node (blob,-1 ,NULL ); +if (offset <0 ) { +md_err (dev,"internal error, ret = %d" , offset); +return -EINVAL ; + } + } + + ret =xrt_md_setprop (dev, blob, offset, prop, val, size); +if (ret) +md_err (dev,"set prop %s failed, ret = %d" , prop, ret); + +return ret; +} + +int xrt_md_copy_endpoint (struct device *dev,char *blob,const char *src_blob, +const char *ep_name,const char *regmap_name,const char *new_ep_name) +{ +int offset, target; +int ret; +struct xrt_md_endpoint ep = {0 }; +const char *newepnm = new_ep_name ? new_ep_name : ep_name; + + ret =xrt_md_get_endpoint (dev, src_blob, ep_name, regmap_name, + &offset); +if (ret) +return -EINVAL ; + + ret =xrt_md_get_endpoint (dev, blob, newepnm, regmap_name, &target); +if (ret) { + ep.ep_name = newepnm; + ret =__xrt_md_add_endpoint (dev, blob, &ep, &target, +fdt_parent_offset (src_blob, offset) ==0 ); +if (ret) +return -EINVAL ; + } + + ret =xrt_md_overlay (dev, blob, target, src_blob, offset); +if (ret) +md_err (dev,"overlay failed, ret = %d" , ret); + +return ret; +} + +int xrt_md_copy_all_eps (struct device *dev,char *blob,const char *src_blob) +{ +return xrt_md_copy_endpoint (dev, blob, src_blob,NODE_ENDPOINTS , +NULL ,NULL ); +} + +char *xrt_md_dup (struct device *dev,const char *blob) +{ +int ret; +char *dup_blob; + + ret =xrt_md_create (dev, &dup_blob); +if (ret) +return NULL ; + ret =xrt_md_overlay (dev, dup_blob,-1 , blob,-1 ); +if (ret) { +vfree (dup_blob); +return NULL ; + } + +return dup_blob; +} + +static int xrt_md_overlay (struct device *dev,char *blob,int target, +const char *overlay_blob,int overlay_offset) +{ +int property, subnode; +int ret; + +WARN_ON (!blob || !overlay_blob); + +if (!blob) { +md_err (dev,"blob is NULL" ); +return -EINVAL ; + } + +if (target <0 ) { + target =fdt_next_node (blob,-1 ,NULL ); +if (target <0 ) { +md_err (dev,"invalid target" ); +return -EINVAL ; + } + } +if (overlay_offset <0 ) { + overlay_offset =fdt_next_node (overlay_blob,-1 ,NULL ); +if (overlay_offset <0 ) { +md_err (dev,"invalid overlay" ); +return -EINVAL ; + } + } + +fdt_for_each_property_offset (property, overlay_blob, overlay_offset) { +const char *name; +const void *prop; +int prop_len; + + prop =fdt_getprop_by_offset (overlay_blob, property, &name, + &prop_len); +if (!prop || prop_len >=MAX_BLOB_SIZE ) { +md_err (dev,"internal error" ); +return -EINVAL ; + } + + ret =xrt_md_setprop (dev, blob, target, name, prop, + prop_len); +if (ret) { +md_err (dev,"setprop failed, ret = %d" , ret); +return ret; + } + } + +fdt_for_each_subnode (subnode, overlay_blob, overlay_offset) { +const char *name =fdt_get_name (overlay_blob, subnode,NULL ); +int nnode; + + nnode =xrt_md_add_node (dev, blob, target, name); +if (nnode == -FDT_ERR_EXISTS ) + nnode =fdt_subnode_offset (blob, target, name); +if (nnode <0 ) { +md_err (dev,"add node failed, ret = %d" , nnode); +return nnode; + } + + ret =xrt_md_overlay (dev, blob, nnode, overlay_blob, subnode); +if (ret) +return ret; + } + +return 0 ; +} + +int xrt_md_get_next_endpoint (struct device *dev,const char *blob, +const char *ep_name,const char *regmap_name, +char **next_ep,char **next_regmap) +{ +int offset, ret; + +if (!ep_name) { + ret =xrt_md_get_endpoint (dev, blob,NODE_ENDPOINTS ,NULL , + &offset); + }else { + ret =xrt_md_get_endpoint (dev, blob, ep_name, regmap_name, + &offset); + } + +if (ret) { + *next_ep =NULL ; + *next_regmap =NULL ; +return -EINVAL ; + } + + offset = ep_name ?fdt_next_subnode (blob, offset) : +fdt_first_subnode (blob, offset); +if (offset <0 ) { + *next_ep =NULL ; + *next_regmap =NULL ; +return -EINVAL ; + } + + *next_ep = (char *)fdt_get_name (blob, offset,NULL ); + *next_regmap = (char *)fdt_stringlist_get (blob, offset,PROP_COMPATIBLE , +0 ,NULL ); + +return 0 ; +} + +int xrt_md_get_compatible_epname (struct device *dev,const char *blob, +const char *regmap_name,const char **ep_name) +{ +int ep_offset; + + ep_offset =fdt_node_offset_by_compatible (blob,-1 , regmap_name); +if (ep_offset <0 ) { + *ep_name =NULL ; +return -ENOENT ; + } + + *ep_name = (char *)fdt_get_name (blob, ep_offset,NULL ); + +return 0 ; +} + +int xrt_md_uuid_strtoid (struct device *dev,const char *uuidstr,uuid_t *p_uuid) +{ +char *p; +const char *str; +char tmp[3 ] = {0 }; +int i, ret; + +memset (p_uuid,0 ,sizeof (*p_uuid)); + p = (char *)p_uuid; + str = uuidstr +strlen (uuidstr) -2 ; + +for (i =0 ; i <sizeof (*p_uuid) && str >= uuidstr; i++) { + tmp[0 ] = *str; + tmp[1 ] = *(str +1 ); + ret =kstrtou8 (tmp,16 , p); +if (ret) { +md_err (dev,"Invalid uuid %s" , uuidstr); +return -EINVAL ; + } + p++; + str -=2 ; + } + +return 0 ; +} + +void xrt_md_pack (struct device *dev,char *blob) +{ +int ret; + + ret =fdt_pack (blob); +if (ret) +md_err (dev,"pack failed %d" , ret); +} + +int xrt_md_get_intf_uuids (struct device *dev,const char *blob, +u32 *num_uuids,uuid_t *intf_uuids) +{ +int offset, count =0 ; +int ret; +const char *uuid_str; + + ret =xrt_md_get_endpoint (dev, blob,NODE_INTERFACES ,NULL , &offset); +if (ret) +return -ENOENT ; + +for (offset =fdt_first_subnode (blob, offset); + offset >=0 ; + offset =fdt_next_subnode (blob, offset)) { + uuid_str =fdt_getprop (blob, offset,PROP_INTERFACE_UUID , +NULL ); +if (!uuid_str) { +md_err (dev,"empty intf uuid node" ); +return -EINVAL ; + } + +if (intf_uuids && count < *num_uuids) { + ret =xrt_md_uuid_strtoid (dev, uuid_str, + &intf_uuids[count]); +if (ret) +return -EINVAL ; + } + count++; + } + + *num_uuids = count; + +return 0 ; +} + +int xrt_md_check_uuids (struct device *dev,const char *blob,char *subset_blob) +{ +const char *subset_int_uuid =NULL ; +const char *int_uuid =NULL ; +int offset, subset_offset, off; +int ret; + + ret =xrt_md_get_endpoint (dev, subset_blob,NODE_INTERFACES ,NULL , + &subset_offset); +if (ret) +return -EINVAL ; + + ret =xrt_md_get_endpoint (dev, blob,NODE_INTERFACES ,NULL , + &offset); +if (ret) +return -EINVAL ; + +for (subset_offset =fdt_first_subnode (subset_blob, subset_offset); + subset_offset >=0 ; + subset_offset =fdt_next_subnode (subset_blob, subset_offset)) { + subset_int_uuid =fdt_getprop (subset_blob, subset_offset, +PROP_INTERFACE_UUID ,NULL ); +if (!subset_int_uuid) +return -EINVAL ; + off = offset; + +for (off =fdt_first_subnode (blob, off); + off >=0 ; + off =fdt_next_subnode (blob, off)) { + int_uuid =fdt_getprop (blob, off, +PROP_INTERFACE_UUID ,NULL ); +if (!int_uuid) +return -EINVAL ; +if (!strcmp (int_uuid, subset_int_uuid)) +break ; + } +if (off <0 ) +return -ENOENT ; + } + +return 0 ; +}
drivers/fpga/xrt/common/xrt-root.c new file +737 -0
737 lines not on this page · raw message
drivers/fpga/xrt/common/xrt-root.h new file +26 -0
@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Cheng Zhen <[email protected]> +*/ + +#ifndef _XRT_ROOT_H_ +#define _XRT_ROOT_H_ + +#include <linux/pci.h> +#include "subdev.h" + +struct xroot ; + +int xroot_probe (struct pci_dev *pdev,struct xroot **root); +void xroot_remove (struct xroot *root); +bool xroot_wait_for_bringup (struct xroot *root); +int xroot_add_vsec_node (struct xroot *root,char *dtb); +int xroot_create_partition (struct xroot *xr,char *dtb); +int xroot_add_simple_node (struct xroot *root,char *dtb,const char *endpoint); +void xroot_hot_reset (struct pci_dev *pdev); +void xroot_broadcast (struct xroot *root,enum xrt_events evt); + +#endif /* _XRT_ROOT_H_ */
drivers/fpga/xrt/common/xrt-xclbin.c new file +387 -0
387 lines not on this page · raw message
drivers/fpga/xrt/common/xrt-xclbin.h new file +48 -0
48 lines not on this page · raw message
include/uapi/linux/xrt/xclbin.h new file +386 -0
386 lines not on this page · raw message
Signature · 1 line
2.17.1
kernel test robot
build botRe: [PATCH V2 XRT Alveo 2/6] fpga: xrt: infrastructure support for xmgmt driver
Thank you for the patch! Yet something to improve:
Hi Sonal,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.10 next-20201218] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Sonal-Santan/XRT-Alveo-driver-overview/20201217-160048 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 09162bc32c880a791c6c0668ce0745cf7958f576 config: x86_64-rhel (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/40454bdc15831407c2041bec3d4f389816916ed6 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sonal-Santan/XRT-Alveo-driver-overview/20201217-160048 git checkout 40454bdc15831407c2041bec3d4f389816916ed6 # save the attached .config to linux build tree make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
>> error: include/uapi/linux/xrt/xclbin.h: missing "WITH Linux-syscall-note" for SPDX-License-Identifier
make[2]: *** [scripts/Makefile.headersinst:63: usr/include/linux/xrt/xclbin.h] Error 1 make[2]: Target '__headers' not remade because of errors.
make[1]: *** [Makefile:1288: headers] Error 2
make[1]: Target 'headers_install' not remade because of errors.
make: *** [Makefile:185: __sub-make] Error 2
make: Target 'headers_install' not remade because of errors.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH v2 3/6 fpga: xrt: core infrastructure for xrt-lib module
In reply to Sonal SantanFrom: Sonal Santan <[email protected]>
Add xrt-lib kernel module infrastructrure code which defines APIs for working with device nodes, iteration and lookup of platform devices, common interfaces for platform devices, plumbing of function call and ioctls between platform devices and parent partitions.
--- drivers/fpga/xrt/include/metadata.h | 184 ++++ drivers/fpga/xrt/include/parent.h | 103 ++ drivers/fpga/xrt/include/partition.h | 33 + drivers/fpga/xrt/include/subdev.h | 333 ++++++ drivers/fpga/xrt/lib/subdevs/xrt-partition.c | 261 +++++ drivers/fpga/xrt/lib/xrt-cdev.c | 234 ++++ drivers/fpga/xrt/lib/xrt-main.c | 270 +++++ drivers/fpga/xrt/lib/xrt-main.h | 46 + drivers/fpga/xrt/lib/xrt-subdev.c | 1007 ++++++++++++++++++ 9 files changed, 2471 insertions(+) create mode 100644 drivers/fpga/xrt/include/metadata.h create mode 100644 drivers/fpga/xrt/include/parent.h create mode 100644 drivers/fpga/xrt/include/partition.h create mode 100644 drivers/fpga/xrt/include/subdev.h create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-partition.c create mode 100644 drivers/fpga/xrt/lib/xrt-cdev.c create mode 100644 drivers/fpga/xrt/lib/xrt-main.c create mode 100644 drivers/fpga/xrt/lib/xrt-main.h create mode 100644 drivers/fpga/xrt/lib/xrt-subdev.c
drivers/fpga/xrt/include/metadata.h new file +184 -0
@@ -0,0 +1,184 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Xilinx Alveo FPGA Test Leaf Driver +* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Lizhi Hou <[email protected]> +*/ + +#ifndef _XRT_METADATA_H +#define _XRT_METADATA_H + +#include <linux/device.h> +#include <linux/vmalloc.h> +#include <linux/uuid.h> + +#define PROP_COMPATIBLE "compatible" +#define PROP_PF_NUM "pcie_physical_function" +#define PROP_BAR_IDX "pcie_bar_mapping" +#define PROP_IO_OFFSET "reg" +#define PROP_INTERRUPTS "interrupts" +#define PROP_INTERFACE_UUID "interface_uuid" +#define PROP_LOGIC_UUID "logic_uuid" +#define PROP_VERSION_MAJOR "firmware_version_major" + +#define PROP_HWICAP "axi_hwicap" +#define PROP_PDI_CONFIG "pdi_config_mem" + +#define NODE_ENDPOINTS "addressable_endpoints" +#define INTERFACES_PATH "/interfaces" + +#define NODE_FIRMWARE "firmware" +#define NODE_INTERFACES "interfaces" +#define NODE_PARTITION_INFO "partition_info" + +#define NODE_FLASH "ep_card_flash_program_00" +#define NODE_XVC_PUB "ep_debug_bscan_user_00" +#define NODE_XVC_PRI "ep_debug_bscan_mgmt_00" +#define NODE_SYSMON "ep_cmp_sysmon_00" +#define NODE_AF_BLP_CTRL_MGMT "ep_firewall_blp_ctrl_mgmt_00" +#define NODE_AF_BLP_CTRL_USER "ep_firewall_blp_ctrl_user_00" +#define NODE_AF_CTRL_MGMT "ep_firewall_ctrl_mgmt_00" +#define NODE_AF_CTRL_USER "ep_firewall_ctrl_user_00" +#define NODE_AF_CTRL_DEBUG "ep_firewall_ctrl_debug_00" +#define NODE_AF_DATA_H2C "ep_firewall_data_h2c_00" +#define NODE_AF_DATA_C2H "ep_firewall_data_c2h_00" +#define NODE_AF_DATA_P2P "ep_firewall_data_p2p_00" +#define NODE_AF_DATA_M2M "ep_firewall_data_m2m_00" +#define NODE_CMC_REG "ep_cmc_regmap_00" +#define NODE_CMC_RESET "ep_cmc_reset_00" +#define NODE_CMC_MUTEX "ep_cmc_mutex_00" +#define NODE_CMC_FW_MEM "ep_cmc_firmware_mem_00" +#define NODE_ERT_FW_MEM "ep_ert_firmware_mem_00" +#define NODE_ERT_CQ_MGMT "ep_ert_command_queue_mgmt_00" +#define NODE_ERT_CQ_USER "ep_ert_command_queue_user_00" +#define NODE_MAILBOX_MGMT "ep_mailbox_mgmt_00" +#define NODE_MAILBOX_USER "ep_mailbox_user_00" +#define NODE_GATE_PLP "ep_pr_isolate_plp_00" +#define NODE_GATE_ULP "ep_pr_isolate_ulp_00" +#define NODE_PCIE_MON "ep_pcie_link_mon_00" +#define NODE_DDR_CALIB "ep_ddr_mem_calib_00" +#define NODE_CLK_KERNEL1 "ep_aclk_kernel_00" +#define NODE_CLK_KERNEL2 "ep_aclk_kernel_01" +#define NODE_CLK_KERNEL3 "ep_aclk_hbm_00" +#define NODE_KDMA_CTRL "ep_kdma_ctrl_00" +#define NODE_FPGA_CONFIG "ep_fpga_configuration_00" +#define NODE_ERT_SCHED "ep_ert_sched_00" +#define NODE_XDMA "ep_xdma_00" +#define NODE_MSIX "ep_msix_00" +#define NODE_QDMA "ep_qdma_00" +#define NODE_QDMA4 "ep_qdma4_00" +#define NODE_STM "ep_stream_traffic_manager_00" +#define NODE_STM4 "ep_stream_traffic_manager4_00" +#define NODE_CLK_SHUTDOWN "ep_aclk_shutdown_00" +#define NODE_ERT_BASE "ep_ert_base_address_00" +#define NODE_ERT_RESET "ep_ert_reset_00" +#define NODE_CLKFREQ_K1 "ep_freq_cnt_aclk_kernel_00" +#define NODE_CLKFREQ_K2 "ep_freq_cnt_aclk_kernel_01" +#define NODE_CLKFREQ_HBM "ep_freq_cnt_aclk_hbm_00" +#define NODE_GAPPING "ep_gapping_demand_00" +#define NODE_UCS_CONTROL_STATUS "ep_ucs_control_status_00" +#define NODE_P2P "ep_p2p_00" +#define NODE_REMAP_P2P "ep_remap_p2p_00" +#define NODE_DDR4_RESET_GATE "ep_ddr_mem_srsr_gate_00" +#define NODE_ADDR_TRANSLATOR "ep_remap_data_c2h_00" +#define NODE_MAILBOX_XRT "ep_mailbox_user_to_ert_00" +#define NODE_PMC_INTR "ep_pmc_intr_00" +#define NODE_PMC_MUX "ep_pmc_mux_00" + +/* driver defined endpoints */ +#define NODE_VSEC "drv_ep_vsec_00" +#define NODE_VSEC_GOLDEN "drv_ep_vsec_golden_00" +#define NODE_BLP_ROM "drv_ep_blp_rom_00" +#define NODE_MAILBOX_VSEC "ep_mailbox_vsec_00" +#define NODE_PLAT_INFO "drv_ep_platform_info_mgmt_00" +#define NODE_TEST "drv_ep_test_00" +#define NODE_MGMT_MAIN "drv_ep_mgmt_main_00" +#define NODE_FLASH_VSEC "drv_ep_card_flash_program_00" +#define NODE_GOLDEN_VER "drv_ep_golden_ver_00" +#define NODE_PARTITION_INFO_BLP "partition_info_0" +#define NODE_PARTITION_INFO_PLP "partition_info_1" + +#define NODE_DDR_SRSR "drv_ep_ddr_srsr" +#define REGMAP_DDR_SRSR "drv_ddr_srsr" + +#define PROP_OFFSET "drv_offset" +#define PROP_CLK_FREQ "drv_clock_frequency" +#define PROP_CLK_CNT "drv_clock_frequency_counter" +#define PROP_VBNV "vbnv" +#define PROP_VROM "vrom" +#define PROP_PARTITION_LEVEL "partition_level" + +struct xrt_md_endpoint { +const char *ep_name; +u32 bar; +long bar_off; +ulong size; +char *regmap; +char *regmap_ver; +}; + +/* Note: res_id is defined by leaf driver and must start with 0. */ +struct xrt_iores_map { +char *res_name; +int res_id; +}; + +static inline int xrt_md_res_name2id (const struct xrt_iores_map *res_map, +int entry_num,const char *res_name) +{ +int i; + +BUG_ON (res_name ==NULL ); +for (i =0 ; i < entry_num; i++) { +if (!strcmp (res_name, res_map->res_name)) +return res_map->res_id; + res_map++; + } +return -1 ; +} + +static inline const char * +xrt_md_res_id2name (const struct xrt_iores_map *res_map,int entry_num,int id) +{ +int i; + +BUG_ON (id > entry_num); +for (i =0 ; i < entry_num; i++) { +if (res_map->res_id == id) +return res_map->res_name; + res_map++; + } +return NULL ; +} + +long xrt_md_size (struct device *dev,const char *blob); +int xrt_md_create (struct device *dev,char **blob); +int xrt_md_add_endpoint (struct device *dev,char *blob, +struct xrt_md_endpoint *ep); +int xrt_md_del_endpoint (struct device *dev,char *blob,const char *ep_name, +char *regmap_name); +int xrt_md_get_prop (struct device *dev,const char *blob,const char *ep_name, +const char *regmap_name,const char *prop,const void **val,int *size); +int xrt_md_set_prop (struct device *dev,char *blob,const char *ep_name, +const char *regmap_name,const char *prop,const void *val,int size); +int xrt_md_copy_endpoint (struct device *dev,char *blob,const char *src_blob, +const char *ep_name,const char *regmap_name,const char *new_ep_name); +int xrt_md_copy_all_eps (struct device *dev,char *blob,const char *src_blob); +int xrt_md_get_next_endpoint (struct device *dev,const char *blob, +const char *ep_name,const char *regmap_name, +char **next_ep,char **next_regmap); +int xrt_md_get_compatible_epname (struct device *dev,const char *blob, +const char *regmap_name,const char **ep_name); +int xrt_md_get_epname_pointer (struct device *dev,const char *blob, +const char *ep_name,const char *regmap_name,const char **epname); +void xrt_md_pack (struct device *dev,char *blob); +char *xrt_md_dup (struct device *dev,const char *blob); +int xrt_md_get_intf_uuids (struct device *dev,const char *blob, +u32 *num_uuids,uuid_t *intf_uuids); +int xrt_md_check_uuids (struct device *dev,const char *blob,char *subset_blob); +int xrt_md_uuid_strtoid (struct device *dev,const char *uuidstr,uuid_t *uuid); + +#endif
drivers/fpga/xrt/include/parent.h new file +103 -0
103 lines not on this page · raw message
drivers/fpga/xrt/include/partition.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Cheng Zhen <[email protected]> +*/ + +#ifndef _XRT_PARTITION_H_ +#define _XRT_PARTITION_H_ + +#include "subdev.h" + +/* +* Partition driver IOCTL calls. +*/ +enum xrt_partition_ioctl_cmd { +XRT_PARTITION_GET_LEAF =0 , +XRT_PARTITION_PUT_LEAF , +XRT_PARTITION_INIT_CHILDREN , +XRT_PARTITION_FINI_CHILDREN , +XRT_PARTITION_EVENT , +}; + +struct xrt_partition_ioctl_event { +enum xrt_events xpie_evt; +struct xrt_parent_ioctl_evt_cb *xpie_cb; +}; + +extern int xrt_subdev_parent_ioctl (struct platform_device *pdev, +u32 cmd,void *arg); + +#endif /* _XRT_PARTITION_H_ */
drivers/fpga/xrt/include/subdev.h new file +333 -0
333 lines not on this page · raw message
drivers/fpga/xrt/lib/subdevs/xrt-partition.c new file +261 -0
261 lines not on this page · raw message
drivers/fpga/xrt/lib/xrt-cdev.c new file +234 -0
234 lines not on this page · raw message
drivers/fpga/xrt/lib/xrt-main.c new file +270 -0
270 lines not on this page · raw message
drivers/fpga/xrt/lib/xrt-main.h new file +46 -0
46 lines not on this page · raw message
drivers/fpga/xrt/lib/xrt-subdev.c new file +1007 -0
1,007 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 4/6 fpga: xrt: XRT Alveo management physical function driver
In reply to Sonal SantanFrom: Sonal Santan <[email protected]>
Add management physical function driver core. The driver attaches to management physical function of Alveo devices. It instantiates the root driver and one or more partition drivers which in turn instantiate platform drivers. The instantiation of partition and platform drivers is completely data driven. The driver integrates with FPGA manager and provides xclbin download service.
--- drivers/fpga/xrt/include/xmgmt-main.h | 34 + drivers/fpga/xrt/mgmt/xmgmt-fmgr-drv.c | 179 ++++++ drivers/fpga/xrt/mgmt/xmgmt-fmgr.h | 29 + drivers/fpga/xrt/mgmt/xmgmt-main-impl.h | 35 + drivers/fpga/xrt/mgmt/xmgmt-main-region.c | 476 ++++++++++++++ drivers/fpga/xrt/mgmt/xmgmt-main.c | 738 ++++++++++++++++++++++ drivers/fpga/xrt/mgmt/xmgmt-root.c | 375 +++++++++++ include/uapi/linux/xrt/xmgmt-ioctl.h | 72 +++ 8 files changed, 1938 insertions(+) create mode 100644 drivers/fpga/xrt/include/xmgmt-main.h create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-fmgr-drv.c create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-fmgr.h create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-main-impl.h create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-main-region.c create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-main.c create mode 100644 drivers/fpga/xrt/mgmt/xmgmt-root.c create mode 100644 include/uapi/linux/xrt/xmgmt-ioctl.h
drivers/fpga/xrt/include/xmgmt-main.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Cheng Zhen <[email protected]> +*/ + +#ifndef _XMGMT_MAIN_H_ +#define _XMGMT_MAIN_H_ + +#include <linux/xrt/xclbin.h> + +enum xrt_mgmt_main_ioctl_cmd { +// section needs to be vfree'd by caller +XRT_MGMT_MAIN_GET_AXLF_SECTION =0 , +// vbnv needs to be kfree'd by caller +XRT_MGMT_MAIN_GET_VBNV , +}; + +enum provider_kind { +XMGMT_BLP , +XMGMT_PLP , +XMGMT_ULP , +}; + +struct xrt_mgmt_main_ioctl_get_axlf_section { +enum provider_kind xmmigas_axlf_kind; +enum axlf_section_kind xmmigas_section_kind; +void *xmmigas_section; +u64 xmmigas_section_size; +}; + +#endif /* _XMGMT_MAIN_H_ */
drivers/fpga/xrt/mgmt/xmgmt-fmgr-drv.c new file +179 -0
179 lines not on this page · raw message
drivers/fpga/xrt/mgmt/xmgmt-fmgr.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Xilinx Alveo Management Function Driver +* +* Copyright (C) 2019-2020 Xilinx, Inc. +* Bulk of the code borrowed from XRT mgmt driver file, fmgr.c +* +* Authors: [email protected] +*/ + +#ifndef _XMGMT_FMGR_H_ +#define _XMGMT_FMGR_H_ + +#include <linux/fpga/fpga-mgr.h> +#include <linux/mutex.h> + +#include <linux/xrt/xclbin.h> + +enum xfpga_sec_level { +XFPGA_SEC_NONE =0 , +XFPGA_SEC_DEDICATE , +XFPGA_SEC_SYSTEM , +XFPGA_SEC_MAX =XFPGA_SEC_SYSTEM , +}; + +struct fpga_manager *xmgmt_fmgr_probe (struct platform_device *pdev); +int xmgmt_fmgr_remove (struct fpga_manager *fmgr); + +#endif
drivers/fpga/xrt/mgmt/xmgmt-main-impl.h new file +35 -0
@@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Lizhi Hou <[email protected]> +* Cheng Zhen <[email protected]> +*/ + +#ifndef _XMGMT_MAIN_IMPL_H_ +#define _XMGMT_MAIN_IMPL_H_ + +#include "subdev.h" +#include "xmgmt-main.h" + +struct fpga_manager ; +extern struct platform_driver xmgmt_main_driver; +extern struct xrt_subdev_endpoints xrt_mgmt_main_endpoints[]; + +extern int xmgmt_process_xclbin (struct platform_device *pdev, +struct fpga_manager *fmgr,const struct axlf *xclbin,enum provider_kind kind); +extern void xmgmt_region_cleanup_all (struct platform_device *pdev); + +extern int bitstream_axlf_mailbox (struct platform_device *pdev, +const void *xclbin); +extern int xmgmt_hot_reset (struct platform_device *pdev); + +/* Getting dtb for specified partition. Caller should vfree returned dtb .*/ +extern char *xmgmt_get_dtb (struct platform_device *pdev, +enum provider_kind kind); +extern char *xmgmt_get_vbnv (struct platform_device *pdev); +extern int xmgmt_get_provider_uuid (struct platform_device *pdev, +enum provider_kind kind,uuid_t *uuid); + +#endif /* _XMGMT_MAIN_IMPL_H_ */
drivers/fpga/xrt/mgmt/xmgmt-main-region.c new file +476 -0
476 lines not on this page · raw message
drivers/fpga/xrt/mgmt/xmgmt-main.c new file +738 -0
738 lines not on this page · raw message
drivers/fpga/xrt/mgmt/xmgmt-root.c new file +375 -0
375 lines not on this page · raw message
include/uapi/linux/xrt/xmgmt-ioctl.h new file +72 -0
72 lines not on this page · raw message
Signature · 1 line
2.17.1
kernel test robot
build botRe: [PATCH V2 XRT Alveo 4/6] fpga: xrt: XRT Alveo management physical function driver
Thank you for the patch! Yet something to improve:
Hi Sonal,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.10 next-20201221] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Sonal-Santan/XRT-Alveo-driver-overview/20201217-160048 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 09162bc32c880a791c6c0668ce0745cf7958f576 config: x86_64-rhel (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/ec70cdb9cc3612eec369754db4ae631a05f4a325 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sonal-Santan/XRT-Alveo-driver-overview/20201217-160048 git checkout ec70cdb9cc3612eec369754db4ae631a05f4a325 # save the attached .config to linux build tree make W=1 ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
error: include/uapi/linux/xrt/xclbin.h: missing "WITH Linux-syscall-note" for SPDX-License-Identifier make[2]: *** [scripts/Makefile.headersinst:63: usr/include/linux/xrt/xclbin.h] Error 1
>> error: include/uapi/linux/xrt/xmgmt-ioctl.h: missing "WITH Linux-syscall-note" for SPDX-License-Identifier
make[2]: *** [scripts/Makefile.headersinst:63: usr/include/linux/xrt/xmgmt-ioctl.h] Error 1 make[2]: Target '__headers' not remade because of errors.
make[1]: *** [Makefile:1288: headers] Error 2
make[1]: Target 'headers_install' not remade because of errors.
make: *** [Makefile:185: __sub-make] Error 2
make: Target 'headers_install' not remade because of errors.
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH v2 5/6 fpga: xrt: platform drivers for subsystems in shell partition
In reply to Sonal SantanFrom: Sonal Santan <[email protected]>
Add platform drivers for HW subsystems found in shell partition. Each driver implements interfaces defined by xrt-subdev.h. The driver instances are created by parent partition to manage subsystem instances discovered by walking device tree. The platform drivers may populate their own sysfs nodes, create device nodes if needed and make calls into parent or other platform drivers. The platform drivers can also send and receive events.
--- drivers/fpga/xrt/include/subdev/axigate.h | 31 + drivers/fpga/xrt/include/subdev/calib.h | 28 + drivers/fpga/xrt/include/subdev/clkfreq.h | 21 + drivers/fpga/xrt/include/subdev/clock.h | 29 + drivers/fpga/xrt/include/subdev/gpio.h | 41 ++ drivers/fpga/xrt/include/subdev/icap.h | 27 + drivers/fpga/xrt/include/subdev/ucs.h | 22 + drivers/fpga/xrt/lib/subdevs/xrt-axigate.c | 298 ++++++++++ drivers/fpga/xrt/lib/subdevs/xrt-calib.c | 226 ++++++++ drivers/fpga/xrt/lib/subdevs/xrt-clkfreq.c | 214 +++++++ drivers/fpga/xrt/lib/subdevs/xrt-clock.c | 638 +++++++++++++++++++++ drivers/fpga/xrt/lib/subdevs/xrt-gpio.c | 198 +++++++ drivers/fpga/xrt/lib/subdevs/xrt-icap.c | 306 ++++++++++ drivers/fpga/xrt/lib/subdevs/xrt-ucs.c | 238 ++++++++ drivers/fpga/xrt/lib/subdevs/xrt-vsec.c | 337 +++++++++++ 15 files changed, 2654 insertions(+) create mode 100644 drivers/fpga/xrt/include/subdev/axigate.h create mode 100644 drivers/fpga/xrt/include/subdev/calib.h create mode 100644 drivers/fpga/xrt/include/subdev/clkfreq.h create mode 100644 drivers/fpga/xrt/include/subdev/clock.h create mode 100644 drivers/fpga/xrt/include/subdev/gpio.h create mode 100644 drivers/fpga/xrt/include/subdev/icap.h create mode 100644 drivers/fpga/xrt/include/subdev/ucs.h create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-axigate.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-calib.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-clkfreq.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-clock.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-gpio.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-icap.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-ucs.c create mode 100644 drivers/fpga/xrt/lib/subdevs/xrt-vsec.c
drivers/fpga/xrt/include/subdev/axigate.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Lizhi Hou <[email protected]> +*/ + +#ifndef _XRT_AXIGATE_H_ +#define _XRT_AXIGATE_H_ + + +#include "subdev.h" +#include "metadata.h" + +/* +* AXIGATE driver IOCTL calls. +*/ +enum xrt_axigate_ioctl_cmd { +XRT_AXIGATE_FREEZE =0 , +XRT_AXIGATE_FREE , +}; + +/* the ep names are in the order of hardware layers */ +static const char *const xrt_axigate_epnames[] = { +NODE_GATE_PLP , +NODE_GATE_ULP , +NULL +}; + +#endif /* _XRT_AXIGATE_H_ */
drivers/fpga/xrt/include/subdev/calib.h new file +28 -0
@@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Cheng Zhen <[email protected]> +*/ + +#ifndef _XRT_CALIB_H_ +#define _XRT_CALIB_H_ + +#include "subdev.h" +#include <linux/xrt/xclbin.h> + +/* +* Memory calibration driver IOCTL calls. +*/ +enum xrt_calib_results { +XRT_CALIB_UNKNOWN , +XRT_CALIB_SUCCEEDED , +XRT_CALIB_FAILED , +}; + +enum xrt_calib_ioctl_cmd { +XRT_CALIB_RESULT =0 , +}; + +#endif /* _XRT_CALIB_H_ */
drivers/fpga/xrt/include/subdev/clkfreq.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Lizhi Hou <[email protected]> +*/ + +#ifndef _XRT_CLKFREQ_H_ +#define _XRT_CLKFREQ_H_ + +#include "subdev.h" + +/* +* CLKFREQ driver IOCTL calls. +*/ +enum xrt_clkfreq_ioctl_cmd { +XRT_CLKFREQ_READ =0 , +}; + +#endif /* _XRT_CLKFREQ_H_ */
drivers/fpga/xrt/include/subdev/clock.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Lizhi Hou <[email protected]> +*/ + +#ifndef _XRT_CLOCK_H_ +#define _XRT_CLOCK_H_ + +#include "subdev.h" +#include <linux/xrt/xclbin.h> + +/* +* CLOCK driver IOCTL calls. +*/ +enum xrt_clock_ioctl_cmd { +XRT_CLOCK_SET =0 , +XRT_CLOCK_GET , +XRT_CLOCK_VERIFY , +}; + +struct xrt_clock_ioctl_get { +u16 freq; +u32 freq_cnter; +}; + +#endif /* _XRT_CLOCK_H_ */
drivers/fpga/xrt/include/subdev/gpio.h new file +41 -0
41 lines not on this page · raw message
drivers/fpga/xrt/include/subdev/icap.h new file +27 -0
@@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Lizhi Hou <[email protected]> +*/ + +#ifndef _XRT_ICAP_H_ +#define _XRT_ICAP_H_ + +#include "subdev.h" + +/* +* ICAP driver IOCTL calls. +*/ +enum xrt_icap_ioctl_cmd { +XRT_ICAP_WRITE =0 , +XRT_ICAP_IDCODE , +}; + +struct xrt_icap_ioctl_wr { +void *xiiw_bit_data; +u32 xiiw_data_len; +}; + +#endif /* _XRT_ICAP_H_ */
drivers/fpga/xrt/include/subdev/ucs.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (C) 2020 Xilinx, Inc. +* +* Authors: +* Lizhi Hou <[email protected]> +*/ + +#ifndef _XRT_UCS_H_ +#define _XRT_UCS_H_ + +#include "subdev.h" + +/* +* UCS driver IOCTL calls. +*/ +enum xrt_ucs_ioctl_cmd { +XRT_UCS_CHECK =0 , +XRT_UCS_ENABLE , +}; + +#endif /* _XRT_UCS_H_ */
drivers/fpga/xrt/lib/subdevs/xrt-axigate.c new file +298 -0
298 lines not on this page · raw message
drivers/fpga/xrt/lib/subdevs/xrt-calib.c new file +226 -0
226 lines not on this page · raw message
drivers/fpga/xrt/lib/subdevs/xrt-clkfreq.c new file +214 -0
214 lines not on this page · raw message
drivers/fpga/xrt/lib/subdevs/xrt-clock.c new file +638 -0
638 lines not on this page · raw message
drivers/fpga/xrt/lib/subdevs/xrt-gpio.c new file +198 -0
198 lines not on this page · raw message
drivers/fpga/xrt/lib/subdevs/xrt-icap.c new file +306 -0
306 lines not on this page · raw message
drivers/fpga/xrt/lib/subdevs/xrt-ucs.c new file +238 -0
238 lines not on this page · raw message
drivers/fpga/xrt/lib/subdevs/xrt-vsec.c new file +337 -0
337 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 6/6 fpga: xrt: Kconfig and Makefile updates for XRT drivers
In reply to Sonal SantanFrom: Sonal Santan <[email protected]>
Update fpga Kconfig/Makefile and add Kconfig/Makefile for new drivers.
--- drivers/fpga/Kconfig | 2 ++ drivers/fpga/Makefile | 4 ++++ drivers/fpga/xrt/Kconfig | 7 +++++++ drivers/fpga/xrt/Makefile | 21 +++++++++++++++++++++ drivers/fpga/xrt/lib/Kconfig | 11 +++++++++++ drivers/fpga/xrt/lib/Makefile | 30 ++++++++++++++++++++++++++++++ drivers/fpga/xrt/mgmt/Kconfig | 11 +++++++++++ drivers/fpga/xrt/mgmt/Makefile | 27 +++++++++++++++++++++++++++ 8 files changed, 113 insertions(+) create mode 100644 drivers/fpga/xrt/Kconfig create mode 100644 drivers/fpga/xrt/Makefile create mode 100644 drivers/fpga/xrt/lib/Kconfig create mode 100644 drivers/fpga/xrt/lib/Makefile create mode 100644 drivers/fpga/xrt/mgmt/Kconfig create mode 100644 drivers/fpga/xrt/mgmt/Makefile
drivers/fpga/Kconfig +2 -0
@@ -215,4 +215,6 @@ config FPGA_MGR_ZYNQMP_FPGA to configure the programmable logic(PL) through PS on ZynqMP SoC. +source "drivers/fpga/xrt/Kconfig" + endif # FPGA
drivers/fpga/Makefile +4 -0
@@ -46,3 +46,7 @@ dfl-afu-objs += dfl-afu-error.o # Drivers for FPGAs which implement DFL obj-$(CONFIG_FPGA_DFL_PCI) += dfl-pci.o + +# XRT drivers for Alveo +obj-$(CONFIG_FPGA_XRT_LIB) += xrt/lib/ +obj-$(CONFIG_FPGA_XRT_XMGMT) += xrt/mgmt/
drivers/fpga/xrt/Kconfig new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Xilinx Alveo FPGA device configuration +# + +source "drivers/fpga/xrt/lib/Kconfig" +source "drivers/fpga/xrt/mgmt/Kconfig"
drivers/fpga/xrt/Makefile new file +21 -0
@@ -0,0 +1,21 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) 2020 Xilinx, Inc. All rights reserved. +# +# Authors: [email protected] +# + +all: + $(MAKE) -C lib all + $(MAKE) -C mgmt all + $(MAKE) lint + +tags: + ../../../../scripts/tags.sh + +clean: + $(MAKE) -C lib clean + $(MAKE) -C mgmt clean + +lint: + ../../../../scripts/lint.sh
drivers/fpga/xrt/lib/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# XRT Alveo FPGA device configuration +# + +config FPGA_XRT_LIB + tristate "XRT Alveo Driver Library" + depends on HWMON && PCI + select LIBFDT + help + XRT Alveo FPGA PCIe device driver common library.
drivers/fpga/xrt/lib/Makefile new file +30 -0
@@ -0,0 +1,30 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) 2020 Xilinx, Inc. All rights reserved. +# +# Authors: [email protected] +# + +FULL_XRT_PATH=$(srctree)/$(src)/.. +FULL_DTC_PATH=$(srctree)/scripts/dtc/libfdt + +obj-$(CONFIG_FPGA_XRT_LIB) := xrt-lib.o + +xrt-lib-objs := \ + xrt-main.o \ + xrt-subdev.o \ + xrt-cdev.o \ + ../common/xrt-metadata.o \ + subdevs/xrt-partition.o \ + subdevs/xrt-vsec.o \ + subdevs/xrt-axigate.o \ + subdevs/xrt-gpio.o \ + subdevs/xrt-icap.o \ + subdevs/xrt-clock.o \ + subdevs/xrt-clkfreq.o \ + subdevs/xrt-ucs.o \ + subdevs/xrt-calib.o + +ccflags-y := -I$(FULL_XRT_PATH)/include \ + -I$(FULL_XRT_PATH)/common \ + -I$(FULL_DTC_PATH)
drivers/fpga/xrt/mgmt/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Xilinx XRT FPGA device configuration +# + +config FPGA_XRT_XMGMT + tristate "Xilinx Alveo Management Driver" + depends on HWMON && PCI && FPGA_XRT_LIB + select LIBFDT + help + XRT Alveo FPGA PCIe device driver for Management Physical Function.
drivers/fpga/xrt/mgmt/Makefile new file +27 -0
@@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (C) 2019-2020 Xilinx, Inc. All rights reserved. +# +# Authors: [email protected] +# + +FULL_XRT_PATH=$(srctree)/$(src)/.. +FULL_DTC_PATH=$(srctree)/scripts/dtc/libfdt + +obj-$(CONFIG_FPGA_XRT_XMGMT) += xmgmt.o + +commondir := ../common + +xmgmt-objs := xmgmt-root.o \ + xmgmt-main.o \ + xmgmt-fmgr-drv.o \ + xmgmt-main-region.o \ + $(commondir)/xrt-root.o \ + $(commondir)/xrt-metadata.o \ + $(commondir)/xrt-xclbin.o + + + +ccflags-y := -I$(FULL_XRT_PATH)/include \ + -I$(FULL_XRT_PATH)/common \ + -I$(FULL_DTC_PATH)
Signature · 1 line
2.17.1
kernel test robot
build botRe: [PATCH V2 XRT Alveo 6/6] fpga: xrt: Kconfig and Makefile updates for XRT drivers
Thank you for the patch! Perhaps something to improve:
Hi Sonal,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on linus/master v5.10 next-20201217] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Sonal-Santan/XRT-Alveo-driver-overview/20201217-160048 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 09162bc32c880a791c6c0668ce0745cf7958f576 config: i386-randconfig-r035-20201217 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/3096c9b7caac1243afabb56e8b6c6f752cd1a0de git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Sonal-Santan/XRT-Alveo-driver-overview/20201217-160048 git checkout 3096c9b7caac1243afabb56e8b6c6f752cd1a0de # save the attached .config to linux build tree make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
drivers/fpga/xrt/lib/xrt-main.c: In function 'xrt_subdev_register_external_driver':
>> drivers/fpga/xrt/lib/xrt-main.c:158:6: warning: variable 'result' set but not used [-Wunused-but-set-variable]
158 | int result = 0;
| ^~~~~~
--
>> drivers/fpga/xrt/lib/../common/xrt-metadata.c:76:5: warning: no previous prototype for 'xrt_md_add_node' [-Wmissing-prototypes] 76 | int xrt_md_add_node(struct device *dev, char *blob, int parent_offset,
| ^~~~~~~~~~~~~~~
--
drivers/fpga/xrt/lib/subdevs/xrt-icap.c: In function 'icap_probe_chip':
>> drivers/fpga/xrt/lib/subdevs/xrt-icap.c:181:6: warning: variable 'w' set but not used [-Wunused-but-set-variable]
181 | u32 w;
| ^
--
>> drivers/fpga/xrt/lib/subdevs/xrt-clock.c:55:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
55 | const static struct xmgmt_ocl_clockwiz {
| ^~~~~
--
drivers/fpga/xrt/lib/subdevs/xrt-ucs.c: In function 'xrt_ucs_event_cb':
>> drivers/fpga/xrt/lib/subdevs/xrt-ucs.c:77:19: warning: variable 'ucs' set but not used [-Wunused-but-set-variable]
77 | struct xrt_ucs *ucs;
| ^~~
--
>> drivers/fpga/xrt/lib/subdevs/xrt-calib.c:125:5: warning: no previous prototype for 'xrt_calib_remove' [-Wmissing-prototypes]
125 | int xrt_calib_remove(struct platform_device *pdev)
| ^~~~~~~~~~~~~~~~
>> drivers/fpga/xrt/lib/subdevs/xrt-calib.c:141:5: warning: no previous prototype for 'xrt_calib_probe' [-Wmissing-prototypes] 141 | int xrt_calib_probe(struct platform_device *pdev)
| ^~~~~~~~~~~~~~~
--
In file included from include/linux/device.h:15,
from drivers/fpga/xrt/mgmt/../common/xrt-xclbin.h:14,
from drivers/fpga/xrt/mgmt/xmgmt-main.c:13:
drivers/fpga/xrt/mgmt/xmgmt-main.c: In function 'ulp_image_write':
>> drivers/fpga/xrt/mgmt/../include/subdev.h:187:20: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
187 | prt_fn(DEV(pdev), "%s %s: "fmt, \
| ^~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/fpga/xrt/mgmt/../include/subdev.h:187:2: note: in expansion of macro 'dev_err'
187 | prt_fn(DEV(pdev), "%s %s: "fmt, \
| ^~~~~~
drivers/fpga/xrt/mgmt/../include/subdev.h:189:37: note: in expansion of macro 'FMT_PRT'
189 | #define xrt_err(pdev, fmt, args...) FMT_PRT(dev_err, pdev, fmt, ##args)
| ^~~~~~~
drivers/fpga/xrt/mgmt/xmgmt-main.c:216:4: note: in expansion of macro 'xrt_err'
216 | xrt_err(xmm->pdev, "count is too small %ld", count);
| ^~~~~~~
drivers/fpga/xrt/mgmt/xmgmt-main.c:216:45: note: format string is defined here
216 | xrt_err(xmm->pdev, "count is too small %ld", count);
| ~~^
| |
| long int
| %d
In file included from include/linux/device.h:15,
from drivers/fpga/xrt/mgmt/../common/xrt-xclbin.h:14,
from drivers/fpga/xrt/mgmt/xmgmt-main.c:13:
drivers/fpga/xrt/mgmt/xmgmt-main.c: In function 'is_valid_firmware':
>> drivers/fpga/xrt/mgmt/../include/subdev.h:187:20: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
187 | prt_fn(DEV(pdev), "%s %s: "fmt, \
| ^~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/fpga/xrt/mgmt/../include/subdev.h:187:2: note: in expansion of macro 'dev_err'
187 | prt_fn(DEV(pdev), "%s %s: "fmt, \
| ^~~~~~
drivers/fpga/xrt/mgmt/../include/subdev.h:189:37: note: in expansion of macro 'FMT_PRT'
189 | #define xrt_err(pdev, fmt, args...) FMT_PRT(dev_err, pdev, fmt, ##args)
| ^~~~~~~
drivers/fpga/xrt/mgmt/xmgmt-main.c:370:3: note: in expansion of macro 'xrt_err'
370 | xrt_err(pdev, "truncated fw, length: %ld, expect: %ld",
| ^~~~~~~
drivers/fpga/xrt/mgmt/xmgmt-main.c:370:42: note: format string is defined here
370 | xrt_err(pdev, "truncated fw, length: %ld, expect: %ld",
| ~~^
| |
| long int
| %d
In file included from include/linux/device.h:15,
from drivers/fpga/xrt/mgmt/../common/xrt-xclbin.h:14,
from drivers/fpga/xrt/mgmt/xmgmt-main.c:13:
drivers/fpga/xrt/mgmt/../include/subdev.h:187:20: warning: format '%ld' expects argument of type 'long int', but argument 6 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
187 | prt_fn(DEV(pdev), "%s %s: "fmt, \
| ^~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/fpga/xrt/mgmt/../include/subdev.h:187:2: note: in expansion of macro 'dev_err'
187 | prt_fn(DEV(pdev), "%s %s: "fmt, \
| ^~~~~~
drivers/fpga/xrt/mgmt/../include/subdev.h:189:37: note: in expansion of macro 'FMT_PRT'
189 | #define xrt_err(pdev, fmt, args...) FMT_PRT(dev_err, pdev, fmt, ##args)
| ^~~~~~~
drivers/fpga/xrt/mgmt/xmgmt-main.c:370:3: note: in expansion of macro 'xrt_err'
370 | xrt_err(pdev, "truncated fw, length: %ld, expect: %ld",
| ^~~~~~~
drivers/fpga/xrt/mgmt/xmgmt-main.c:370:55: note: format string is defined here
370 | xrt_err(pdev, "truncated fw, length: %ld, expect: %ld",
| ~~^
| |
| long int
| %d
In file included from drivers/fpga/xrt/mgmt/xmgmt-main.c:21:
At top level:
drivers/fpga/xrt/mgmt/../include/subdev/axigate.h:25:27: warning: 'xrt_axigate_epnames' defined but not used [-Wunused-const-variable=]
25 | static const char * const xrt_axigate_epnames[] = {
| ^~~~~~~~~~~~~~~~~~~
--
>> drivers/fpga/xrt/mgmt/../common/xrt-metadata.c:76:5: warning: no previous prototype for 'xrt_md_add_node' [-Wmissing-prototypes] 76 | int xrt_md_add_node(struct device *dev, char *blob, int parent_offset,
| ^~~~~~~~~~~~~~~
vim +/result +158 drivers/fpga/xrt/lib/xrt-main.c
2039758de374ce7 Sonal Santan 2020-12-16 153
2039758de374ce7 Sonal Santan 2020-12-16 154 int xrt_subdev_register_external_driver(enum xrt_subdev_id id,
2039758de374ce7 Sonal Santan 2020-12-16 155 struct platform_driver *drv, struct xrt_subdev_endpoints *eps)
2039758de374ce7 Sonal Santan 2020-12-16 156 {
2039758de374ce7 Sonal Santan 2020-12-16 157 int i;
2039758de374ce7 Sonal Santan 2020-12-16 @158 int result = 0;
2039758de374ce7 Sonal Santan 2020-12-16 159
2039758de374ce7 Sonal Santan 2020-12-16 160 mutex_lock(&xrt_class_lock);
2039758de374ce7 Sonal Santan 2020-12-16 161 for (i = 0; i < ARRAY_SIZE(xrt_drv_maps); i++) {
2039758de374ce7 Sonal Santan 2020-12-16 162 struct xrt_drv_map *map = &xrt_drv_maps[i];
2039758de374ce7 Sonal Santan 2020-12-16 163
2039758de374ce7 Sonal Santan 2020-12-16 164 if (map->id != id)
2039758de374ce7 Sonal Santan 2020-12-16 165 continue;
2039758de374ce7 Sonal Santan 2020-12-16 166 if (map->drv) {
2039758de374ce7 Sonal Santan 2020-12-16 167 result = -EEXIST;
2039758de374ce7 Sonal Santan 2020-12-16 168 pr_err("Id %d already has a registered driver, 0x%p\n",
2039758de374ce7 Sonal Santan 2020-12-16 169 id, map->drv);
2039758de374ce7 Sonal Santan 2020-12-16 170 break;
2039758de374ce7 Sonal Santan 2020-12-16 171 }
2039758de374ce7 Sonal Santan 2020-12-16 172 map->drv = drv;
2039758de374ce7 Sonal Santan 2020-12-16 173 BUG_ON(map->eps);
2039758de374ce7 Sonal Santan 2020-12-16 174 map->eps = eps;
2039758de374ce7 Sonal Santan 2020-12-16 175 xrt_drv_register_driver(id);
2039758de374ce7 Sonal Santan 2020-12-16 176 }
2039758de374ce7 Sonal Santan 2020-12-16 177 mutex_unlock(&xrt_class_lock);
2039758de374ce7 Sonal Santan 2020-12-16 178 return 0;
2039758de374ce7 Sonal Santan 2020-12-16 179 }
2039758de374ce7 Sonal Santan 2020-12-16 180 EXPORT_SYMBOL_GPL(xrt_subdev_register_external_driver);
2039758de374ce7 Sonal Santan 2020-12-16 181 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org