[PATCH RFC 0/2] staging: Support Avalon-MM DMA Interface for PCIe

From: Alexander Gordeev
Date: Thu Sep 19 2019 - 05:59:21 EST


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 git@xxxxxxxxxx: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
git@xxxxxxxxxx:a-gordeev/linux.git avalon-dma-engine


CC: Michael Chen <micchen@xxxxxxxxxx>
CC: devel@xxxxxxxxxxxxxxxxxxxx
CC: dmaengine@xxxxxxxxxxxxxxx

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

--
2.22.0