devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] crypto: sun8i-ce: add Allwinner H616 support
@ 2024-06-16 22:07 Andre Przywara
  2024-06-22 23:37 ` Ryan Walklin
  0 siblings, 1 reply; 3+ messages in thread
From: Andre Przywara @ 2024-06-16 22:07 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S . Miller, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: linux-crypto, linux-arm-kernel, linux-sunxi, devicetree

This series adds support for the crypto engine in the Allwinner H616
SoC. The IP and its capabilities are very similar to the H6, with the
major difference of the DMA engine supporting 34 bit wide addresses.
This is achieved by just shifting every address by 2 bits in the DMA
descriptors; Allwinner calls this "word addresses".
Patch 2/4 adds support for this by wrapping every address access in a
function that does the shift as needed. Patch 1/4 adds the new
compatible string to the binding, patch 3/4 adds that string to the
driver and enables the address shift for it. The final patch 4/4 adds
the DT node to the SoC .dtsi. Since this is an internal peripheral,
it's always enabled.

Corentin's cryptotest passed for me, though I haven't checked how fast
it is and if it really brings an advantage performance-wise, but maybe
people find it useful to offload that from the CPU cores.
One immediate advantage is the availability of the TRNG device, which
helps to feed the kernel's entropy pool much faster - typically before
we reach userland. Without the driver this sometimes takes minutes, and
delays workloads that rely on the entropy pool.

Please have a look and comment!

Cheers,
Andre

Andre Przywara (4):
  dt-bindings: crypto: sun8i-ce: Add compatible for H616
  crypto: sun8i-ce - wrap accesses to descriptor address fields
  crypto: sun8i-ce - add Allwinner H616 support
  arm64: dts: allwinner: h616: add crypto engine node

 .../bindings/crypto/allwinner,sun8i-ce.yaml   |  2 ++
 .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 10 +++++++
 .../allwinner/sun8i-ce/sun8i-ce-cipher.c      |  8 ++---
 .../crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 29 ++++++++++++++++++-
 .../crypto/allwinner/sun8i-ce/sun8i-ce-hash.c |  6 ++--
 .../crypto/allwinner/sun8i-ce/sun8i-ce-prng.c |  6 ++--
 .../crypto/allwinner/sun8i-ce/sun8i-ce-trng.c |  2 +-
 drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h  | 10 +++++++
 8 files changed, 61 insertions(+), 12 deletions(-)

-- 
2.39.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/4] crypto: sun8i-ce: add Allwinner H616 support
@ 2024-06-22 17:59 Philippe Simons
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Simons @ 2024-06-22 17:59 UTC (permalink / raw)
  To: andre.przywara
  Cc: clabbe.montjoie, conor+dt, davem, devicetree, herbert,
	jernej.skrabec, krzk+dt, linux-arm-kernel, linux-crypto,
	linux-sunxi, robh, samuel, wens

Tested on RG35XX-H (H700), working fine

Tested-by: Philippe Simons <simons.philippe@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/4] crypto: sun8i-ce: add Allwinner H616 support
  2024-06-16 22:07 Andre Przywara
@ 2024-06-22 23:37 ` Ryan Walklin
  0 siblings, 0 replies; 3+ messages in thread
From: Ryan Walklin @ 2024-06-22 23:37 UTC (permalink / raw)
  To: Andre Przywara, Corentin Labbe, Herbert Xu, David S . Miller,
	Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-crypto, linux-arm-kernel, linux-sunxi, devicetree

On Mon, 17 Jun 2024, at 10:07 AM, Andre Przywara wrote:

Thanks Andre!

> Corentin's cryptotest passed for me, though I haven't checked how fast
> it is and if it really brings an advantage performance-wise, but maybe
> people find it useful to offload that from the CPU cores.

Running the rngtest gives the following output:

localhost:~# rngtest -c 10000 < /dev/random
rngtest 6.16
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 200000032
rngtest: FIPS 140-2 successes: 9991
rngtest: FIPS 140-2 failures: 9
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 2
rngtest: FIPS 140-2(2001-10-10) Runs: 2
rngtest: FIPS 140-2(2001-10-10) Long run: 5
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=144.496; avg=808.068; max=866.977)Mibits/s
rngtest: FIPS tests speed: (min=17.199; avg=60.937; max=62.949)Mibits/s
rngtest: Program run time: 3369060 microseconds

So looks like a nice performance boost. 

> One immediate advantage is the availability of the TRNG device, which
> helps to feed the kernel's entropy pool much faster - typically before
> we reach userland. Without the driver this sometimes takes minutes, and
> delays workloads that rely on the entropy pool.

CRNG bringup now also very fast:

[    1.114790] sun8i-ce 1904000.crypto: CryptoEngine Die ID 0
[    1.116253] random: crng init done

Tested-by: Ryan Walklin <ryan@testtoast.com>

Regards,

Ryan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-22 23:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-22 17:59 [PATCH 0/4] crypto: sun8i-ce: add Allwinner H616 support Philippe Simons
  -- strict thread matches above, loose matches on Subject: below --
2024-06-16 22:07 Andre Przywara
2024-06-22 23:37 ` Ryan Walklin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).