Re: [PATCH 01/26] staging: ccree: SPDXify driver

2018-01-01 Thread Gilad Ben-Yossef
On Mon, Jan 1, 2018 at 3:53 PM, Philippe Ombredanne wrote: > Gilad, > > On Mon, Jan 1, 2018 at 1:06 PM, Gilad Ben-Yossef wrote: >> Replace verbatim GPL v2 copy with SPDX tag. >> >> Signed-off-by: Gilad Ben-Yossef > > > >> --- a/drivers/staging/ccree/cc_crypto_ctx.h >> +++ b/drivers/staging/ccre

Re: [PATCH 01/26] staging: ccree: SPDXify driver

2018-01-01 Thread Philippe Ombredanne
Gilad, On Mon, Jan 1, 2018 at 1:06 PM, Gilad Ben-Yossef wrote: > Replace verbatim GPL v2 copy with SPDX tag. > > Signed-off-by: Gilad Ben-Yossef > --- a/drivers/staging/ccree/cc_crypto_ctx.h > +++ b/drivers/staging/ccree/cc_crypto_ctx.h > @@ -1,18 +1,5 @@ > -/* > - * Copyright (C) 2012-2017 A

[PATCH 26/26] staging: ccree: update TODO

2018-01-01 Thread Gilad Ben-Yossef
Update TODO to reflect work done Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/TODO | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/TODO b/drivers/staging/ccree/TODO index 6d8702b..b8e163d 100644 --- a/drivers/staging/ccree/TODO +++ b/drivers

[PATCH 25/26] staging: ccree: remove unneeded includes

2018-01-01 Thread Gilad Ben-Yossef
Remove include files not needed for compilation. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/cc_aead.c| 7 --- drivers/staging/ccree/cc_buffer_mgr.c | 6 -- drivers/staging/ccree/cc_cipher.c | 4 drivers/staging/ccree/cc_driver.c | 31

[PATCH 22/26] staging: ccree: put pointer next to var name

2018-01-01 Thread Gilad Ben-Yossef
Put pointer next to var name as per coding style. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_request_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index b71200a..5e16

[PATCH 23/26] stating: ccree: fix allocation of void sized buf

2018-01-01 Thread Gilad Ben-Yossef
We were allocating buffers using sizeof(*struct->field) where field was type void. Fix it by having a local variable with the real type. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/cc_debugfs.c | 3 ++- drivers/staging/ccree/ssi_ivgen.c| 9

[PATCH 21/26] staging: ccree: fold common code into service func

2018-01-01 Thread Gilad Ben-Yossef
Fold common code in hash call into service functions. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_hash.c | 339 ++- 1 file changed, 116 insertions(+), 223 deletions(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi

[PATCH 18/26] staging: ccree: allocate hash bufs inside req ctx

2018-01-01 Thread Gilad Ben-Yossef
Move to allocating the buffers needed for requests as part of the request structure instead of malloc'ing each one on it's own, making for simpler (and more efficient) code. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_hash.c | 68 driver

[PATCH 19/26] staging: ccree: do not map bufs in ahash_init

2018-01-01 Thread Gilad Ben-Yossef
hash_init was mapping DMA memory that were then being unmap in hash_digest/final/finup callbacks, which is against the Crypto API usage rules (see discussion at https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg30077.html) Fix it by moving all buffer mapping/unmapping or each Crypto API

[PATCH 20/26] staging: ccree: fix indentation of func params

2018-01-01 Thread Gilad Ben-Yossef
Fix indentation of some function params in hash code for better readability. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_hash.c | 46 +--- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/driv

[PATCH 17/26] staging: ccree: use array for double buffer

2018-01-01 Thread Gilad Ben-Yossef
The ccree hash code is using a double buffer to hold data for processing but manages the buffers and their associated data count in two separate fields and uses a predicate to chose which to use. Move to using a proper 2 members array for a much cleaner code. Signed-off-by: Gilad Ben-Yossef ---

[PATCH 16/26] staging: ccree: remove unused field

2018-01-01 Thread Gilad Ben-Yossef
Remove unused struct field. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_hash.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 9d71b33..c64b4b5 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drive

[PATCH 13/26] staging: ccree: check DMA pool buf !NULL before free

2018-01-01 Thread Gilad Ben-Yossef
If we ran out of DMA pool buffers, we get into the unmap code path with a NULL before. Deal with this by checking the virtual mapping is not NULL. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_buffer_mgr.c | 3 ++- 1 file changed, 2 insertions(+), 1 del

[PATCH 15/26] staging: ccree: use Makefile to include PM code

2018-01-01 Thread Gilad Ben-Yossef
Replace ugly ifdefs with some inline macros and Makefile magic for optionally including power management related code for better readability. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/Makefile | 3 ++- drivers/staging/ccree/ssi_pm.c | 9 +--- drivers/stagi

[PATCH 14/26] staging: ccree: handle end of sg list gracefully

2018-01-01 Thread Gilad Ben-Yossef
If we are asked for number of entries of an offset bigger than the sg list we should not crash. Cc: sta...@vger.kernel.org Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_buffer_mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_buff

[PATCH 12/26] staging: ccree: failing the suspend is not an error

2018-01-01 Thread Gilad Ben-Yossef
PM suspend returning a none zero value is not an error. It simply indicates a suspend is not advised right now so don't treat it as an error. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_request_mgr.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/dri

[PATCH 11/26] stating: ccree: revert "staging: ccree: fix leak of import() after init()"

2018-01-01 Thread Gilad Ben-Yossef
This reverts commit c5f39d07860c ("staging: ccree: fix leak of import() after init()") and commit aece09024414 ("staging: ccree: Uninitialized return in ssi_ahash_import()"). This is the wrong solution and ends up relying on uninitialized memory, although it was not obvious to me at the time. Cc:

[PATCH 10/26] staging: ccree: add backlog processing

2018-01-01 Thread Gilad Ben-Yossef
Crypto API tfm providers are required to provide a backlog service, if so indicated, that queues up requests in the case of the provider being busy and processing them later. The ccree driver did not provide this facility. Add it now. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ss

[PATCH 07/26] staging: ccree: tag debugfs init/exit func properly

2018-01-01 Thread Gilad Ben-Yossef
The debugfs global init and exit functions were missing __init and __exit tags, potentially wasting memory. Fix it by properly tagging them. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/cc_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/stag

[PATCH 08/26] staging: ccree: remove unused leftover field

2018-01-01 Thread Gilad Ben-Yossef
Remove the unused monitor_desc field. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_request_mgr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index bf66286..5812ffd 100644 --- a/drivers/stag

[PATCH 06/26] staging: ccree: copy larval digest from RAM

2018-01-01 Thread Gilad Ben-Yossef
The ccree driver was using a DMA operation to copy larval digest from the ccree SRAM to RAM. Replace it with a simple memcpy. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_driver.c | 2 + drivers/staging/ccree/ssi_hash.c | 121 - drivers/st

[PATCH 09/26] staging: ccree: breakup send_request

2018-01-01 Thread Gilad Ben-Yossef
The send_request() function was doing too much. Break it up for better readability and as basis for next patch in series Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_aead.c| 6 +- drivers/staging/ccree/ssi_cipher.c | 3 +- drivers/staging/ccree/ssi_hash.c

[PATCH 01/26] staging: ccree: SPDXify driver

2018-01-01 Thread Gilad Ben-Yossef
Replace verbatim GPL v2 copy with SPDX tag. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/cc_crypto_ctx.h| 17 ++--- drivers/staging/ccree/cc_debugfs.c | 17 ++--- drivers/staging/ccree/cc_debugfs.h | 17 ++--- drivers/staging/ccree

[PATCH 05/26] staging: ccree: pick alloc mem flags based on req flags

2018-01-01 Thread Gilad Ben-Yossef
The ccree driver was allocating memory using GFP_KERNEL flag always, ignoring the flags set in the crypto request. Fix it by choosing gfp flags based on crypto request flags. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_buffer_mgr.c | 19 +++-- drivers/staging/ccree/ssi_

[PATCH 03/26] staging: ccree: fold reg common defines into driver

2018-01-01 Thread Gilad Ben-Yossef
Fold the 2 macro defined in dx_reg_common.h into the file they are used in and delete the file. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/cc_crypto_ctx.h | 4 ++-- drivers/staging/ccree/dx_reg_common.h | 13 - drivers/staging/ccree/ssi_driver.h| 5 +++-- 3 files

[PATCH 02/26] staging: ccree: fold hash defs into queue defs

2018-01-01 Thread Gilad Ben-Yossef
Fold the two remaining enum in hash defs into the queue defs that are using them and delete the hash defs include file. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/cc_hw_queue_defs.h | 13 + drivers/staging/ccree/hash_defs.h| 23 --- drivers/

[PATCH 04/26] staging: ccree: remove GFP_DMA flag from mem allocs

2018-01-01 Thread Gilad Ben-Yossef
Remove bogus GFP_DMA flag from memory allocations. ccree driver does not operate over an ISA or similar limited bus. Signed-off-by: Gilad Ben-Yossef --- drivers/staging/ccree/ssi_cipher.c | 2 +- drivers/staging/ccree/ssi_hash.c | 15 ++- 2 files changed, 7 insertions(+), 10 delet

[PATCH 00/26] staging: ccree: fixes and cleanups

2018-01-01 Thread Gilad Ben-Yossef
The usual combo of code cleanups and fixes. The highlights are: - Use SPDX for all driver copyright/license - Make ccree compliant with crypto API handling of backlog requests * - Make ccree compliant with Crypto API rules of resource alloc/release * - Settle on a single coherent file naming conve