staging: Support Avalon-MM DMA Interface for PCIe
cover staging: Support Avalon-MM DMA Interface for PCIe
The Avalon-MM DMA Interface for PCIe is a design found in hard IPs for Intel Arria, Cyclone or Stratix FPGAs. It transfers data between on-chip memory and system memory. This RFC is an attempt to provide a generic API:
typedef void (*avalon_dma_xfer_callback)(void *dma_async_param);
int avalon_dma_submit_xfer(
struct avalon_dma *avalon_dma, enum dma_data_direction direction, dma_addr_t dev_addr, dma_addr_t host_addr, unsigned int size, avalon_dma_xfer_callback callback, void *callback_param);
int avalon_dma_submit_xfer_sg(struct avalon_dma *avalon_dma,
enum dma_data_direction direction, dma_addr_t dev_addr,
struct sg_table *sg_table, avalon_dma_xfer_callback callback,
void *callback_param);
int avalon_dma_issue_pending(struct avalon_dma *avalon_dma);
Patch 1 introduces "avalon-dma" driver that provides the above-mentioned generic interface.
Patch 2 adds "avalon-drv" driver using "avalon-dma" to transfer user- provided data. This driver was used to debug and stress "avalon-dma" and could be used as a code base for other implementations. Strictly speaking, it does not need to be part of the kernel tree. A companion tool using "avalon-drv" to DMA files (not part of this patchset) is located at [email protected]:a-gordeev/avalon-drv-tool.git
The suggested interface is developed with the standard "dmaengine" in mind and could be reworked to suit it. I would appreciate, however gathering some feedback on the implemenation first - as the hardware- specific code would persist. It is also a call for testing - I only have access to a single Arria 10 device to try on.
This series is against v5.3 and could be found at [email protected]:a-gordeev/linux.git avalon-dma-engine
Alexander Gordeev (2):
staging: avalon-dma: Avalon DMA engine
staging: avalon-drv: Avalon DMA driver
drivers/staging/Kconfig | 4 + drivers/staging/Makefile | 2 + drivers/staging/avalon-dma/Kconfig | 45 ++ drivers/staging/avalon-dma/Makefile | 11 + drivers/staging/avalon-dma/avalon-dma-core.c | 515 ++++++++++++++ drivers/staging/avalon-dma/avalon-dma-core.h | 52 ++ .../staging/avalon-dma/avalon-dma-interrupt.c | 118 ++++ .../staging/avalon-dma/avalon-dma-interrupt.h | 13 + drivers/staging/avalon-dma/avalon-dma-util.c | 196 ++++++ drivers/staging/avalon-dma/avalon-dma-util.h | 25 + drivers/staging/avalon-drv/Kconfig | 34 + drivers/staging/avalon-drv/Makefile | 14 + drivers/staging/avalon-drv/avalon-drv-dev.c | 193 ++++++ drivers/staging/avalon-drv/avalon-drv-ioctl.c | 137 ++++ drivers/staging/avalon-drv/avalon-drv-ioctl.h | 12 + drivers/staging/avalon-drv/avalon-drv-mmap.c | 93 +++ drivers/staging/avalon-drv/avalon-drv-mmap.h | 12 + .../staging/avalon-drv/avalon-drv-sg-buf.c | 132 ++++ .../staging/avalon-drv/avalon-drv-sg-buf.h | 26 + drivers/staging/avalon-drv/avalon-drv-util.c | 54 ++ drivers/staging/avalon-drv/avalon-drv-util.h | 12 + drivers/staging/avalon-drv/avalon-drv-xfer.c | 655 ++++++++++++++++++ drivers/staging/avalon-drv/avalon-drv-xfer.h | 24 + drivers/staging/avalon-drv/avalon-drv.h | 22 + include/linux/avalon-dma-hw.h | 72 ++ include/linux/avalon-dma.h | 68 ++ include/uapi/linux/avalon-drv-ioctl.h | 30 + 27 files changed, 2571 insertions(+) create mode 100644 drivers/staging/avalon-dma/Kconfig create mode 100644 drivers/staging/avalon-dma/Makefile create mode 100644 drivers/staging/avalon-dma/avalon-dma-core.c create mode 100644 drivers/staging/avalon-dma/avalon-dma-core.h create mode 100644 drivers/staging/avalon-dma/avalon-dma-interrupt.c create mode 100644 drivers/staging/avalon-dma/avalon-dma-interrupt.h create mode 100644 drivers/staging/avalon-dma/avalon-dma-util.c create mode 100644 drivers/staging/avalon-dma/avalon-dma-util.h create mode 100644 drivers/staging/avalon-drv/Kconfig create mode 100644 drivers/staging/avalon-drv/Makefile create mode 100644 drivers/staging/avalon-drv/avalon-drv-dev.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-ioctl.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-ioctl.h create mode 100644 drivers/staging/avalon-drv/avalon-drv-mmap.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-mmap.h create mode 100644 drivers/staging/avalon-drv/avalon-drv-sg-buf.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-sg-buf.h create mode 100644 drivers/staging/avalon-drv/avalon-drv-util.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-util.h create mode 100644 drivers/staging/avalon-drv/avalon-drv-xfer.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-xfer.h create mode 100644 drivers/staging/avalon-drv/avalon-drv.h create mode 100644 include/linux/avalon-dma-hw.h create mode 100644 include/linux/avalon-dma.h create mode 100644 include/uapi/linux/avalon-drv-ioctl.h
Signature · 1 line
2.22.0
RFC PATCH 1/2 staging: avalon-dma: Avalon DMA engine
Basic support for Avalon-MM DMA Interface for PCIe found in hard IPs for Intel Arria, Cyclone or Stratix FPGAs. This is an alternative (though minimal functionality) implementation of reference design driver from Intel.
Unlike the reference design, the introduced interface allows submitting contiguous buffers, scatterlists and DMA completion callbacks - much like "dmaengine" does.
--- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/avalon-dma/Kconfig | 45 ++ drivers/staging/avalon-dma/Makefile | 11 + drivers/staging/avalon-dma/avalon-dma-core.c | 515 ++++++++++++++++++ drivers/staging/avalon-dma/avalon-dma-core.h | 52 ++ .../staging/avalon-dma/avalon-dma-interrupt.c | 118 ++++ .../staging/avalon-dma/avalon-dma-interrupt.h | 13 + drivers/staging/avalon-dma/avalon-dma-util.c | 196 +++++++ drivers/staging/avalon-dma/avalon-dma-util.h | 25 + include/linux/avalon-dma-hw.h | 72 +++ include/linux/avalon-dma.h | 68 +++ 12 files changed, 1118 insertions(+) create mode 100644 drivers/staging/avalon-dma/Kconfig create mode 100644 drivers/staging/avalon-dma/Makefile create mode 100644 drivers/staging/avalon-dma/avalon-dma-core.c create mode 100644 drivers/staging/avalon-dma/avalon-dma-core.h create mode 100644 drivers/staging/avalon-dma/avalon-dma-interrupt.c create mode 100644 drivers/staging/avalon-dma/avalon-dma-interrupt.h create mode 100644 drivers/staging/avalon-dma/avalon-dma-util.c create mode 100644 drivers/staging/avalon-dma/avalon-dma-util.h create mode 100644 include/linux/avalon-dma-hw.h create mode 100644 include/linux/avalon-dma.h
drivers/staging/Kconfig +2 -0
@@ -120,4 +120,6 @@ source "drivers/staging/kpc2000/Kconfig" source "drivers/staging/isdn/Kconfig" +source "drivers/staging/avalon-dma/Kconfig" + endif # STAGING
drivers/staging/Makefile +1 -0
@@ -50,3 +50,4 @@ obj-$(CONFIG_EROFS_FS) += erofs/ obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/ obj-$(CONFIG_KPC2000) += kpc2000/ obj-$(CONFIG_ISDN_CAPI) += isdn/ +obj-$(CONFIG_AVALON_DMA) += avalon-dma/
drivers/staging/avalon-dma/Kconfig new file +45 -0
45 lines not on this page · raw message
drivers/staging/avalon-dma/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Avalon DMA engine +# +# Author: Alexander Gordeev <[email protected]> +# +obj-$(CONFIG_AVALON_DMA) += avalon-dma.o + +avalon-dma-objs := avalon-dma-core.o \ + avalon-dma-util.o \ + avalon-dma-interrupt.o
drivers/staging/avalon-dma/avalon-dma-core.c new file +515 -0
515 lines not on this page · raw message
drivers/staging/avalon-dma/avalon-dma-core.h new file +52 -0
52 lines not on this page · raw message
drivers/staging/avalon-dma/avalon-dma-interrupt.c new file +118 -0
118 lines not on this page · raw message
drivers/staging/avalon-dma/avalon-dma-interrupt.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Avalon DMA engine +* +* Author: Alexander Gordeev <[email protected]> +*/ +#ifndef __AVALON_DMA_INTERRUPT_H__ +#define __AVALON_DMA_INTERRUPT_H__ + +irqreturn_t avalon_dma_interrupt (int irq,void *dev_id); +void avalon_dma_tasklet (unsigned long arg); + +#endif
drivers/staging/avalon-dma/avalon-dma-util.c new file +196 -0
196 lines not on this page · raw message
drivers/staging/avalon-dma/avalon-dma-util.h new file +25 -0
@@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Avalon DMA engine +* +* Author: Alexander Gordeev <[email protected]> +*/ +#ifndef __AVALON_DMA_UTIL_H__ +#define __AVALON_DMA_UTIL_H__ + +#include <linux/scatterlist.h> +#include <linux/dma-direction.h> + +#define DMA_DESC_MAX AVALON_DMA_DESC_NUM + +int setup_descs (struct dma_desc *descs,unsigned int desc_id, +enum dma_data_direction direction, +dma_addr_t dev_addr,dma_addr_t host_addr,unsigned int len, +unsigned int *set); +int setup_descs_sg (struct dma_desc *descs,unsigned int desc_id, +enum dma_data_direction direction, +dma_addr_t dev_addr,struct sg_table *sg_table, +struct scatterlist *sg_start,unsigned int sg_offset, +struct scatterlist **sg_stop,unsigned int *sg_set); + +#endif
include/linux/avalon-dma-hw.h new file +72 -0
72 lines not on this page · raw message
include/linux/avalon-dma.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
2.22.0
RFC PATCH 2/2 staging: avalon-drv: Avalon DMA driver
In reply to Alexander GordeevThis is sample implementation of a driver that uses "avalon-dma" driver interface to perform data transfers between on-chip and system memory in devices using Avalon-MM DMA Interface for PCIe design.
Companion user-level tool could be found at
[email protected]:a-gordeev/avalon-drv-tool.git
--- drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/avalon-drv/Kconfig | 34 + drivers/staging/avalon-drv/Makefile | 14 + drivers/staging/avalon-drv/avalon-drv-dev.c | 193 ++++++ drivers/staging/avalon-drv/avalon-drv-ioctl.c | 137 ++++ drivers/staging/avalon-drv/avalon-drv-ioctl.h | 12 + drivers/staging/avalon-drv/avalon-drv-mmap.c | 93 +++ drivers/staging/avalon-drv/avalon-drv-mmap.h | 12 + .../staging/avalon-drv/avalon-drv-sg-buf.c | 132 ++++ .../staging/avalon-drv/avalon-drv-sg-buf.h | 26 + drivers/staging/avalon-drv/avalon-drv-util.c | 54 ++ drivers/staging/avalon-drv/avalon-drv-util.h | 12 + drivers/staging/avalon-drv/avalon-drv-xfer.c | 655 ++++++++++++++++++ drivers/staging/avalon-drv/avalon-drv-xfer.h | 24 + drivers/staging/avalon-drv/avalon-drv.h | 22 + include/uapi/linux/avalon-drv-ioctl.h | 30 + 17 files changed, 1453 insertions(+) create mode 100644 drivers/staging/avalon-drv/Kconfig create mode 100644 drivers/staging/avalon-drv/Makefile create mode 100644 drivers/staging/avalon-drv/avalon-drv-dev.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-ioctl.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-ioctl.h create mode 100644 drivers/staging/avalon-drv/avalon-drv-mmap.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-mmap.h create mode 100644 drivers/staging/avalon-drv/avalon-drv-sg-buf.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-sg-buf.h create mode 100644 drivers/staging/avalon-drv/avalon-drv-util.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-util.h create mode 100644 drivers/staging/avalon-drv/avalon-drv-xfer.c create mode 100644 drivers/staging/avalon-drv/avalon-drv-xfer.h create mode 100644 drivers/staging/avalon-drv/avalon-drv.h create mode 100644 include/uapi/linux/avalon-drv-ioctl.h
drivers/staging/Kconfig +2 -0
@@ -122,4 +122,6 @@ source "drivers/staging/isdn/Kconfig" source "drivers/staging/avalon-dma/Kconfig" +source "drivers/staging/avalon-drv/Kconfig" + endif # STAGING
drivers/staging/Makefile +1 -0
@@ -51,3 +51,4 @@ obj-$(CONFIG_FIELDBUS_DEV) += fieldbus/ obj-$(CONFIG_KPC2000) += kpc2000/ obj-$(CONFIG_ISDN_CAPI) += isdn/ obj-$(CONFIG_AVALON_DMA) += avalon-dma/ +obj-$(CONFIG_AVALON_DRV) += avalon-drv/
drivers/staging/avalon-drv/Kconfig new file +34 -0
@@ -0,0 +1,34 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Avalon DMA driver +# +# Author: Alexander Gordeev <[email protected]> +# +config AVALON_DRV + depends on AVALON_DMA + tristate "Avalon DMA driver" + help + This selects a driver for Avalon DMA + +config AVALON_DRV_PCI_VENDOR_ID + hex "PCI vendor ID" + default "0x1172" + +config AVALON_DRV_PCI_DEVICE_ID + hex "PCI device ID" + default "0xe003" + +config AVALON_DRV_PCI_BAR + int "PCI device BAR the Avalon DMA controller is mapped to" + range 0 5 + default 0 + +config AVALON_DRV_PCI_MSI_COUNT_ORDER + int "Count of MSIs the PCI device provides (order)" + range 0 5 + default 5 + +config AVALON_DRV_PCI_MSI_VECTOR + int "MSI vector the Avalon DMA controller uses in multi-MSI mode" + range 0 31 + default 0
drivers/staging/avalon-drv/Makefile new file +14 -0
@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Avalon DMA driver +# +# Author: Alexander Gordeev <[email protected]> +# +obj-$(CONFIG_AVALON_DRV) += avalon-drv.o + +avalon-drv-objs := avalon-drv-dev.o \ + avalon-drv-ioctl.o \ + avalon-drv-mmap.o \ + avalon-drv-sg-buf.o \ + avalon-drv-xfer.o \ + avalon-drv-util.o
drivers/staging/avalon-drv/avalon-drv-dev.c new file +193 -0
193 lines not on this page · raw message
drivers/staging/avalon-drv/avalon-drv-ioctl.c new file +137 -0
137 lines not on this page · raw message
drivers/staging/avalon-drv/avalon-drv-ioctl.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Avalon DMA driver +* +* Author: Alexander Gordeev <[email protected]> +*/ +#ifndef __AVALON_DRV_IOCTL_H__ +#define __AVALON_DRV_IOCTL_H__ + +long avalon_dev_ioctl (struct file *file,unsigned int cmd,unsigned long arg); + +#endif
drivers/staging/avalon-drv/avalon-drv-mmap.c new file +93 -0
93 lines not on this page · raw message
drivers/staging/avalon-drv/avalon-drv-mmap.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Avalon DMA driver +* +* Author: Alexander Gordeev <[email protected]> +*/ +#ifndef __AVALON_DRV_MMAP_H__ +#define __AVALON_DRV_MMAP_H__ + +int avalon_dev_mmap (struct file *file,struct vm_area_struct *vma); + +#endif
drivers/staging/avalon-drv/avalon-drv-sg-buf.c new file +132 -0
132 lines not on this page · raw message
drivers/staging/avalon-drv/avalon-drv-sg-buf.h new file +26 -0
@@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Avalon DMA driver +* +* Author: Alexander Gordeev <[email protected]> +*/ +#ifndef __AVALON_DRV_SG_BUF_H__ +#define __AVALON_DRV_SG_BUF_H__ + +struct dma_sg_buf { +struct device *dev; +void *vaddr; +struct page **pages; +enum dma_data_direction dma_dir; +struct sg_table sgt; +size_t size; +unsigned int num_pages; +}; + +struct dma_sg_buf *dma_sg_buf_alloc (struct device *dev, +unsigned long size, +enum dma_data_direction dma_dir, +gfp_t gfp_flags); +void dma_sg_buf_free (struct dma_sg_buf *buf); + +#endif
drivers/staging/avalon-drv/avalon-drv-util.c new file +54 -0
54 lines not on this page · raw message
drivers/staging/avalon-drv/avalon-drv-util.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Avalon DMA driver +* +* Author: Alexander Gordeev <[email protected]> +*/ +#ifndef __AVALON_DRV_UTIL_H__ +#define __AVALON_DRV_UTIL_H__ + +void dump_mem (struct device *dev,void *data,size_t len); + +#endif
drivers/staging/avalon-drv/avalon-drv-xfer.c new file +655 -0
655 lines not on this page · raw message
drivers/staging/avalon-drv/avalon-drv-xfer.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Avalon DMA driver +* +* Author: Alexander Gordeev <[email protected]> +*/ +#ifndef __AVALON_DRV_XFER_H__ +#define __AVALON_DRV_XFER_H__ + +int xfer_rw (struct avalon_dma *avalon_dma, +enum dma_data_direction dir, +void __user *user_buf,size_t user_len); +int xfer_simultaneous (struct avalon_dma *avalon_dma, +void __user *user_buf_rd,size_t user_len_rd, +void __user *user_buf_wr,size_t user_len_wr); +int xfer_rw_sg (struct avalon_dma *avalon_dma, +enum dma_data_direction dir, +void __user *user_buf,size_t user_len, +bool is_smp); +int xfer_simultaneous_sg (struct avalon_dma *avalon_dma, +void __user *user_buf_rd,size_t user_len_rd, +void __user *user_buf_wr,size_t user_len_wr); + +#endif
drivers/staging/avalon-drv/avalon-drv.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Avalon DMA driver +* +* Author: Alexander Gordeev <[email protected]> +*/ +#ifndef __AVALON_DRV_H__ +#define __AVALON_DRV_H__ + +#include <linux/miscdevice.h> + +#include <linux/avalon-dma.h> + +#define DRIVER_NAME "avalon-drv" + +struct avalon_dev { +struct pci_dev *pci_dev; +struct avalon_dma avalon_dma; +struct miscdevice misc_dev; +}; + +#endif
include/uapi/linux/avalon-drv-ioctl.h new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* +* Avalon DMA driver +* +* Author: Alexander Gordeev <[email protected]> +*/ +#ifndef _UAPI_LINUX_AVALON_DRV_IOCTL_H__ +#define _UAPI_LINUX_AVALON_DRV_IOCTL_H__ + +struct avalon_ioc_info { +size_t mem_addr; +size_t mem_size; +size_t dma_size; +size_t dma_size_sg; +} __attribute((packed)); + +#define AVALON_IOC 'V' + +#define IOCTL_AVALON_GET_INFO _IOR(AVALON_IOC, 0, struct avalon_ioc_info) +#define IOCTL_AVALON_SET_INFO _IOR(AVALON_IOC, 1, struct avalon_ioc_info) +#define IOCTL_AVALON_DMA_READ _IOR(AVALON_IOC, 2, struct iovec) +#define IOCTL_AVALON_DMA_WRITE _IOW(AVALON_IOC, 3, struct iovec) +#define IOCTL_AVALON_DMA_RDWR _IOWR(AVALON_IOC, 4, struct iovec[2]) +#define IOCTL_AVALON_DMA_READ_SG _IOR(AVALON_IOC, 5, struct iovec) +#define IOCTL_AVALON_DMA_WRITE_SG _IOW(AVALON_IOC, 6, struct iovec) +#define IOCTL_AVALON_DMA_RDWR_SG _IOWR(AVALON_IOC, 7, struct iovec[2]) +#define IOCTL_AVALON_DMA_READ_SG_SMP _IOR(AVALON_IOC, 8, struct iovec) +#define IOCTL_AVALON_DMA_WRITE_SG_SMP _IOW(AVALON_IOC, 9, struct iovec) + +#endif
Signature · 1 line
2.22.0
Quoted 33 lines · Alexander Gordeev
The Avalon-MM DMA Interface for PCIe is a design found in hard IPs for Intel Arria, Cyclone or Stratix FPGAs. It transfers data between on-chip memory and system memory. This RFC is an attempt to provide a generic API:
typedef void (*avalon_dma_xfer_callback)(void
*dma_async_param);int avalon_dma_submit_xfer(
structavalon_dma*avalon_dma, enumdma_data_directiondirection,dma_addr_tdev_addr,dma_addr_thost_addr, unsigned int size,avalon_dma_xfer_callbackcallback, void*callback_param);int avalon_dma_submit_xfer_sg(struct
avalon_dma*avalon_dma,
enumdma_data_directiondirection,dma_addr_tdev_addr,
structsg_table*sg_table,avalon_dma_xfer_callbackcallback,
void*callback_param);int
avalon_dma_issue_pending(struct avalon_dma *avalon_dma);Patch 1 introduces "avalon-dma" driver that provides the above-mentioned generic interface.
Patch 2 adds "avalon-drv" driver using "avalon-dma" to transfer user- provided data. This driver was used to debug and stress "avalon-dma" and could be used as a code base for other implementations. Strictly speaking, it does not need to be part of the kernel tree. A companion tool using "avalon-drv" to DMA files (not part of this patchset) is located at [email protected]:a-gordeev/avalon-drv-tool.git
Quoted 8 lines
The suggested interface is developed with the standard "dmaengine" in mind and could be reworked to suit it. I would appreciate, however gathering some feedback on the implemenation first - as the hardware- specific code would persist. It is also a call for testing - I only have access to a single Arria 10 device to try on.
This series is against v5.3 and could be found at [email protected]:a-gordeev/linux.git avalon-dma-engine
Why is this being submitted for drivers/staging/ and not the "real" part of the kernel tree?
All staging code must have a TODO file listing what needs to be done in order to get it out of staging, and be self-contained (i.e. no files include/linux/)
Please fix that up when resending this series.
thanks,
greg k-h
Vinod Koul
maintainerQuoted 15 lines · Greg KH
Quoted 14 lines · Alexander Gordeev
The Avalon-MM DMA Interface for PCIe is a design found in hard IPs for Intel Arria, Cyclone or Stratix FPGAs. It transfers data between on-chip memory and system memory. This RFC is an attempt to provide a generic API:
typedef void (*avalon_dma_xfer_callback)(void
*dma_async_param);int avalon_dma_submit_xfer(
structavalon_dma*avalon_dma, enumdma_data_directiondirection,dma_addr_tdev_addr,dma_addr_thost_addr, unsigned int size,avalon_dma_xfer_callbackcallback, void*callback_param);
Quoted 8 lines
Quoted 8 lines
int avalon_dma_submit_xfer_sg(struct
avalon_dma*avalon_dma,
enumdma_data_directiondirection,dma_addr_tdev_addr,
structsg_table*sg_table,avalon_dma_xfer_callbackcallback,
void*callback_param);int
avalon_dma_issue_pending(struct avalon_dma *avalon_dma);
Why wrap the *existing* kernel APIs with you own!
A quick glance at the code submitted tells me that it mimcks kernel APIs. But why you folks didnt use the kernel dmaengine APIs in not clear to me. So please convert it (should be relatively easy as you seem to have wrappers for dmaengine callbacks)
Quoted 10 lines
Quoted 10 lines
Patch 1 introduces "avalon-dma" driver that provides the above-mentioned generic interface.
Patch 2 adds "avalon-drv" driver using "avalon-dma" to transfer user- provided data. This driver was used to debug and stress "avalon-dma" and could be used as a code base for other implementations. Strictly speaking, it does not need to be part of the kernel tree. A companion tool using "avalon-drv" to DMA files (not part of this patchset) is located at [email protected]:a-gordeev/avalon-drv-tool.git
Heh! We do have a dmatest driver which does this and much more! why not use that one instead of adding you own!
Quoted 5 lines
Quoted 5 lines
The suggested interface is developed with the standard "dmaengine" in mind and could be reworked to suit it. I would appreciate, however gathering some feedback on the implemenation first - as the hardware- specific code would persist. It is also a call for testing - I only have access to a single Arria 10 device to try on.
Why not use dmaengine in first place?
Quoted 11 lines
Quoted 2 lines
This series is against v5.3 and could be found at [email protected]:a-gordeev/linux.git avalon-dma-engine
Why is this being submitted for
drivers/staging/and not the "real" part of the kernel tree?All staging code must have a TODO file listing what needs to be done in order to get it out of staging, and be self-contained (i.e. no files
include/linux/)Please fix that up when resending this series.
Signature · 1 line
~Vinod
Quoted 2 lines · Greg KH
Why is this being submitted for
drivers/staging/and not the "real" part of the kernel tree?
Hi Greg!
I sent v2 of the patchset, but it does not need to be part of the staging tree. I CC-ed [email protected] for reference.
Thanks!
Quoted 9 lines
All staging code must have a TODO file listing what needs to be done in order to get it out of staging, and be self-contained (i.e. no files
include/linux/)Please fix that up when resending this series.
thanks,
greg k-h