lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <201212061648.00277.b.zolnierkie@samsung.com>
Date:	Thu, 06 Dec 2012 16:48:00 +0100
From:	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
To:	Dan Williams <djbw@...com>
Cc:	linux-kernel@...r.kernel.org, linux@....linux.org.uk,
	vinod.koul@...el.com, Tomasz Figa <t.figa@...sung.com>,
	Kyungmin Park <kyungmin.park@...sung.com>, dave.jiang@...el.com
Subject: Re: [PATCH 05/12] async_memset: convert to dmaengine_unmap_data


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@...sung.com>
> Cc: Kyungmin Park <kyungmin.park@...sung.com>
> Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
> Signed-off-by: Dan Williams <djbw@...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
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