On Thu, Jun 20, 2024 at 06:13:33PM -0500, Sam Protsenko wrote: > Exynos850 has True Random Number Generator (TRNG) block which is very > similar to Exynos5250 for which the driver already exists > (exynos-trng.c). There are two differences though: > 1. Additional SSS PCLK clock has to be enabled to make TRNG registers > accessible. > 2. All SSS registers (including TRNG area) are protected with > TrustZone and can only be accessed from EL3 monitor. So the > corresponding SMC calls have to be used instead to interact with > TRNG block. > > This patch series enables TRNG support on Exynos850 SoC. It was tested > on the E850-96 board running Debian rootfs like this: > > 8<-------------------------------------------------------------->8 > # cat /sys/devices/virtual/misc/hw_random/rng_current > 12081400.rng > > # dd if=/dev/hwrng bs=100000 count=1 > /dev/null > ... > 122KB/s > > # apt install rng-tools5 > # rngtest -c 1000 < /dev/hwrng > ... > rngtest: starting FIPS tests... > rngtest: bits received from input: 20000032 > rngtest: FIPS 140-2 successes: 1000 > rngtest: FIPS 140-2 failures: 0 > rngtest: FIPS 140-2(2001-10-10) Monobit: 0 > rngtest: FIPS 140-2(2001-10-10) Poker: 0 > rngtest: FIPS 140-2(2001-10-10) Runs: 0 > rngtest: FIPS 140-2(2001-10-10) Long run: 0 > rngtest: FIPS 140-2(2001-10-10) Continuous run: 0 > rngtest: input channel speed: (min=941.855; avg=965.515; > max=968.236)Kibits/s > rngtest: FIPS tests speed: (min=49.542; avg=52.886; > max=53.577)Mibits/s > rngtest: Program run time: 20590194 microseconds > 8<-------------------------------------------------------------->8 > > SMC commands added in this series require LDFW (Loadable Firmware) to be > loaded by the bootloader. In case of E850-96 board, at the moment only > the LittleKernel based bootloader [1] is able to load LDFW. It is > expected to be added into U-Boot port soon as well. See [2] for more > details. > > [1] https://gitlab.com/Linaro/96boards/e850-96/lk > [2] https://docs.u-boot.org/en/latest/board/samsung/e850-96.html > > Changes in v3: > - Rebased on top of the most recent linux-next > - Removed dts patch (7/7) from the series, as suggested by Krzysztof > - Addressed all review comments for v2 series > > Changes in v2: > - Removed the patch for renaming the dt-bindings doc file > - Added the patch for using devm_clk_get_enabled() to get the clock > - Addressed all review comments for v1 series > > Sam Protsenko (6): > dt-bindings: rng: Add Exynos850 support to exynos-trng > hwrng: exynos: Improve coding style > hwrng: exynos: Use devm_clk_get_enabled() to get the clock > hwrng: exynos: Implement bus clock control > hwrng: exynos: Add SMC based TRNG operation > hwrng: exynos: Enable Exynos850 support > > .../bindings/rng/samsung,exynos5250-trng.yaml | 40 +++- > drivers/char/hw_random/exynos-trng.c | 225 +++++++++++++----- > 2 files changed, 206 insertions(+), 59 deletions(-) > > -- > 2.39.2 All applied. Thanks. -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt