linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Dan Williams <djbw@fb.com>
Cc: linux-kernel@vger.kernel.org, linux@arm.linux.org.uk,
	vinod.koul@intel.com, Tomasz Figa <t.figa@samsung.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	dave.jiang@intel.com
Subject: Re: [PATCH 05/12] async_memset: convert to dmaengine_unmap_data
Date: Thu, 06 Dec 2012 16:48:00 +0100	[thread overview]
Message-ID: <201212061648.00277.b.zolnierkie@samsung.com> (raw)
In-Reply-To: <20121206092536.17085.7308.stgit@dev279.prn1.facebook.com>


On Thursday 06 December 2012 10:25:37 Dan Williams wrote:
> Use the generic unmap object to unmap dma buffers.
> 
> Cc: Tomasz Figa <t.figa@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> Signed-off-by: Dan Williams <djbw@fb.com>
> ---
>  crypto/async_tx/async_memset.c |   18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/crypto/async_tx/async_memset.c b/crypto/async_tx/async_memset.c
> index 05a4d1e..ffca53b 100644
> --- a/crypto/async_tx/async_memset.c
> +++ b/crypto/async_tx/async_memset.c
> @@ -47,17 +47,22 @@ 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;
> +	struct dmaengine_unmap_data *unmap = NULL;
>  
> -	if (device && is_dma_fill_aligned(device, offset, 0, len)) {
> -		dma_addr_t dma_dest;
> -		unsigned long dma_prep_flags = 0;
> +	if (device)
> +		unmap = dmaengine_get_unmap_data(device->dev, 1, GFP_NOIO);
> +
> +	if (unmap && is_dma_fill_aligned(device, offset, 0, len)) {
> +		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;
>  		if (submit->flags & ASYNC_TX_FENCE)
>  			dma_prep_flags |= DMA_PREP_FENCE;
> -		dma_dest = dma_map_page(device->dev, dest, offset, len,
> -					DMA_FROM_DEVICE);
> +		unmap->from_cnt = 1;
> +		unmap->addr[0] = dma_map_page(device->dev, dest, offset, len,
> +					      DMA_FROM_DEVICE);

unmap->len is not set anywhere

>  		tx = device->device_prep_dma_memset(chan, dma_dest, val, len,
>  						    dma_prep_flags);
> @@ -65,6 +70,8 @@ async_memset(struct page *dest, int val, unsigned int offset, size_t len,
>  
>  	if (tx) {
>  		pr_debug("%s: (async) len: %zu\n", __func__, len);
> +
> +		dma_set_unmap(tx, unmap);
>  		async_tx_submit(chan, tx, submit);
>  	} else { /* run the memset synchronously */
>  		void *dest_buf;
> @@ -79,6 +86,7 @@ async_memset(struct page *dest, int val, unsigned int offset, size_t len,
>  
>  		async_tx_sync_epilog(submit);
>  	}
> +	dmaengine_unmap_put(unmap);
>  
>  	return tx;
>  }

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung Poland R&D Center

  reply	other threads:[~2012-12-06 15:49 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-06  9:25 [PATCH 00/12] dmaengine_unmap_data Dan Williams
2012-12-06  9:25 ` [PATCH 01/12] dmaengine: consolidate memcpy apis Dan Williams
2012-12-06  9:25 ` [PATCH 02/12] dmaengine: prepare for generic 'unmap' data Dan Williams
2012-12-06 15:47   ` Bartlomiej Zolnierkiewicz
2013-06-26 10:44     ` dmaengine_unmap_data patches (was: Re: Re: [PATCH 02/12] dmaengine: prepare for generic 'unmap' data) Bartlomiej Zolnierkiewicz
2013-06-28 17:35       ` Dan Williams
2012-12-06  9:25 ` [PATCH 03/12] dmaengine: reference counted unmap data Dan Williams
2012-12-06 15:47   ` Bartlomiej Zolnierkiewicz
2012-12-06  9:25 ` [PATCH 04/12] async_memcpy: convert to dmaengine_unmap_data Dan Williams
2012-12-06 15:47   ` Bartlomiej Zolnierkiewicz
2012-12-06  9:25 ` [PATCH 05/12] async_memset: " Dan Williams
2012-12-06 15:48   ` Bartlomiej Zolnierkiewicz [this message]
2012-12-06  9:25 ` [PATCH 06/12] async_xor: " Dan Williams
2012-12-06 15:48   ` Bartlomiej Zolnierkiewicz
2012-12-06  9:25 ` [PATCH 07/12] async_xor_val: " Dan Williams
2012-12-06 15:48   ` Bartlomiej Zolnierkiewicz
2012-12-06  9:25 ` [PATCH 08/12] async_raid6_recov: " Dan Williams
2012-12-06 15:48   ` Bartlomiej Zolnierkiewicz
2012-12-06  9:25 ` [PATCH 09/12] async_pq: " Dan Williams
2012-12-06 15:48   ` Bartlomiej Zolnierkiewicz
2012-12-06  9:26 ` [PATCH 10/12] async_pq_val: " Dan Williams
2012-12-06 15:48   ` Bartlomiej Zolnierkiewicz
2012-12-06  9:26 ` [PATCH 11/12] dmaengine: remove DMA unmap from drivers Dan Williams
2012-12-06  9:26 ` [PATCH 12/12] dmaengine: remove DMA unmap flags Dan Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201212061648.00277.b.zolnierkie@samsung.com \
    --to=b.zolnierkie@samsung.com \
    --cc=dave.jiang@intel.com \
    --cc=djbw@fb.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=t.figa@samsung.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).