mbox series

[v8,0/4] crypto: starfive - Add drivers for crypto engine

Message ID 20230515125355.624250-1-jiajie.ho@starfivetech.com (mailing list archive)
Headers show
Series crypto: starfive - Add drivers for crypto engine | expand

Message

Jia Jie Ho May 15, 2023, 12:53 p.m. UTC
This patch series adds kernel driver support for StarFive JH7110 crypto
engine. The first patch adds Documentations for the device and Patch 2
adds device probe and DMA init for the module. Patch 3 adds crypto and
DMA dts node for VisionFive 2 board. Patch 4 adds hash/hmac support to
the module.

Patch 3 needs to be applied on top of:
https://lore.kernel.org/lkml/20230424135409.6648-3-xingyu.wu@starfivetech.com/

Patch 4 needs to be applied on top of:
https://lore.kernel.org/linux-crypto/ZEEOXIHwqKblKfBJ@gondor.apana.org.au/T/#u

Changes v7->v8
- Enable COMPILE_TEST in Kconfig (Herbert)
- Fix compile_test warning on 'long unsigned int' to 'unsigned int'
  conversion (Herbert)

Changes v6->v7
- Remove NULL assignment as struct is kzalloc()-ed (Christophe)
- Do clk_disable_unprepare and assert reset if probe failed (Christophe)
- Remove unnecessary null pointer check (Christophe)
- Update module name in Kconfig description (Christophe)

Changes v5->v6
- Remove set_crypt in export as request will have been created by
  init/updated calls (Herbert)
- Use new helper to set statesize of crypto_ahash (Herbert)
- Use crypto_ahash_blocksize instead of crypto_ahash_tfm (Herbert)
- Switch to init_tfm/exit_tfm instead of cra_init/cra_exit (Herbert)

Changes v4->v5
- Schedule tasklet from IRQ handler instead of using completion to sync
  events (Herbert)

Changes v3->v4:
- Use fallback for non-aligned cases as hardware doesn't support
  hashing piece-meal (Herbert)
- Use ahash_request_set_* helpers to update members of ahash_request
  (Herbert)
- Set callbacks for async fallback (Herbert)
- Remove completion variable and use dma_callback to do the rest of
  processing instead. (Herbert)

Changes v2->v3:
- Only implement digest and use fallback for other ops (Herbert)
- Use interrupt instead of polling for hash complete (Herbert)
- Remove manual data copy from out-of-bound memory location as it will
  be handled by DMA API. (Christoph & Herbert)

Changes v1->v2:
- Fixed yaml filename and format (Krzysztof)
- Removed unnecessary property names in yaml (Krzysztof)
- Moved of_device_id table close to usage (Krzysztof)
- Use dev_err_probe for error returns (Krzysztof)
- Dropped redundant readl and writel wrappers (Krzysztof)
- Updated commit signed offs (Conor)
- Dropped redundant node in dts, module set to on in dtsi (Conor)

Jia Jie Ho (4):
  dt-bindings: crypto: Add StarFive crypto module
  crypto: starfive - Add crypto engine support
  riscv: dts: starfive: Add crypto and DMA node for VisionFive 2
  crypto: starfive - Add hash and HMAC support

 .../crypto/starfive,jh7110-crypto.yaml        |  70 ++
 MAINTAINERS                                   |   7 +
 arch/riscv/boot/dts/starfive/jh7110.dtsi      |  28 +
 drivers/crypto/Kconfig                        |   1 +
 drivers/crypto/Makefile                       |   1 +
 drivers/crypto/starfive/Kconfig               |  21 +
 drivers/crypto/starfive/Makefile              |   4 +
 drivers/crypto/starfive/jh7110-cryp.c         | 240 +++++
 drivers/crypto/starfive/jh7110-cryp.h         | 127 +++
 drivers/crypto/starfive/jh7110-hash.c         | 892 ++++++++++++++++++
 10 files changed, 1391 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/starfive,jh7110-crypto.yaml
 create mode 100644 drivers/crypto/starfive/Kconfig
 create mode 100644 drivers/crypto/starfive/Makefile
 create mode 100644 drivers/crypto/starfive/jh7110-cryp.c
 create mode 100644 drivers/crypto/starfive/jh7110-cryp.h
 create mode 100644 drivers/crypto/starfive/jh7110-hash.c

Comments

