Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-18 Thread Boris Brezillon
On Thu, 18 Jun 2015 10:48:03 +0100 Russell King - ARM Linux wrote: > On Thu, Jun 18, 2015 at 11:33:24AM +0200, Boris Brezillon wrote: > > Hi Russel, > > > > On Thu, 18 Jun 2015 10:04:00 +0100 > > Russell King - ARM Linux wrote: > > > > > On Wed, Jun 17, 2015 at 05:50:01PM +0800, Herbert Xu

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-18 Thread Russell King - ARM Linux
On Thu, Jun 18, 2015 at 11:33:24AM +0200, Boris Brezillon wrote: > Hi Russel, > > On Thu, 18 Jun 2015 10:04:00 +0100 > Russell King - ARM Linux wrote: > > > On Wed, Jun 17, 2015 at 05:50:01PM +0800, Herbert Xu wrote: > > > On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon wrote: > > > >

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-18 Thread Herbert Xu
On Thu, Jun 18, 2015 at 10:04:00AM +0100, Russell King - ARM Linux wrote: > > If dma_map_sg() coalesces scatterlist entries, then ret will be smaller > than src_nents, and ret indicates how many scatterlist entries to be > walked during DMA - you should not use src_nents for that. I couldn't >

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-18 Thread Boris Brezillon
Hi Russel, On Thu, 18 Jun 2015 10:04:00 +0100 Russell King - ARM Linux wrote: > On Wed, Jun 17, 2015 at 05:50:01PM +0800, Herbert Xu wrote: > > On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon wrote: > > > > > > + ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, > > > +

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-18 Thread Russell King - ARM Linux
On Wed, Jun 17, 2015 at 05:50:01PM +0800, Herbert Xu wrote: > On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon wrote: > > > > + ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, > > +DMA_TO_DEVICE); > > + if (!ret) > > + return -ENOMEM; > > + > >

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-18 Thread Boris Brezillon
On Thu, 18 Jun 2015 10:48:03 +0100 Russell King - ARM Linux li...@arm.linux.org.uk wrote: On Thu, Jun 18, 2015 at 11:33:24AM +0200, Boris Brezillon wrote: Hi Russel, On Thu, 18 Jun 2015 10:04:00 +0100 Russell King - ARM Linux li...@arm.linux.org.uk wrote: On Wed, Jun 17, 2015 at

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-18 Thread Herbert Xu
On Thu, Jun 18, 2015 at 10:04:00AM +0100, Russell King - ARM Linux wrote: If dma_map_sg() coalesces scatterlist entries, then ret will be smaller than src_nents, and ret indicates how many scatterlist entries to be walked during DMA - you should not use src_nents for that. I couldn't see

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-18 Thread Russell King - ARM Linux
On Thu, Jun 18, 2015 at 11:33:24AM +0200, Boris Brezillon wrote: Hi Russel, On Thu, 18 Jun 2015 10:04:00 +0100 Russell King - ARM Linux li...@arm.linux.org.uk wrote: On Wed, Jun 17, 2015 at 05:50:01PM +0800, Herbert Xu wrote: On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-18 Thread Russell King - ARM Linux
On Wed, Jun 17, 2015 at 05:50:01PM +0800, Herbert Xu wrote: On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon wrote: + ret = dma_map_sg(cesa_dev-dev, req-src, creq-src_nents, +DMA_TO_DEVICE); + if (!ret) + return -ENOMEM; + +

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-18 Thread Boris Brezillon
Hi Russel, On Thu, 18 Jun 2015 10:04:00 +0100 Russell King - ARM Linux li...@arm.linux.org.uk wrote: On Wed, Jun 17, 2015 at 05:50:01PM +0800, Herbert Xu wrote: On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon wrote: + ret = dma_map_sg(cesa_dev-dev, req-src, creq-src_nents,

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Herbert Xu
On Wed, Jun 17, 2015 at 01:33:24PM +0200, Boris Brezillon wrote: > > Actually, I think I don't need to save the dma_map_sg return val, since > I'm using the sg_next function to iterate over the scatterlist. Am I > right ? > IOW, is the ->map_sg() function (in dma_map_ops) supposed to merge the >

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Boris Brezillon
On Wed, 17 Jun 2015 17:50:01 +0800 Herbert Xu wrote: > On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon wrote: > > > > + ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, > > +DMA_TO_DEVICE); > > + if (!ret) > > + return -ENOMEM; > > + > > +

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Herbert Xu
On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon wrote: > > + ret = dma_map_sg(cesa_dev->dev, req->src, creq->src_nents, > + DMA_TO_DEVICE); > + if (!ret) > + return -ENOMEM; > + > + creq->src_nents = ret; DMA-API-HOWTO says that you must

[PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Boris Brezillon
The CESA IP supports CPU offload through a dedicated DMA engine (TDMA) which can control the crypto block. When you use this mode, all the required data (operation metadata and payload data) are transferred using DMA, and the results are retrieved through DMA when possible (hash results are not

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Boris Brezillon
On Wed, 17 Jun 2015 17:50:01 +0800 Herbert Xu herb...@gondor.apana.org.au wrote: On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon wrote: + ret = dma_map_sg(cesa_dev-dev, req-src, creq-src_nents, +DMA_TO_DEVICE); + if (!ret) + return -ENOMEM;

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Herbert Xu
On Wed, Jun 17, 2015 at 01:33:24PM +0200, Boris Brezillon wrote: Actually, I think I don't need to save the dma_map_sg return val, since I'm using the sg_next function to iterate over the scatterlist. Am I right ? IOW, is the -map_sg() function (in dma_map_ops) supposed to merge the

[PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Boris Brezillon
The CESA IP supports CPU offload through a dedicated DMA engine (TDMA) which can control the crypto block. When you use this mode, all the required data (operation metadata and payload data) are transferred using DMA, and the results are retrieved through DMA when possible (hash results are not

Re: [PATCH v6 05/14] crypto: marvell/CESA: add TDMA support

2015-06-17 Thread Herbert Xu
On Wed, Jun 17, 2015 at 09:45:33AM +0200, Boris Brezillon wrote: + ret = dma_map_sg(cesa_dev-dev, req-src, creq-src_nents, + DMA_TO_DEVICE); + if (!ret) + return -ENOMEM; + + creq-src_nents = ret; DMA-API-HOWTO says that you must retain the