[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <1352109631-3385-12-git-send-email-b.zolnierkie@samsung.com>
Date: Mon, 05 Nov 2012 11:00:22 +0100
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
To: linux-kernel@...r.kernel.org
Cc: djbw@...com, dwmw2@...radead.org, hskinnemoen@...il.com,
iws@...o.caltech.edu, vinod.koul@...el.com, vipin.kumar@...com,
t.figa@...sung.com, kyungmin.park@...sung.com,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Subject: [PATCH 11/20] async_tx: do DMA unmap in core for MEMSET operations
Convert core async_tx code (async_memset()) to do DMA unmapping
itself using the ->callback functionality.
Cc: Dan Williams <djbw@...com>
Cc: Tomasz Figa <t.figa@...sung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@...sung.com>
---
crypto/async_tx/async_memset.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/crypto/async_tx/async_memset.c b/crypto/async_tx/async_memset.c
index a6a667b..cf30bf1 100644
--- a/crypto/async_tx/async_memset.c
+++ b/crypto/async_tx/async_memset.c
@@ -30,6 +30,17 @@
#include <linux/dma-mapping.h>
#include <linux/async_tx.h>
+static void async_memset_cb(void *dma_async_param)
+{
+ struct dma_async_tx_descriptor *tx = dma_async_param;
+ struct dma_device *dev = tx->chan->device;
+
+ dma_unmap_page(dev->dev, tx->dma_dst, tx->dma_len, DMA_FROM_DEVICE);
+
+ if (tx->orig_callback)
+ tx->orig_callback(tx->orig_callback_param);
+}
+
/**
* async_memset - attempt to fill memory with a dma engine.
* @dest: destination page
@@ -47,10 +58,11 @@ async_memset(struct page *dest, int val, unsigned int offset, size_t len,
&dest, 1, NULL, 0, len);
struct dma_device *device = chan ? chan->device : NULL;
struct dma_async_tx_descriptor *tx = NULL;
+ dma_addr_t dma_dest;
if (device && is_dma_fill_aligned(device, offset, 0, len)) {
- dma_addr_t dma_dest;
- unsigned long dma_prep_flags = 0;
+ unsigned long dma_prep_flags = DMA_COMPL_SKIP_SRC_UNMAP |
+ DMA_COMPL_SKIP_DEST_UNMAP;
if (submit->cb_fn)
dma_prep_flags |= DMA_PREP_INTERRUPT;
@@ -68,7 +80,11 @@ async_memset(struct page *dest, int val, unsigned int offset, size_t len,
if (tx) {
pr_debug("%s: (async) len: %zu\n", __func__, len);
- async_tx_submit(chan, tx, submit);
+
+ tx->dma_dst = dma_dest;
+ tx->dma_len = len;
+
+ __async_tx_submit(chan, tx, async_memset_cb, tx, submit);
} else { /* run the memset synchronously */
void *dest_buf;
pr_debug("%s: (sync) len: %zu\n", __func__, len);
--
1.8.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists