From: Richard Henderson <rth@xxxxxxxxxxx> The ARMv8.5-RNG extension adds a hardware random number generator. The plumbing for this is already present in the kernel; we just have to take advantage of that. Possible issues: When should we use RNDRRS? For now I use it at boot, when validating that the implementation can produce a random number, much like other architectures validate before enabling. I also use it if RNDR fails. I don't know if that's a reasonable thing to do; the generic architecture docs are too vague about what's going on behind the scenes. I mark ARM64_HAS_RNG as ARM64_CPUCAP_STRICT_BOOT_CPU_FEATURE so that it is detected early, because crng_initialize() is called early. I don't know if this is quite the right thing if some hypothetial big.LITTLE only has the RNG on the big cpus. Tested with QEMU. r~ Richard Henderson (1): arm64: Implement archrandom.h for ARMv8.5-RNG Documentation/arm64/cpu-feature-registers.rst | 2 + arch/arm64/include/asm/archrandom.h | 76 +++++++++++++++++++ arch/arm64/include/asm/cpucaps.h | 3 +- arch/arm64/include/asm/sysreg.h | 1 + arch/arm64/kernel/cpufeature.c | 34 +++++++++ arch/arm64/Kconfig | 12 +++ drivers/char/Kconfig | 4 +- 7 files changed, 129 insertions(+), 3 deletions(-) create mode 100644 arch/arm64/include/asm/archrandom.h -- 2.17.1