Commit 50835e97 authored by Alexandre Bounine's avatar Alexandre Bounine Committed by Linus Torvalds

rapidio/tsi721_dma: rework scatter-gather list handling

Rework Tsi721 RapidIO DMA engine support to allow handling data
scatter/gather lists longer than number of hardware buffer descriptors in
the DMA channel's descriptor list.

The current implementation of Tsi721 DMA transfers requires that number of
entries in a scatter/gather list provided by a caller of
dmaengine_prep_rio_sg() should not exceed number of allocated hardware
buffer descriptors.

This patch removes the limitation by processing long scatter/gather lists
by sections that can be transferred using hardware descriptor ring of
configured size.  It also introduces a module parameter
"dma_desc_per_channel" to allow run-time configuration of Tsi721 hardware
buffer descriptor rings.
Signed-off-by: default avatarAlexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Cc: Stef van Os <stef.van.os@prodrive-technologies.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 4aff1ce7
...@@ -20,13 +20,26 @@ II. Known problems ...@@ -20,13 +20,26 @@ II. Known problems
None. None.
III. To do III. DMA Engine Support
Add DMA data transfers (non-messaging). Tsi721 mport driver supports DMA data transfers between local system memory and
Add inbound region (SRIO-to-PCIe) mapping. remote RapidIO devices. This functionality is implemented according to SLAVE
mode API defined by common Linux kernel DMA Engine framework.
Depending on system requirements RapidIO DMA operations can be included/excluded
by setting CONFIG_RAPIDIO_DMA_ENGINE option. Tsi721 miniport driver uses seven
out of eight available BDMA channels to support DMA data transfers.
One BDMA channel is reserved for generation of maintenance read/write requests.
If Tsi721 mport driver have been built with RAPIDIO_DMA_ENGINE support included,
this driver will accept DMA-specific module parameter:
"dma_desc_per_channel" - defines number of hardware buffer descriptors used by
each BDMA channel of Tsi721 (by default - 128).
IV. Version History IV. Version History
1.1.0 - DMA operations re-worked to support data scatter/gather lists larger
than hardware buffer descriptors ring.
1.0.0 - Initial driver release. 1.0.0 - Initial driver release.
V. License V. License
......
...@@ -644,27 +644,26 @@ enum tsi721_smsg_int_flag { ...@@ -644,27 +644,26 @@ enum tsi721_smsg_int_flag {
#ifdef CONFIG_RAPIDIO_DMA_ENGINE #ifdef CONFIG_RAPIDIO_DMA_ENGINE
#define TSI721_BDMA_BD_RING_SZ 128
#define TSI721_BDMA_MAX_BCOUNT (TSI721_DMAD_BCOUNT1 + 1) #define TSI721_BDMA_MAX_BCOUNT (TSI721_DMAD_BCOUNT1 + 1)
struct tsi721_tx_desc { struct tsi721_tx_desc {
struct dma_async_tx_descriptor txd; struct dma_async_tx_descriptor txd;
struct tsi721_dma_desc *hw_desc;
u16 destid; u16 destid;
/* low 64-bits of 66-bit RIO address */ /* low 64-bits of 66-bit RIO address */
u64 rio_addr; u64 rio_addr;
/* upper 2-bits of 66-bit RIO address */ /* upper 2-bits of 66-bit RIO address */
u8 rio_addr_u; u8 rio_addr_u;
u32 bcount; enum dma_rtype rtype;
bool interrupt;
struct list_head desc_node; struct list_head desc_node;
struct list_head tx_list; struct scatterlist *sg;
unsigned int sg_len;
enum dma_status status;
}; };
struct tsi721_bdma_chan { struct tsi721_bdma_chan {
int id; int id;
void __iomem *regs; void __iomem *regs;
int bd_num; /* number of buffer descriptors */ int bd_num; /* number of HW buffer descriptors */
void *bd_base; /* start of DMA descriptors */ void *bd_base; /* start of DMA descriptors */
dma_addr_t bd_phys; dma_addr_t bd_phys;
void *sts_base; /* start of DMA BD status FIFO */ void *sts_base; /* start of DMA BD status FIFO */
...@@ -680,7 +679,6 @@ struct tsi721_bdma_chan { ...@@ -680,7 +679,6 @@ struct tsi721_bdma_chan {
struct list_head active_list; struct list_head active_list;
struct list_head queue; struct list_head queue;
struct list_head free_list; struct list_head free_list;
dma_cookie_t completed_cookie;
struct tasklet_struct tasklet; struct tasklet_struct tasklet;
bool active; bool active;
}; };
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment