From: Tero Kristo <hidden> Date: 2016-08-04 10:28:35
Hi,
This revision took quite a bit time to craft due to the rework needed
for sham buffer handling and export/import. I ended up implementing
a flush functionality for draining out the sham buffer when doing
export/import; just shrinking the buffer to sufficiently small size
impacted the performance with small data chunks too much so I dropped
this approach.
The series also fixes a couple of existing issues with omap2/omap3
hardware acceleration, I ran a full boot test / crypto manager
test suite on all boards accessible to me now.
Based on top of latest mainline, which is somewhere before 4.8-rc1
as of writing this, I am unable to rebase the series during the next
three weeks so wanted to get this out now. Targeted for 4.9 merge
window, some fixes could be picked up earlier though if needed.
-Tero
From: Tero Kristo <hidden> Date: 2016-08-04 10:28:36
Some of the call paths of OMAP SHA driver can avoid executing the next
step of the crypto queue under tasklet; instead, execute the next step
directly via function call. This avoids a costly round-trip via the
scheduler giving a slight performance boost.
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-sham.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
@@ -1005,9 +1005,6 @@ static void omap_sham_finish_req(struct ahash_request *req, int err)if(req->base.complete)req->base.complete(&req->base,err);--/* handle new request */-tasklet_schedule(&dd->done_task);}staticintomap_sham_handle_queue(structomap_sham_dev*dd,
@@ -1018,6 +1015,7 @@ static int omap_sham_handle_queue(struct omap_sham_dev *dd,unsignedlongflags;interr=0,ret=0;+retry:spin_lock_irqsave(&dd->lock,flags);if(req)ret=ahash_enqueue_request(&dd->queue,req);
@@ -1061,11 +1059,19 @@ static int omap_sham_handle_queue(struct omap_sham_dev *dd,err=omap_sham_final_req(dd);}err1:-if(err!=-EINPROGRESS)+dev_dbg(dd->dev,"exit, err: %d\n",err);++if(err!=-EINPROGRESS){/* done_task will not finish it, so do it here */omap_sham_finish_req(req,err);+req=NULL;-dev_dbg(dd->dev,"exit, err: %d\n",err);+/*+*Executenextrequestimmediatelyifthereisanything+*inqueue.+*/+gotoretry;+}returnret;}
@@ -1653,6 +1659,10 @@ finish:dev_dbg(dd->dev,"update done: err: %d\n",err);/* finish curent request */omap_sham_finish_req(dd->req,err);++/* If we are not busy, process next req */+if(!test_bit(FLAGS_BUSY,&dd->flags))+omap_sham_handle_queue(dd,NULL);}staticirqreturn_tomap_sham_irq_common(structomap_sham_dev*dd)
From: Tero Kristo <hidden> Date: 2016-08-04 10:28:37
This flushes any full blocks of data from the data buffer. Required for
implementing the export/import APIs for the driver, as the flush allows
saving a much smaller context; basically only one block of buffer is
required.
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-sham.c | 60 ++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 55 insertions(+), 5 deletions(-)
@@ -996,15 +997,16 @@ static void omap_sham_finish_req(struct ahash_request *req, int err)ctx->flags|=BIT(FLAGS_ERROR);}-/* atomic operation is not needed here */-dd->flags&=~(BIT(FLAGS_BUSY)|BIT(FLAGS_FINAL)|BIT(FLAGS_CPU)|-BIT(FLAGS_DMA_READY)|BIT(FLAGS_OUTPUT_READY));-pm_runtime_mark_last_busy(dd->dev);pm_runtime_put_autosuspend(dd->dev);-if(req->base.complete)+if(!test_bit(FLAGS_FLUSH,&dd->flags)&&req->base.complete)req->base.complete(&req->base,err);++/* atomic operation is not needed here */+dd->flags&=~(BIT(FLAGS_BUSY)|BIT(FLAGS_FINAL)|BIT(FLAGS_CPU)|+BIT(FLAGS_DMA_READY)|BIT(FLAGS_OUTPUT_READY)|+BIT(FLAGS_FLUSH));}staticintomap_sham_handle_queue(structomap_sham_dev*dd,
From: Tero Kristo <hidden> Date: 2016-08-04 10:28:38
Context export/import are now required for ahash algorithms due to
required support in algif_hash. Implement these for OMAP SHA driver,
saving and restoring the internal state of the driver.
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-sham.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
From: Tero Kristo <hidden> Date: 2016-08-04 10:30:21
From: Lokesh Vutla <redacted>
As setting up the DMA operations is quite costly, add software fallback
support for requests smaller than 200 bytes. This change gives some 10%
extra performance in ipsec use case.
Signed-off-by: Lokesh Vutla <redacted>
[t-kristo at ti.com: udpated against latest upstream, to use skcipher mainly]
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/Kconfig | 3 +++
drivers/crypto/omap-aes.c | 53 +++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 52 insertions(+), 4 deletions(-)
From: Tero Kristo <hidden> Date: 2016-08-04 10:30:21
Calling runtime PM API at the cra_init/exit is bad for power management
purposes, as the lifetime for a CRA can be very long. Instead, use
pm_runtime autosuspend approach for handling the device clocks. Clocks
are enabled when they are actually required, and autosuspend disables
these if they have not been used for a sufficiently long time period.
By default, the timeout value is 1 second.
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-aes.c | 43 ++++++++++++++++---------------------------
1 file changed, 16 insertions(+), 27 deletions(-)
@@ -761,23 +774,6 @@ static int omap_aes_ctr_decrypt(struct ablkcipher_request *req)staticintomap_aes_cra_init(structcrypto_tfm*tfm){-structomap_aes_dev*dd=NULL;-interr;--/* Find AES device, currently picks the first device */-spin_lock_bh(&list_lock);-list_for_each_entry(dd,&dev_list,list){-break;-}-spin_unlock_bh(&list_lock);--err=pm_runtime_get_sync(dd->dev);-if(err<0){-dev_err(dd->dev,"%s: failed to get_sync(%d)\n",-__func__,err);-returnerr;-}-tfm->crt_ablkcipher.reqsize=sizeof(structomap_aes_reqctx);return0;
@@ -785,16 +781,6 @@ static int omap_aes_cra_init(struct crypto_tfm *tfm)staticvoidomap_aes_cra_exit(structcrypto_tfm*tfm){-structomap_aes_dev*dd=NULL;--/* Find AES device, currently picks the first device */-spin_lock_bh(&list_lock);-list_for_each_entry(dd,&dev_list,list){-break;-}-spin_unlock_bh(&list_lock);--pm_runtime_put_sync(dd->dev);}/* ********************** ALGS ************************************ */
@@ -1140,6 +1126,9 @@ static int omap_aes_probe(struct platform_device *pdev)}dd->phys_base=res.start;+pm_runtime_use_autosuspend(dev);+pm_runtime_set_autosuspend_delay(dev,DEFAULT_AUTOSUSPEND_DELAY);+pm_runtime_enable(dev);err=pm_runtime_get_sync(dev);if(err<0){
From: Tero Kristo <hidden> Date: 2016-08-04 10:30:21
The crypto engine must be initialized before registering algorithms,
otherwise the test manager will crash as it attempts to execute
tests for the algos while they are being registered.
Fixes: 0529900a01cb ("crypto: omap-aes - Support crypto engine framework")
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-aes.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
From: Tero Kristo <hidden> Date: 2016-08-04 10:30:21
The crypto engine must be initialized before registering algorithms,
otherwise the test manager will crash as it attempts to execute
tests for the algos while they are being registered.
Fixes: f1b77aaca85a ("crypto: omap-des - Integrate with the crypto engine framework")
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-des.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
From: Tero Kristo <hidden> Date: 2016-08-04 10:30:21
If software fallback is used on older hardware accelerator setup (OMAP2/
OMAP3), the first block of data must be purged from the buffer. The
first block contains the pre-generated ipad value required by the HW,
but the software fallback algorithm generates its own, causing wrong
results.
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-sham.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
From: Tero Kristo <hidden> Date: 2016-08-04 10:30:21
From: Lokesh Vutla <redacted>
For cases where total length of an input SGs is not same as
length of the input data for encryption, omap-des driver
crashes. This happens in the case when IPsec is trying to use
omap-des driver.
To avoid this, we copy all the pages from the input SG list
into a contiguous buffer and prepare a single element SG list
for this buffer with length as the total bytes to crypt, which is
similar thing that is done in case of unaligned lengths.
Signed-off-by: Lokesh Vutla <redacted>
Tested-by: Aparna Balasubramanian <redacted>
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-des.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
@@ -521,29 +521,36 @@ static int omap_des_crypt_dma_stop(struct omap_des_dev *dd)return0;}-staticintomap_des_copy_needed(structscatterlist*sg)+staticintomap_des_copy_needed(structscatterlist*sg,inttotal){+intlen=0;++if(!IS_ALIGNED(total,DES_BLOCK_SIZE))+return-1;+while(sg){if(!IS_ALIGNED(sg->offset,4))return-1;if(!IS_ALIGNED(sg->length,DES_BLOCK_SIZE))return-1;++len+=sg->length;sg=sg_next(sg);}++if(len!=total)+return-1;+return0;}staticintomap_des_copy_sgs(structomap_des_dev*dd){void*buf_in,*buf_out;-intpages;--pages=dd->total>>PAGE_SHIFT;--if(dd->total&(PAGE_SIZE-1))-pages++;+intpages,total;-BUG_ON(!pages);+total=ALIGN(dd->total,DES_BLOCK_SIZE);+pages=get_order(total);buf_in=(void*)__get_free_pages(GFP_ATOMIC,pages);buf_out=(void*)__get_free_pages(GFP_ATOMIC,pages);
@@ -605,8 +612,8 @@ static int omap_des_prepare_req(struct crypto_engine *engine,if(dd->out_sg_len<0)returndd->out_sg_len;-if(omap_des_copy_needed(dd->in_sg)||-omap_des_copy_needed(dd->out_sg)){+if(omap_des_copy_needed(dd->in_sg,dd->total)||+omap_des_copy_needed(dd->out_sg,dd->total)){if(omap_des_copy_sgs(dd))pr_err("Failed to copy SGs for unaligned cases\n");dd->sgs_copied=1;
From: Tero Kristo <hidden> Date: 2016-08-04 10:30:21
If we have processed any data with the hardware accelerator (digcnt > 0),
we must complete the entire hash by using it. This is because the current
hash value can't be imported to the software fallback algorithm. Otherwise
we end up with wrong hash results.
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-sham.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Tero Kristo <hidden> Date: 2016-08-04 10:30:21
From: Lokesh Vutla <redacted>
Some SoCs like omap4/omap5/dra7 contain multiple AES crypto accelerator
cores. Adapt the driver to support this. The driver picks the last used
device from a list of AES devices.
Signed-off-by: Lokesh Vutla <redacted>
[t-kristo at ti.com: forward ported to 4.7 kernel]
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-aes.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
@@ -329,20 +329,12 @@ static void omap_aes_dma_stop(struct omap_aes_dev *dd)staticstructomap_aes_dev*omap_aes_find_dev(structomap_aes_ctx*ctx){-structomap_aes_dev*dd=NULL,*tmp;+structomap_aes_dev*dd;spin_lock_bh(&list_lock);-if(!ctx->dd){-list_for_each_entry(tmp,&dev_list,list){-/* FIXME: take fist available aes core */-dd=tmp;-break;-}-ctx->dd=dd;-}else{-/* already found before */-dd=ctx->dd;-}+dd=list_first_entry(&dev_list,structomap_aes_dev,list);+list_move_tail(&dd->list,&dev_list);+ctx->dd=dd;spin_unlock_bh(&list_lock);returndd;
@@ -615,7 +607,7 @@ static int omap_aes_prepare_req(struct crypto_engine *engine,{structomap_aes_ctx*ctx=crypto_ablkcipher_ctx(crypto_ablkcipher_reqtfm(req));-structomap_aes_dev*dd=omap_aes_find_dev(ctx);+structomap_aes_dev*dd=ctx->dd;structomap_aes_reqctx*rctx;if(!dd)
@@ -661,7 +653,7 @@ static int omap_aes_crypt_req(struct crypto_engine *engine,{structomap_aes_ctx*ctx=crypto_ablkcipher_ctx(crypto_ablkcipher_reqtfm(req));-structomap_aes_dev*dd=omap_aes_find_dev(ctx);+structomap_aes_dev*dd=ctx->dd;if(!dd)return-ENODEV;
From: Herbert Xu <herbert@gondor.apana.org.au> Date: 2016-08-09 10:06:52
On Thu, Aug 04, 2016 at 01:28:38PM +0300, Tero Kristo wrote:
quoted hunk
Context export/import are now required for ahash algorithms due to
required support in algif_hash. Implement these for OMAP SHA driver,
saving and restoring the internal state of the driver.
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-sham.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
From: Tero Kristo <hidden> Date: 2016-08-29 14:12:14
On 09/08/16 13:06, Herbert Xu wrote:
On Thu, Aug 04, 2016 at 01:28:38PM +0300, Tero Kristo wrote:
quoted
Context export/import are now required for ahash algorithms due to
required support in algif_hash. Implement these for OMAP SHA driver,
saving and restoring the internal state of the driver.
Signed-off-by: Tero Kristo <redacted>
---
drivers/crypto/omap-sham.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
Do we really need this? You must not call export until the previous
operation has completed.
Cheers,
Sorry about a late reply, I was out on vacation.
For OMAP SHAM, this is actually needed, because the driver still has a
very large internal buffer for performance reasons, and the whole buffer
can't be exported. The flush functionality pushes out sufficient amount
of data to the hardware, so that the rest of the buffer can be exported
to the available space.
This is pretty much related to the discussion we had previously here:
https://patchwork.kernel.org/patch/9192881/
Basically I decided to keep the driver buffer the same size as
previously, but flush out any extra data.
-Tero
Do we really need this? You must not call export until the previous
operation has completed.
Cheers,
Sorry about a late reply, I was out on vacation.
For OMAP SHAM, this is actually needed, because the driver still has
a very large internal buffer for performance reasons, and the whole
buffer can't be exported. The flush functionality pushes out
sufficient amount of data to the hardware, so that the rest of the
buffer can be exported to the available space.
It doesn't matter whether you have a buffer or not. The point
is that the completion function should not be called until the
operation is actually complete. This is the whole point of the
async interface.
As the user must not call export until the completion function
has been called, there should be no need to wait in the export
function.
Cheers,
--
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Do we really need this? You must not call export until the previous
operation has completed.
Cheers,
Sorry about a late reply, I was out on vacation.
For OMAP SHAM, this is actually needed, because the driver still has
a very large internal buffer for performance reasons, and the whole
buffer can't be exported. The flush functionality pushes out
sufficient amount of data to the hardware, so that the rest of the
buffer can be exported to the available space.
It doesn't matter whether you have a buffer or not. The point
is that the completion function should not be called until the
operation is actually complete. This is the whole point of the
async interface.
As the user must not call export until the completion function
has been called, there should be no need to wait in the export
function.
Well, but the driver doesn't flush its buffers automatically, it caches
data until it has sufficient amount available. So, assuming you want to
do this:
sham_init
sham_update 256 bytes
sham_update 256 bytes
wait until two above updates are complete
sham_export
... the execution hangs at the wait phase as the driver is still waiting
for more data to cache, and will never complete the two update requests.
Currently, the driver is written in such way that it waits until it has
enough data cached before starting to push it out to hardware, or waits
until sham_final to be called. Pushing out small pieces of data causes
severe performance degradation on the driver, as setting up the DMA
operation itself is rather costly.
Either way, flush for the buffers is needed, I wonder if automatic flush
should be added also based on some timer.
-Tero
From: Herbert Xu <herbert@gondor.apana.org.au> Date: 2016-09-01 06:17:11
On Thu, Sep 01, 2016 at 09:12:59AM +0300, Tero Kristo wrote:
Well, but the driver doesn't flush its buffers automatically, it
caches data until it has sufficient amount available. So, assuming
you want to do this:
sham_init
sham_update 256 bytes
sham_update 256 bytes
wait until two above updates are complete
sham_export
... the execution hangs at the wait phase as the driver is still
Well that's a bug in the driver. While it's not illegal to wait
for more data, it's usually unnecessary. Because we instead try
to get our users to generate as big a request as possible, e.g.,
one packet for IPsec.
If you really have to do the hold thing, then you must install a
timer like sha1-mb does on x86 to do the flush.
In any case, the completion function must not be called until
you're actually complete.
Cheers,
--
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
From: Tero Kristo <hidden> Date: 2016-09-01 06:56:46
On 01/09/16 09:16, Herbert Xu wrote:
On Thu, Sep 01, 2016 at 09:12:59AM +0300, Tero Kristo wrote:
quoted
Well, but the driver doesn't flush its buffers automatically, it
caches data until it has sufficient amount available. So, assuming
you want to do this:
sham_init
sham_update 256 bytes
sham_update 256 bytes
wait until two above updates are complete
sham_export
... the execution hangs at the wait phase as the driver is still
Well that's a bug in the driver. While it's not illegal to wait
for more data, it's usually unnecessary. Because we instead try
to get our users to generate as big a request as possible, e.g.,
one packet for IPsec.
If you really have to do the hold thing, then you must install a
timer like sha1-mb does on x86 to do the flush.
In any case, the completion function must not be called until
you're actually complete.
Hmm, looking at the driver, sham_update returns 0 immediately if it just
caches data. In a sense, the update is not completed at this point. Are
you saying this is illegal and can't be done?
From my understanding, valid results are expected from the driver only
after ->final is called.
-Tero
From: Herbert Xu <herbert@gondor.apana.org.au> Date: 2016-09-01 07:20:16
On Thu, Sep 01, 2016 at 09:56:06AM +0300, Tero Kristo wrote:
Hmm, looking at the driver, sham_update returns 0 immediately if it
just caches data. In a sense, the update is not completed at this
point. Are you saying this is illegal and can't be done?
Once you call the completion function (and returning zero from
the update itself is equivalent to calling the completion function)
the hardware must not touch the request anymore.
From my understanding, valid results are expected from the driver
only after ->final is called.
From: Tero Kristo <hidden> Date: 2016-09-01 07:29:27
On 01/09/16 10:19, Herbert Xu wrote:
On Thu, Sep 01, 2016 at 09:56:06AM +0300, Tero Kristo wrote:
quoted
Hmm, looking at the driver, sham_update returns 0 immediately if it
just caches data. In a sense, the update is not completed at this
point. Are you saying this is illegal and can't be done?
Once you call the completion function (and returning zero from
the update itself is equivalent to calling the completion function)
the hardware must not touch the request anymore.
Yeah, it is not touching it anymore. All the data has been copied to the
local buffer at this point, and the driver isn't retaining any kind of a
handle to the request itself anymore. It is just that it has not been
processed by the hardware yet.
quoted
From my understanding, valid results are expected from the driver
only after ->final is called.
That's because you never implemented export/import :)
Yeah, the flush should do the trick now. Kind of a chicken-egg problem
here. :P How do you see the situation with the above explanation?
-Tero
From: Tero Kristo <hidden> Date: 2016-09-01 07:47:16
On 01/09/16 10:31, Herbert Xu wrote:
On Thu, Sep 01, 2016 at 10:28:47AM +0300, Tero Kristo wrote:
quoted
Yeah, the flush should do the trick now. Kind of a chicken-egg
problem here. :P How do you see the situation with the above
explanation?
The export function is not allowed to sleep so you must not wait
for the hardware to complete in it.
If you need to wait, then you must use the completion mechanism.
I don't think export is allowed to return -EINPROGRESS either? At least
currently the kernel pieces using this functionality won't work if I do
that.
If thats the case, I need to think of something else to handle this...
-Tero
From: Tero Kristo <hidden> Date: 2016-09-05 12:06:42
On 01/09/16 10:46, Tero Kristo wrote:
On 01/09/16 10:31, Herbert Xu wrote:
quoted
On Thu, Sep 01, 2016 at 10:28:47AM +0300, Tero Kristo wrote:
quoted
Yeah, the flush should do the trick now. Kind of a chicken-egg
problem here. :P How do you see the situation with the above
explanation?
The export function is not allowed to sleep so you must not wait
for the hardware to complete in it.
If you need to wait, then you must use the completion mechanism.
I don't think export is allowed to return -EINPROGRESS either? At least
currently the kernel pieces using this functionality won't work if I do
that.
If thats the case, I need to think of something else to handle this...
-Tero
Hi Herbert,
Additional request, would it be possible for you to check the rest of
the series and just ignore patches #2 and #3 for now, the rest don't
have any dependencies against these and can be applied cleanly without.
I would like to see these move forward while I figure out how to handle
the buffer / export+import...
-Tero
From: Herbert Xu <herbert@gondor.apana.org.au> Date: 2016-09-07 13:29:51
On Mon, Sep 05, 2016 at 03:06:05PM +0300, Tero Kristo wrote:
Additional request, would it be possible for you to check the rest
of the series and just ignore patches #2 and #3 for now, the rest
don't have any dependencies against these and can be applied cleanly
without.
I would like to see these move forward while I figure out how to
handle the buffer / export+import...
From: Herbert Xu <herbert@gondor.apana.org.au> Date: 2016-09-13 09:37:06
On Thu, Aug 04, 2016 at 01:28:41PM +0300, Tero Kristo wrote:
From: Lokesh Vutla <redacted>
For cases where total length of an input SGs is not same as
length of the input data for encryption, omap-des driver
crashes. This happens in the case when IPsec is trying to use
omap-des driver.
To avoid this, we copy all the pages from the input SG list
into a contiguous buffer and prepare a single element SG list
for this buffer with length as the total bytes to crypt, which is
similar thing that is done in case of unaligned lengths.
Ugh, that means copying every single packet, right?
So if it's just the SG list that's the problem, why don't you
copy that instead? That is, allocate a new SG list and set it
up so that there is no excess data.
Cheers,
--
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
From: Herbert Xu <herbert@gondor.apana.org.au> Date: 2016-09-13 12:39:13
On Thu, Aug 04, 2016 at 01:28:35PM +0300, Tero Kristo wrote:
Hi,
This revision took quite a bit time to craft due to the rework needed
for sham buffer handling and export/import. I ended up implementing
a flush functionality for draining out the sham buffer when doing
export/import; just shrinking the buffer to sufficiently small size
impacted the performance with small data chunks too much so I dropped
this approach.
The series also fixes a couple of existing issues with omap2/omap3
hardware acceleration, I ran a full boot test / crypto manager
test suite on all boards accessible to me now.
Based on top of latest mainline, which is somewhere before 4.8-rc1
as of writing this, I am unable to rebase the series during the next
three weeks so wanted to get this out now. Targeted for 4.9 merge
window, some fixes could be picked up earlier though if needed.
From: Tero Kristo <hidden> Date: 2016-09-15 09:12:53
On 13/09/16 15:38, Herbert Xu wrote:
On Thu, Aug 04, 2016 at 01:28:35PM +0300, Tero Kristo wrote:
quoted
Hi,
This revision took quite a bit time to craft due to the rework needed
for sham buffer handling and export/import. I ended up implementing
a flush functionality for draining out the sham buffer when doing
export/import; just shrinking the buffer to sufficiently small size
impacted the performance with small data chunks too much so I dropped
this approach.
The series also fixes a couple of existing issues with omap2/omap3
hardware acceleration, I ran a full boot test / crypto manager
test suite on all boards accessible to me now.
Based on top of latest mainline, which is somewhere before 4.8-rc1
as of writing this, I am unable to rebase the series during the next
three weeks so wanted to get this out now. Targeted for 4.9 merge
window, some fixes could be picked up earlier though if needed.
I have applied patches 1,4-5,7-11. Some of them didn't apply
cleanly so please check the result in my tree.
Thanks,
Thanks Herbert,
I just gave a trial for your branch, and seems to be working for me.
Also checked the patches you applied and they seem fine also.
I have also a new version of the sha buffer handling and export/import
available now, but need to cleanup it quite a bit, and figure out how to
split the patch properly.
drivers/crypto/omap-sham.c | 532
++++++++++++++++++++++++++-------------------
... It now uses sg for xmitting data where possible, and avoids the need
for a large internal buffer. The buffer size is also now properly
configurable, which can be used to overcome the performance issues if
needed (this however, requires the max statesize hack within the
crypto/ahash.c file, but thats fine.) I'll hopefully post this out maybe
tomorrow, but its going to be targeted for 4.10 I believe due to the
(ahem, rather) intrusive changes.
-Tero
From: Tero Kristo <hidden> Date: 2016-09-15 09:16:05
On 13/09/16 12:35, Herbert Xu wrote:
On Thu, Aug 04, 2016 at 01:28:41PM +0300, Tero Kristo wrote:
quoted
From: Lokesh Vutla <redacted>
For cases where total length of an input SGs is not same as
length of the input data for encryption, omap-des driver
crashes. This happens in the case when IPsec is trying to use
omap-des driver.
To avoid this, we copy all the pages from the input SG list
into a contiguous buffer and prepare a single element SG list
for this buffer with length as the total bytes to crypt, which is
similar thing that is done in case of unaligned lengths.
Ugh, that means copying every single packet, right?
So if it's just the SG list that's the problem, why don't you
copy that instead? That is, allocate a new SG list and set it
up so that there is no excess data.
Cheers,
I'll take a look at this. I have this kind of solution in place for the
re-worked SHA driver, so can probably re-use it here.
-Tero