xilinx XDMA driver
Subsystems (3)
Lizhi Hou
maintainerv3 cover xilinx XDMA driver
Hello,
This V3 of patch series is to provide the platform driver to support the Xilinx XDMA subsystem. The XDMA subsystem is used in conjunction with the PCI Express IP block to provide high performance data transfer between host memory and the card's DMA subsystem. It also provides up to 16 user interrupt wires to user logic that generate interrupts to the host.
+-------+ +-------+ +-----------+
PCIe | | | | | |
Tx/Rx | | | | AXI | |
<=======> | PCIE | <===> | XDMA | <====>| User Logic|
| | | | | |
+-------+ +-------+ +-----------+The XDMA has been used for Xilinx Alveo PCIe devices.
And it is also integrated into Versal ACAP DMA and Bridge Subsystem.
https://www.xilinx.com/products/boards-and-kits/alveo.html
https://docs.xilinx.com/r/en-US/pg344-pcie-dma-versal/Introduction-to-the-DMA-and-Bridge-Subsystems
The device driver for any FPGA based PCIe device which leverages XDMA can call the standard dmaengine APIs to discover and use the XDMA subsystem without duplicating the XDMA driver code in its own driver.
Changes since v2:
- Removed tasklet.
- Fixed regression bug introduced to V2.
- Test Robot warning.
Changes since v1:
- Moved filling hardware descriptor to xdma_prep_device_sg().
- Changed hardware descriptor enum to "struct xdma_hw_desc".
- Minor changes from code review comments.
Lizhi Hou (1):
dmaengine: xilinx: xdma: add xilinx xdma driver
MAINTAINERS | 10 + drivers/dma/Kconfig | 13 + drivers/dma/xilinx/Makefile | 1 + drivers/dma/xilinx/xdma-regs.h | 171 +++++ drivers/dma/xilinx/xdma.c | 965 +++++++++++++++++++++++++ include/linux/platform_data/amd_xdma.h | 34 + 6 files changed, 1194 insertions(+) create mode 100644 drivers/dma/xilinx/xdma-regs.h create mode 100644 drivers/dma/xilinx/xdma.c create mode 100644 include/linux/platform_data/amd_xdma.h
Signature · 1 line
2.27.0
Lizhi Hou
maintainerPATCH v3 1/1 dmaengine: xilinx: xdma: add xilinx xdma driver
Add driver to enable PCIe board which uses XDMA (the DMA/Bridge Subsystem for PCI Express). For example, Xilinx Alveo PCIe devices.
https://www.xilinx.com/products/boards-and-kits/alveo.html
The XDMA engine support up to 4 Host to Card (H2C) and 4 Card to Host (C2H) channels. Memory transfers are specified on a per-channel basis in descriptor linked lists, which the DMA fetches from host memory and processes. Events such as descriptor completion and errors are signaled using interrupts. The hardware detail is provided by
https://docs.xilinx.com/r/en-US/pg195-pcie-dma/Introduction
This driver implements dmaengine APIs.
- probe the available DMA channels
- use dma_slave_map for channel lookup
- use virtual channel to manage dmaengine tx descriptors
- implement device_prep_slave_sg callback to handle host scatter gather list
- implement device_config to config device address for DMA transfer
--- MAINTAINERS | 10 + drivers/dma/Kconfig | 13 + drivers/dma/xilinx/Makefile | 1 + drivers/dma/xilinx/xdma-regs.h | 171 +++++ drivers/dma/xilinx/xdma.c | 965 +++++++++++++++++++++++++ include/linux/platform_data/amd_xdma.h | 34 + 6 files changed, 1194 insertions(+) create mode 100644 drivers/dma/xilinx/xdma-regs.h create mode 100644 drivers/dma/xilinx/xdma.c create mode 100644 include/linux/platform_data/amd_xdma.h
MAINTAINERS +10 -0
@@ -21683,6 +21683,16 @@ F: Documentation/devicetree/bindings/media/xilinx/ F: drivers/media/platform/xilinx/ F: include/uapi/linux/xilinx-v4l2-controls.h +XILINX XDMA DRIVER +M: Lizhi Hou <[email protected]> +M: Brian Xu <[email protected]> +M: Raj Kumar Rampelli <[email protected]> +L: [email protected] +S: Supported +F: drivers/dma/xilinx/xdma-regs.h +F: drivers/dma/xilinx/xdma.c +F: include/linux/platform_data/amd_xdma.h + XILINX ZYNQMP DPDMA DRIVER M: Hyun Kwon <[email protected]> M: Laurent Pinchart <[email protected]>
drivers/dma/Kconfig +13 -0
@@ -733,6 +733,19 @@ config XILINX_ZYNQMP_DPDMA driver provides the dmaengine required by the DisplayPort subsystem display driver. +config XILINX_XDMA + tristate "Xilinx DMA/Bridge Subsystem DMA Engine" + select DMA_ENGINE + select DMA_VIRTUAL_CHANNELS + select REGMAP_MMIO + help + Enable support for Xilinx DMA/Bridge Subsystem DMA engine. The DMA + provides high performance block data movement between Host memory + and the DMA subsystem. These direct memory transfers can be both in + the Host to Card (H2C) and Card to Host (C2H) transfers. + The core also provides up to 16 user interrupt wires that generate + interrupts to the host. + # driver files source "drivers/dma/bestcomm/Kconfig"
drivers/dma/xilinx/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_XILINX_DMA) += xilinx_dma.o obj-$(CONFIG_XILINX_ZYNQMP_DMA) += zynqmp_dma.o obj-$(CONFIG_XILINX_ZYNQMP_DPDMA) += xilinx_dpdma.o +obj-$(CONFIG_XILINX_XDMA) += xdma.o
drivers/dma/xilinx/xdma-regs.h new file +171 -0
171 lines not on this page · raw message
drivers/dma/xilinx/xdma.c new file +965 -0
965 lines not on this page · raw message
include/linux/platform_data/amd_xdma.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved. +*/ + +#ifndef _PLATDATA_AMD_XDMA_H +#define _PLATDATA_AMD_XDMA_H + +#include <linux/dmaengine.h> + +/** +* struct xdma_chan_info - DMA channel information +* This information is used to match channel when request dma channel +* @dir: Channel transfer direction +*/ +struct xdma_chan_info { +enum dma_transfer_direction dir; +}; + +#define XDMA_FILTER_PARAM (chan_info) ((void *)(chan_info)) + +struct dma_slave_map ; + +/** +* struct xdma_platdata - platform specific data for XDMA engine +* @max_dma_channels: Maximum dma channels in each direction +*/ +struct xdma_platdata { +u32 max_dma_channels; +u32 device_map_cnt; +struct dma_slave_map *device_map; +}; + +#endif /* _PLATDATA_AMD_XDMA_H */
Signature · 1 line
2.27.0
kernel test robot
build botRe: [PATCH V3 XDMA 1/1] dmaengine: xilinx: xdma: add xilinx xdma driver
I love your patch! Yet something to improve:
Hi Lizhi,
I love your patch! Yet something to improve:
[auto build test ERROR on vkoul-dmaengine/next]
[also build test ERROR on linus/master v6.0-rc6 next-20220919] [cannot apply to xilinx-xlnx/master]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Lizhi-Hou/xilinx-XDMA-driver/20220920-074553 base: https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git next config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20220920/[email protected]/config) compiler: m68k-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/2622fde9f389e211554d46e149765c1fe5da6f44
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Lizhi-Hou/xilinx-XDMA-driver/20220920-074553
git checkout 2622fde9f389e211554d46e149765c1fe5da6f44
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/dma/xilinx/
If you fix the issue, kindly add following tag where applicable
All errors (new ones prefixed by >>):
In file included from <command-line>:
drivers/dma/xilinx/xdma.c: In function 'xdma_xfer_start.isra':
>> include/linux/compiler_types.h:354:45: error: call to '__compiletime_assert_247' declared with attribute error: FIELD_GET: type of reg too small for mask
354 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
include/linux/compiler_types.h:335:25: note: in definition of macro '__compiletime_assert'
335 | prefix ## suffix(); \
| ^~~~~~
include/linux/compiler_types.h:354:9: note: in expansion of macro '_compiletime_assert'
354 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/bitfield.h:71:17: note: in expansion of macro 'BUILD_BUG_ON_MSG'
71 | BUILD_BUG_ON_MSG(__bf_cast_unsigned(_mask, _mask) > \
| ^~~~~~~~~~~~~~~~
include/linux/bitfield.h:128:17: note: in expansion of macro '__BF_FIELD_CHECK'
128 | __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
| ^~~~~~~~~~~~~~~~
drivers/dma/xilinx/xdma.c:358:15: note: in expansion of macro 'FIELD_GET'
358 | val = FIELD_GET(XDMA_HI_ADDR_MASK, block->dma_addr);
| ^~~~~~~~~vim +/__compiletime_assert_247 +354 include/linux/compiler_types.h
eb5c2d4b45e3d2 Will Deacon 2020-07-21 340 eb5c2d4b45e3d2 Will Deacon 2020-07-21 341 #define _compiletime_assert(condition, msg, prefix, suffix) \ eb5c2d4b45e3d2 Will Deacon 2020-07-21 342 __compiletime_assert(condition, msg, prefix, suffix) eb5c2d4b45e3d2 Will Deacon 2020-07-21 343 eb5c2d4b45e3d2 Will Deacon 2020-07-21 344 /** eb5c2d4b45e3d2 Will Deacon 2020-07-21 345 * compiletime_assert - break build and emit msg if condition is false eb5c2d4b45e3d2 Will Deacon 2020-07-21 346 * @condition: a compile-time constant condition to check eb5c2d4b45e3d2 Will Deacon 2020-07-21 347 * @msg: a message to emit if condition is false eb5c2d4b45e3d2 Will Deacon 2020-07-21 348 * eb5c2d4b45e3d2 Will Deacon 2020-07-21 349 * In tradition of POSIX assert, this macro will break the build if the eb5c2d4b45e3d2 Will Deacon 2020-07-21 350 * supplied condition is *false*, emitting the supplied error message if the eb5c2d4b45e3d2 Will Deacon 2020-07-21 351 * compiler has support to do so. eb5c2d4b45e3d2 Will Deacon 2020-07-21 352 */ eb5c2d4b45e3d2 Will Deacon 2020-07-21 353 #define compiletime_assert(condition, msg) \
eb5c2d4b45e3d2 Will Deacon 2020-07-21 @354 _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)eb5c2d4b45e3d2 Will Deacon 2020-07-21 355
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp