mbox series

[v2,00/27] staging: ccree: fixes and cleanups

Message ID 1514986544-5888-1-git-send-email-gilad@benyossef.com
Headers show
Series staging: ccree: fixes and cleanups | expand

Message

Gilad Ben-Yossef Jan. 3, 2018, 1:35 p.m. UTC
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 convention (which is why
  the diff looks so big)

Note that there are some fixes in the set that I currently consider
out of scope for stable. I will consider if I can/should roll
separate minimal fix patches for stable after these are taken.

With this set of changes, I've handled anything that I know about
that keeps it from moving out of staging to the best of my understanding
and would like to ask for a review before moving out of staging.

Thanks and happy new year ;-)

Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>


Changes from v1:
- Fixed wrong use of CPP style comments in SPDX include file
  headers as pointed out by Philippe Ombredanne.
- Moved to using SPDX-3.0 style GPL-2.0-only tags
- Rephrased one commit message to better clarify it is a fix
  and not just a cleanup
- Separated two commits which got squashed together unintentionally 
- Rebased on top of latest staging-next

Gilad Ben-Yossef (27):
  staging: ccree: SPDXify driver
  staging: ccree: fold hash defs into queue defs
  staging: ccree: fold reg common defines into driver
  staging: ccree: remove GFP_DMA flag from mem allocs
  staging: ccree: pick alloc mem flags based on req flags
  staging: ccree: copy larval digest from RAM
  staging: ccree: tag debugfs init/exit func properly
  staging: ccree: remove unused leftover field
  staging: ccree: break send_request and fix ret val
  staging: ccree: add backlog processing
  stating: ccree: revert "staging: ccree: fix leak of import() after
    init()"
  staging: ccree: failing the suspend is not an error
  staging: ccree: check DMA pool buf !NULL  before free
  staging: ccree: handle end of sg list gracefully
  staging: ccree: use Makefile to include PM code
  staging: ccree: remove unused field
  staging: ccree: use array for double buffer
  staging: ccree: allocate hash bufs inside req ctx
  staging: ccree: do not map bufs in ahash_init
  staging: ccree: fix indentation of func params
  staging: ccree: fold common code into service func
  staging: ccree: put pointer next to var name
  stating: ccree: fix allocation of void sized buf
  staging: ccree: use a consistent file naming convention
  staging: ccree: remove unneeded includes
  staging: ccree: update TODO
  staging: ccree: add missing include

 drivers/staging/ccree/Kconfig            |    2 +
 drivers/staging/ccree/Makefile           |    7 +-
 drivers/staging/ccree/TODO               |    2 +-
 drivers/staging/ccree/cc_aead.c          | 2702 +++++++++++++++++++++++++++++
 drivers/staging/ccree/cc_aead.h          |  109 ++
 drivers/staging/ccree/cc_buffer_mgr.c    | 1651 ++++++++++++++++++
 drivers/staging/ccree/cc_buffer_mgr.h    |   74 +
 drivers/staging/ccree/cc_cipher.c        | 1167 +++++++++++++
 drivers/staging/ccree/cc_cipher.h        |   74 +
 drivers/staging/ccree/cc_crypto_ctx.h    |   21 +-
 drivers/staging/ccree/cc_debugfs.c       |   24 +-
 drivers/staging/ccree/cc_debugfs.h       |   17 +-
 drivers/staging/ccree/cc_driver.c        |  477 ++++++
 drivers/staging/ccree/cc_driver.h        |  194 +++
 drivers/staging/ccree/cc_fips.c          |  112 ++
 drivers/staging/ccree/cc_fips.h          |   37 +
 drivers/staging/ccree/cc_hash.c          | 2297 +++++++++++++++++++++++++
 drivers/staging/ccree/cc_hash.h          |  114 ++
 drivers/staging/ccree/cc_host_regs.h     |  142 ++
 drivers/staging/ccree/cc_hw_queue_defs.h |   32 +-
 drivers/staging/ccree/cc_ivgen.c         |  280 +++
 drivers/staging/ccree/cc_ivgen.h         |   55 +
 drivers/staging/ccree/cc_kernel_regs.h   |  167 ++
 drivers/staging/ccree/cc_lli_defs.h      |   17 +-
 drivers/staging/ccree/cc_pm.c            |  123 ++
 drivers/staging/ccree/cc_pm.h            |   57 +
 drivers/staging/ccree/cc_request_mgr.c   |  714 ++++++++
 drivers/staging/ccree/cc_request_mgr.h   |   51 +
 drivers/staging/ccree/cc_sram_mgr.c      |  107 ++
 drivers/staging/ccree/cc_sram_mgr.h      |   65 +
 drivers/staging/ccree/dx_crys_kernel.h   |  180 --
 drivers/staging/ccree/dx_host.h          |  155 --
 drivers/staging/ccree/dx_reg_common.h    |   26 -
 drivers/staging/ccree/hash_defs.h        |   36 -
 drivers/staging/ccree/ssi_aead.c         | 2720 ------------------------------
 drivers/staging/ccree/ssi_aead.h         |  122 --
 drivers/staging/ccree/ssi_buffer_mgr.c   | 1675 ------------------
 drivers/staging/ccree/ssi_buffer_mgr.h   |   87 -
 drivers/staging/ccree/ssi_cipher.c       | 1182 -------------
 drivers/staging/ccree/ssi_cipher.h       |   87 -
 drivers/staging/ccree/ssi_driver.c       |  519 ------
 drivers/staging/ccree/ssi_driver.h       |  201 ---
 drivers/staging/ccree/ssi_fips.c         |  125 --
 drivers/staging/ccree/ssi_fips.h         |   50 -
 drivers/staging/ccree/ssi_hash.c         | 2459 ---------------------------
 drivers/staging/ccree/ssi_hash.h         |  107 --
 drivers/staging/ccree/ssi_ivgen.c        |  295 ----
 drivers/staging/ccree/ssi_ivgen.h        |   68 -
 drivers/staging/ccree/ssi_pm.c           |  145 --
 drivers/staging/ccree/ssi_pm.h           |   45 -
 drivers/staging/ccree/ssi_request_mgr.c  |  605 -------
 drivers/staging/ccree/ssi_request_mgr.h  |   59 -
 drivers/staging/ccree/ssi_sram_mgr.c     |  117 --
 drivers/staging/ccree/ssi_sram_mgr.h     |   78 -
 54 files changed, 10807 insertions(+), 11227 deletions(-)
 create mode 100644 drivers/staging/ccree/cc_aead.c
 create mode 100644 drivers/staging/ccree/cc_aead.h
 create mode 100644 drivers/staging/ccree/cc_buffer_mgr.c
 create mode 100644 drivers/staging/ccree/cc_buffer_mgr.h
 create mode 100644 drivers/staging/ccree/cc_cipher.c
 create mode 100644 drivers/staging/ccree/cc_cipher.h
 create mode 100644 drivers/staging/ccree/cc_driver.c
 create mode 100644 drivers/staging/ccree/cc_driver.h
 create mode 100644 drivers/staging/ccree/cc_fips.c
 create mode 100644 drivers/staging/ccree/cc_fips.h
 create mode 100644 drivers/staging/ccree/cc_hash.c
 create mode 100644 drivers/staging/ccree/cc_hash.h
 create mode 100644 drivers/staging/ccree/cc_host_regs.h
 create mode 100644 drivers/staging/ccree/cc_ivgen.c
 create mode 100644 drivers/staging/ccree/cc_ivgen.h
 create mode 100644 drivers/staging/ccree/cc_kernel_regs.h
 create mode 100644 drivers/staging/ccree/cc_pm.c
 create mode 100644 drivers/staging/ccree/cc_pm.h
 create mode 100644 drivers/staging/ccree/cc_request_mgr.c
 create mode 100644 drivers/staging/ccree/cc_request_mgr.h
 create mode 100644 drivers/staging/ccree/cc_sram_mgr.c
 create mode 100644 drivers/staging/ccree/cc_sram_mgr.h
 delete mode 100644 drivers/staging/ccree/dx_crys_kernel.h
 delete mode 100644 drivers/staging/ccree/dx_host.h
 delete mode 100644 drivers/staging/ccree/dx_reg_common.h
 delete mode 100644 drivers/staging/ccree/hash_defs.h
 delete mode 100644 drivers/staging/ccree/ssi_aead.c
 delete mode 100644 drivers/staging/ccree/ssi_aead.h
 delete mode 100644 drivers/staging/ccree/ssi_buffer_mgr.c
 delete mode 100644 drivers/staging/ccree/ssi_buffer_mgr.h
 delete mode 100644 drivers/staging/ccree/ssi_cipher.c
 delete mode 100644 drivers/staging/ccree/ssi_cipher.h
 delete mode 100644 drivers/staging/ccree/ssi_driver.c
 delete mode 100644 drivers/staging/ccree/ssi_driver.h
 delete mode 100644 drivers/staging/ccree/ssi_fips.c
 delete mode 100644 drivers/staging/ccree/ssi_fips.h
 delete mode 100644 drivers/staging/ccree/ssi_hash.c
 delete mode 100644 drivers/staging/ccree/ssi_hash.h
 delete mode 100644 drivers/staging/ccree/ssi_ivgen.c
 delete mode 100644 drivers/staging/ccree/ssi_ivgen.h
 delete mode 100644 drivers/staging/ccree/ssi_pm.c
 delete mode 100644 drivers/staging/ccree/ssi_pm.h
 delete mode 100644 drivers/staging/ccree/ssi_request_mgr.c
 delete mode 100644 drivers/staging/ccree/ssi_request_mgr.h
 delete mode 100644 drivers/staging/ccree/ssi_sram_mgr.c
 delete mode 100644 drivers/staging/ccree/ssi_sram_mgr.h

-- 
2.7.4

Comments

Philippe Ombredanne Jan. 3, 2018, 3:01 p.m. UTC | #1
Gilad,

On Wed, Jan 3, 2018 at 2:35 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote:
> Replace verbatim GPL v2 copy with SPDX tag.

>

> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>


<snip>

> --- a/drivers/staging/ccree/cc_crypto_ctx.h

> +++ b/drivers/staging/ccree/cc_crypto_ctx.h

> @@ -1,18 +1,5 @@

> -/*

> - * Copyright (C) 2012-2017 ARM Limited or its affiliates.

> - *

> - * This program is free software; you can redistribute it and/or modify

> - * it under the terms of the GNU General Public License version 2 as

> - * published by the Free Software Foundation.

> - *

> - * This program is distributed in the hope that it will be useful,

> - * but WITHOUT ANY WARRANTY; without even the implied warranty of

> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

> - * GNU General Public License for more details.

> - *

> - * You should have received a copy of the GNU General Public License

> - * along with this program; if not, see <http://www.gnu.org/licenses/>.

> - */

> +/* SPDX-License-Identifier: GPL-2.0-only */

> +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */


Thank you for using the SPDX tags!

Now, while I appreciate your attempt to use the latest and greatest
SPDX license id definitions (published by SPDX a few days agao), THIS
IS NOT a welcomed initiative. Please stick instead to use ONLY the
SPDX license ids that are defined in Thomas doc patches [1]: e.g. use
instead:  SPDX-License-Identifier: GPL-2.0 and please DO NOT USE
GPL-2.0-only for now.

The rationale is simple: from a kernel standpoint we cannot depend on
the latest changes of an external spec such as SPDX (and I am involved
with SPDX alright but I am wearing a kernel hat here). This is why
things have been carefully documented for the kernel proper by Thomas.
It is perfectly fine at some times in the future to adopt the newest
license ids, but this will have to happen in an orderly fashion with a
proper doc update and the eventual tree-wide changes to update every
occurrence. This cannot happen any other way or this would defeat the
whole purpose to have clear licensing kernel-wide: using the latest
and greatest introduces variations and creates a mess that we want to
avoid in the first place.

CC: Thomas Gleixner <tglx@linutronix.de>

[1] https://lkml.org/lkml/2017/12/28/323

-- 
Cordially
Philippe Ombredanne
Gilad Ben-Yossef Jan. 7, 2018, 10:13 a.m. UTC | #2
On Wed, Jan 3, 2018 at 5:01 PM, Philippe Ombredanne
<pombredanne@nexb.com> wrote:
> Gilad,

>

> On Wed, Jan 3, 2018 at 2:35 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote:

>> Replace verbatim GPL v2 copy with SPDX tag.

>>

>> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>

>

> <snip>

>

>> --- a/drivers/staging/ccree/cc_crypto_ctx.h

>> +++ b/drivers/staging/ccree/cc_crypto_ctx.h

>> @@ -1,18 +1,5 @@

>> -/*

>> - * Copyright (C) 2012-2017 ARM Limited or its affiliates.

>> - *

>> - * This program is free software; you can redistribute it and/or modify

>> - * it under the terms of the GNU General Public License version 2 as

>> - * published by the Free Software Foundation.

>> - *

>> - * This program is distributed in the hope that it will be useful,

>> - * but WITHOUT ANY WARRANTY; without even the implied warranty of

>> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

>> - * GNU General Public License for more details.

>> - *

>> - * You should have received a copy of the GNU General Public License

>> - * along with this program; if not, see <http://www.gnu.org/licenses/>.

>> - */

>> +/* SPDX-License-Identifier: GPL-2.0-only */

>> +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */

>

> Thank you for using the SPDX tags!

>

> Now, while I appreciate your attempt to use the latest and greatest

> SPDX license id definitions (published by SPDX a few days agao), THIS

> IS NOT a welcomed initiative. Please stick instead to use ONLY the

> SPDX license ids that are defined in Thomas doc patches [1]: e.g. use

> instead:  SPDX-License-Identifier: GPL-2.0 and please DO NOT USE

> GPL-2.0-only for now.


Oh dear. It seems I have been over enthusiastic with this.
I shall post a revised  patch set. Sorry for the noise.

>

> The rationale is simple: from a kernel standpoint we cannot depend on

> the latest changes of an external spec such as SPDX (and I am involved

> with SPDX alright but I am wearing a kernel hat here). This is why

> things have been carefully documented for the kernel proper by Thomas.

> It is perfectly fine at some times in the future to adopt the newest

> license ids, but this will have to happen in an orderly fashion with a

> proper doc update and the eventual tree-wide changes to update every

> occurrence. This cannot happen any other way or this would defeat the

> whole purpose to have clear licensing kernel-wide: using the latest

> and greatest introduces variations and creates a mess that we want to

> avoid in the first place.

>

> CC: Thomas Gleixner <tglx@linutronix.de>

>

> [1] https://lkml.org/lkml/2017/12/28/323

>


Just a thought - it might be useful to have an SPDX revision as part of the tag,
e.g.

SPDX-3.0-License-Identifier: GPL-2.0-only

It seems it will make transitions such as this easier, me thinks.

Maybe something to consider for SPDX 3.1 :-)

Thanks,
Gilad



-- 
Gilad Ben-Yossef
Chief Coffee Drinker

"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
 -- Jean-Baptiste Queru
Philippe Ombredanne Jan. 7, 2018, 4:16 p.m. UTC | #3
Gilad,

On Sun, Jan 7, 2018 at 11:13 AM, Gilad Ben-Yossef <gilad@benyossef.com> wrote:
> On Wed, Jan 3, 2018 at 5:01 PM, Philippe Ombredanne

