linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/1] arm64: Implement archrandom.h for ARMv8.5-RNG
@ 2019-11-06 14:19 Richard Henderson
  2019-11-06 14:19 ` [PATCH v4 1/1] " Richard Henderson
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2019-11-06 14:19 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-crypto, mark.rutland, ard.biesheuvel

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.

Changes since v2:
  * Keep arch_get_random{,_seed}_long in sync.
  * Use __cpus_have_const_cap before falling back to this_cpu_has_cap.

Changes since v1:
  * Use __mrs_s and fix missing cc clobber (Mark),
  * Log rng failures with pr_warn (Mark),
  * Use __must_check; put RNDR in arch_get_random_long and RNDRRS
    in arch_get_random_seed_long (Ard),
  * Use ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE, and check this_cpu_has_cap
    when reading random data.
  * Move everything out of line, now that there are 5 other function
    calls involved, and to unify the rate limiting on the pr_warn.

Tested with QEMU.  What's not tested is hot plugging cpus with differing
capabilities; QEMU would need some extension to allow that sort of thing.


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           | 35 ++++++++
 arch/arm64/include/asm/cpucaps.h              |  3 +-
 arch/arm64/include/asm/sysreg.h               |  4 +
 arch/arm64/kernel/cpufeature.c                | 13 +++
 arch/arm64/kernel/random.c                    | 79 +++++++++++++++++++
 arch/arm64/Kconfig                            | 12 +++
 arch/arm64/kernel/Makefile                    |  1 +
 drivers/char/Kconfig                          |  4 +-
 9 files changed, 150 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm64/include/asm/archrandom.h
 create mode 100644 arch/arm64/kernel/random.c

-- 
2.17.1


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

end of thread, other threads:[~2019-11-08 14:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06 14:19 [PATCH v4 0/1] arm64: Implement archrandom.h for ARMv8.5-RNG Richard Henderson
2019-11-06 14:19 ` [PATCH v4 1/1] " Richard Henderson
2019-11-06 21:30   ` Ard Biesheuvel
2019-11-08 11:09     ` Richard Henderson
2019-11-08 13:03       ` Ard Biesheuvel
2019-11-08 14:24         ` Ard Biesheuvel
2019-11-08 14:52           ` Richard Henderson

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).