Skip to content

Commit 47437b2

Browse files
committed
async_tx: allow architecture specific async_tx_find_channel implementations
The source and destination addresses are included to allow channel selection based on address alignment. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
1 parent d4c56f9 commit 47437b2

5 files changed

Lines changed: 22 additions & 9 deletions

File tree

‎crypto/async_tx/async_memcpy.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ async_memcpy(struct page *dest, struct page *src, unsigned int dest_offset,
4646
struct dma_async_tx_descriptor *depend_tx,
4747
dma_async_tx_callback cb_fn, void *cb_param)
4848
{
49-
struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_MEMCPY);
49+
struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_MEMCPY,
50+
&dest, 1, &src, 1, len);
5051
struct dma_device *device = chan ? chan->device : NULL;
5152
struct dma_async_tx_descriptor *tx = NULL;
5253

‎crypto/async_tx/async_memset.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ async_memset(struct page *dest, int val, unsigned int offset,
4646
struct dma_async_tx_descriptor *depend_tx,
4747
dma_async_tx_callback cb_fn, void *cb_param)
4848
{
49-
struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_MEMSET);
49+
struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_MEMSET,
50+
&dest, 1, NULL, 0, len);
5051
struct dma_device *device = chan ? chan->device : NULL;
5152
struct dma_async_tx_descriptor *tx = NULL;
5253

‎crypto/async_tx/async_tx.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,13 @@ static void __exit async_tx_exit(void)
361361
}
362362

363363
/**
364-
* async_tx_find_channel - find a channel to carry out the operation or let
364+
* __async_tx_find_channel - find a channel to carry out the operation or let
365365
* the transaction execute synchronously
366366
* @depend_tx: transaction dependency
367367
* @tx_type: transaction type
368368
*/
369369
struct dma_chan *
370-
async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
370+
__async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
371371
enum dma_transaction_type tx_type)
372372
{
373373
/* see if we can keep the chain on one channel */
@@ -383,7 +383,7 @@ async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
383383
} else
384384
return NULL;
385385
}
386-
EXPORT_SYMBOL_GPL(async_tx_find_channel);
386+
EXPORT_SYMBOL_GPL(__async_tx_find_channel);
387387
#else
388388
static int __init async_tx_init(void)
389389
{

‎crypto/async_tx/async_xor.c‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ async_xor(struct page *dest, struct page **src_list, unsigned int offset,
129129
struct dma_async_tx_descriptor *depend_tx,
130130
dma_async_tx_callback cb_fn, void *cb_param)
131131
{
132-
struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_XOR);
132+
struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_XOR,
133+
&dest, 1, src_list,
134+
src_cnt, len);
133135
struct dma_device *device = chan ? chan->device : NULL;
134136
struct dma_async_tx_descriptor *tx = NULL;
135137
dma_async_tx_callback _cb_fn;
@@ -261,7 +263,9 @@ async_xor_zero_sum(struct page *dest, struct page **src_list,
261263
struct dma_async_tx_descriptor *depend_tx,
262264
dma_async_tx_callback cb_fn, void *cb_param)
263265
{
264-
struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_ZERO_SUM);
266+
struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_ZERO_SUM,
267+
&dest, 1, src_list,
268+
src_cnt, len);
265269
struct dma_device *device = chan ? chan->device : NULL;
266270
struct dma_async_tx_descriptor *tx = NULL;
267271

‎include/linux/async_tx.h‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,15 @@ enum async_tx_flags {
6262
void async_tx_issue_pending_all(void);
6363
enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
6464
void async_tx_run_dependencies(struct dma_async_tx_descriptor *tx);
65+
#ifdef CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL
66+
#include <asm/async_tx.h>
67+
#else
68+
#define async_tx_find_channel(dep, type, dst, dst_count, src, src_count, len) \
69+
__async_tx_find_channel(dep, type)
6570
struct dma_chan *
66-
async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
71+
__async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
6772
enum dma_transaction_type tx_type);
73+
#endif /* CONFIG_ARCH_HAS_ASYNC_TX_FIND_CHANNEL */
6874
#else
6975
static inline void async_tx_issue_pending_all(void)
7076
{
@@ -86,7 +92,8 @@ async_tx_run_dependencies(struct dma_async_tx_descriptor *tx,
8692

8793
static inline struct dma_chan *
8894
async_tx_find_channel(struct dma_async_tx_descriptor *depend_tx,
89-
enum dma_transaction_type tx_type)
95+
enum dma_transaction_type tx_type, struct page **dst, int dst_count,
96+
struct page **src, int src_count, size_t len)
9097
{
9198
return NULL;
9299
}

0 commit comments

Comments
 (0)