> <pombredanne@nexb.com> wrote:

>> Gilad,

>>

>> On Wed, Jan 3, 2018 at 2:35 PM, Gilad Ben-Yossef <gilad@benyossef.com> wrote:

>>> Replace verbatim GPL v2 copy with SPDX tag.

>>>

>>> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>

>>

>> <snip>

>>

>>> --- a/drivers/staging/ccree/cc_crypto_ctx.h

>>> +++ b/drivers/staging/ccree/cc_crypto_ctx.h

>>> @@ -1,18 +1,5 @@

>>> -/*

>>> - * Copyright (C) 2012-2017 ARM Limited or its affiliates.

>>> - *

>>> - * This program is free software; you can redistribute it and/or modify

>>> - * it under the terms of the GNU General Public License version 2 as

>>> - * published by the Free Software Foundation.

>>> - *

>>> - * This program is distributed in the hope that it will be useful,

>>> - * but WITHOUT ANY WARRANTY; without even the implied warranty of

>>> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

>>> - * GNU General Public License for more details.

>>> - *

>>> - * You should have received a copy of the GNU General Public License

>>> - * along with this program; if not, see <http://www.gnu.org/licenses/>.

>>> - */

>>> +/* SPDX-License-Identifier: GPL-2.0-only */

>>> +/* Copyright (C) 2012-2018 ARM Limited or its affiliates. */

>>

>> Thank you for using the SPDX tags!

>>

>> Now, while I appreciate your attempt to use the latest and greatest

>> SPDX license id definitions (published by SPDX a few days agao), THIS

>> IS NOT a welcomed initiative. Please stick instead to use ONLY the

>> SPDX license ids that are defined in Thomas doc patches [1]: e.g. use

>> instead:  SPDX-License-Identifier: GPL-2.0 and please DO NOT USE

>> GPL-2.0-only for now.

>

> Oh dear. It seems I have been over enthusiastic with this.

> I shall post a revised  patch set. Sorry for the noise.

>

>>

>> The rationale is simple: from a kernel standpoint we cannot depend on

>> the latest changes of an external spec such as SPDX (and I am involved

>> with SPDX alright but I am wearing a kernel hat here). This is why

>> things have been carefully documented for the kernel proper by Thomas.

>> It is perfectly fine at some times in the future to adopt the newest

>> license ids, but this will have to happen in an orderly fashion with a

>> proper doc update and the eventual tree-wide changes to update every

>> occurrence. This cannot happen any other way or this would defeat the

>> whole purpose to have clear licensing kernel-wide: using the latest

>> and greatest introduces variations and creates a mess that we want to

>> avoid in the first place.

>>

>> CC: Thomas Gleixner <tglx@linutronix.de>

>>

>> [1] https://lkml.org/lkml/2017/12/28/323

>>

>

> Just a thought - it might be useful to have an SPDX revision as part of the tag,

> e.g.

>

> SPDX-3.0-License-Identifier: GPL-2.0-only

>

> It seems it will make transitions such as this easier, me thinks.

>

> Maybe something to consider for SPDX 3.1 :-)


That would make things a tad more complicated on the contributor side
IMHO. Instead and since the reference is the kernel doc and nothing
else (and not the latest and greatest SPDX updates of last week),
there is no need to version things at all, we just need to rev up the
doc and tools when and if we update things with newer SPDX versions.

Consider this analogy:
When you use zlib in the kernel you can only use exactly the subset of
the zlib API that is vendored in the kernel. You cannot use a new zlib
function in the latest and greatest release of zlib without updating
the vendored version first.
Here Thomas's doc is exactly this: a subset of the SPDX and license
ids as used exactly in the kernel as of now and "vendored" in the
kernel through this doc. You cannot use anything outside of this short
of updating the doc, tools like checkpatch and _every_ place that
could be impacted by this doc update.

-- 
Cordially
Philippe Ombredanne