Re: [PATCHv2] DMAEngine: Define generic transfer request api

From: Barry Song
Date: Fri Sep 16 2011 - 03:17:26 EST


2011/9/15 Jassi Brar <jaswinder.singh@xxxxxxxxxx>:
> Define a new api that could be used for doing fancy data transfers
> like interleaved to contiguous copy and vice-versa.
> Traditional SG_list based transfers tend to be very inefficient in
> such cases as where the interleave and chunk are only a few bytes,
> which call for a very condensed api to convey pattern of the transfer.
>
> This api supports all 4 variants of scatter-gather and contiguous transfer.
> Besides, in future it could also represent common operations like
> Â Â Â Âdevice_prep_dma_{cyclic, memset, memcpy}
> and maybe some more that I am not sure of.
>
> Of course, neither can this api help transfers that don't lend to DMA by
> nature, i.e, scattered tiny read/writes with no periodic pattern.
>
> Signed-off-by: Jassi Brar <jaswinder.singh@xxxxxxxxxx>
> ---
>
> Changes since v1:
> Â 1) Dropped the 'dma_transaction_type' member until we really
> Â Â Âmerge another type into this api. Instead added special
> Â Â Âtype for this api - DMA_GENXFER in dma_transaction_type.
> Â 2) Renamed 'xfer_template' to 'dmaxfer_template' inorder to
> Â Â Âpreserve namespace, closer to as suggested by Barry Song.
>
> Âdrivers/dma/dmaengine.c  |  Â2 +
> Âinclude/linux/dmaengine.h | Â 71 +++++++++++++++++++++++++++++++++++++++++++++
> Â2 files changed, 73 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
> index b48967b..63284f6 100644
> --- a/drivers/dma/dmaengine.c
> +++ b/drivers/dma/dmaengine.c
> @@ -699,6 +699,8 @@ int dma_async_device_register(struct dma_device *device)
> Â Â Â Â Â Â Â Â!device->device_prep_dma_cyclic);
> Â Â Â ÂBUG_ON(dma_has_cap(DMA_SLAVE, device->cap_mask) &&
> Â Â Â Â Â Â Â Â!device->device_control);
> + Â Â Â BUG_ON(dma_has_cap(DMA_GENXFER, device->cap_mask) &&
> + Â Â Â Â Â Â Â !device->device_prep_dma_genxfer);

i don't think it is what i want here. device_prep_dma_genxfer should
be able to cover memcpy, slave or other modes, but not parallel with
them.
For example, if i use genxfer, but my devices are slave. i might not
need a device_prep_slave_sg since i have already prep_dma_genxfer, but
anyway, i need a DMA_SLAVE_CONFIG to set burst size or others. then
i'd like to have DMA_SLAVE flag but without device_prep_slave_sg
callback.

>
> Â Â Â ÂBUG_ON(!device->device_alloc_chan_resources);
> Â Â Â ÂBUG_ON(!device->device_free_chan_resources);
> diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
> index 8fbf40e..68ebe6c 100644
> --- a/include/linux/dmaengine.h
> +++ b/include/linux/dmaengine.h
> @@ -71,11 +71,79 @@ enum dma_transaction_type {
> Â Â Â ÂDMA_ASYNC_TX,
> Â Â Â ÂDMA_SLAVE,
> Â Â Â ÂDMA_CYCLIC,
> + Â Â Â DMA_GENXFER,
> Â};

-barry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/