Herbert Xu May 19, 2023, 8:50 a.m. UTC | #1
On Mon, May 15, 2023 at 08:53:51PM +0800, Jia Jie Ho wrote:
> This patch series adds kernel driver support for StarFive JH7110 crypto
> engine. The first patch adds Documentations for the device and Patch 2
> adds device probe and DMA init for the module. Patch 3 adds crypto and
> DMA dts node for VisionFive 2 board. Patch 4 adds hash/hmac support to
> the module.
> 
> Patch 3 needs to be applied on top of:
> https://lore.kernel.org/lkml/20230424135409.6648-3-xingyu.wu@starfivetech.com/
> 
> Patch 4 needs to be applied on top of:
> https://lore.kernel.org/linux-crypto/ZEEOXIHwqKblKfBJ@gondor.apana.org.au/T/#u
> 
> Changes v7->v8
> - Enable COMPILE_TEST in Kconfig (Herbert)
> - Fix compile_test warning on 'long unsigned int' to 'unsigned int'
>   conversion (Herbert)
> 
> Changes v6->v7
> - Remove NULL assignment as struct is kzalloc()-ed (Christophe)
> - Do clk_disable_unprepare and assert reset if probe failed (Christophe)
> - Remove unnecessary null pointer check (Christophe)
> - Update module name in Kconfig description (Christophe)
> 
> Changes v5->v6
> - Remove set_crypt in export as request will have been created by
>   init/updated calls (Herbert)
> - Use new helper to set statesize of crypto_ahash (Herbert)
> - Use crypto_ahash_blocksize instead of crypto_ahash_tfm (Herbert)
> - Switch to init_tfm/exit_tfm instead of cra_init/cra_exit (Herbert)
> 
> Changes v4->v5
> - Schedule tasklet from IRQ handler instead of using completion to sync
>   events (Herbert)
> 
> Changes v3->v4:
> - Use fallback for non-aligned cases as hardware doesn't support
>   hashing piece-meal (Herbert)
> - Use ahash_request_set_* helpers to update members of ahash_request
>   (Herbert)
> - Set callbacks for async fallback (Herbert)
> - Remove completion variable and use dma_callback to do the rest of
>   processing instead. (Herbert)
> 
> Changes v2->v3:
> - Only implement digest and use fallback for other ops (Herbert)
> - Use interrupt instead of polling for hash complete (Herbert)
> - Remove manual data copy from out-of-bound memory location as it will
>   be handled by DMA API. (Christoph & Herbert)
> 
> Changes v1->v2:
> - Fixed yaml filename and format (Krzysztof)
> - Removed unnecessary property names in yaml (Krzysztof)
> - Moved of_device_id table close to usage (Krzysztof)
> - Use dev_err_probe for error returns (Krzysztof)
> - Dropped redundant readl and writel wrappers (Krzysztof)
> - Updated commit signed offs (Conor)
> - Dropped redundant node in dts, module set to on in dtsi (Conor)
> 
> Jia Jie Ho (4):
>   dt-bindings: crypto: Add StarFive crypto module
>   crypto: starfive - Add crypto engine support
>   riscv: dts: starfive: Add crypto and DMA node for VisionFive 2
>   crypto: starfive - Add hash and HMAC support
> 
>  .../crypto/starfive,jh7110-crypto.yaml        |  70 ++
>  MAINTAINERS                                   |   7 +
>  arch/riscv/boot/dts/starfive/jh7110.dtsi      |  28 +
>  drivers/crypto/Kconfig                        |   1 +
>  drivers/crypto/Makefile                       |   1 +
>  drivers/crypto/starfive/Kconfig               |  21 +
>  drivers/crypto/starfive/Makefile              |   4 +
>  drivers/crypto/starfive/jh7110-cryp.c         | 240 +++++
>  drivers/crypto/starfive/jh7110-cryp.h         | 127 +++
>  drivers/crypto/starfive/jh7110-hash.c         | 892 ++++++++++++++++++
>  10 files changed, 1391 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/crypto/starfive,jh7110-crypto.yaml
>  create mode 100644 drivers/crypto/starfive/Kconfig
>  create mode 100644 drivers/crypto/starfive/Makefile
>  create mode 100644 drivers/crypto/starfive/jh7110-cryp.c
>  create mode 100644 drivers/crypto/starfive/jh7110-cryp.h
>  create mode 100644 drivers/crypto/starfive/jh7110-hash.c
> 
> -- 
> 2.25.1

All applied.  Thanks.
Conor Dooley May 19, 2023, 9:24 a.m. UTC | #2
Hey Herbert,

On Fri, May 19, 2023 at 04:50:34PM +0800, Herbert Xu wrote:
> On Mon, May 15, 2023 at 08:53:51PM +0800, Jia Jie Ho wrote:
> > Jia Jie Ho (4):
> >   dt-bindings: crypto: Add StarFive crypto module
> >   crypto: starfive - Add crypto engine support
> >   riscv: dts: starfive: Add crypto and DMA node for VisionFive 2
> >   crypto: starfive - Add hash and HMAC support

> All applied.  Thanks.

Can you drop the ea1aeba1b2e07b82f9eb7cce5cb169263a77d046 ("riscv: dts:
starfive: Add crypto and DMA node for VisionFive 2") please?
It depends on a clock node that has not been added to the dts yet, and
will break the dtb build:

Error: arch/riscv/boot/dts/starfive/jh7110.dtsi:505.22-23 syntax error
FATAL ERROR: Unable to parse input tree

Thanks,
Conor.
Herbert Xu May 19, 2023, 9:29 a.m. UTC | #3
On Fri, May 19, 2023 at 10:24:28AM +0100, Conor Dooley wrote:
>
> Can you drop the ea1aeba1b2e07b82f9eb7cce5cb169263a77d046 ("riscv: dts:
> starfive: Add crypto and DMA node for VisionFive 2") please?
> It depends on a clock node that has not been added to the dts yet, and
> will break the dtb build:
> 
> Error: arch/riscv/boot/dts/starfive/jh7110.dtsi:505.22-23 syntax error
> FATAL ERROR: Unable to parse input tree

OK, I've dropped it.

Cheers,