[PATCH 0/2] arm64: Add support for SMCCC TRNG interface

From: Andre Przywara
Date: Tue Oct 06 2020 - 16:18:51 EST


The ARM architected TRNG firmware interface, described in ARM spec
DEN0098[1], defines an ARM SMCCC based interface to a true random number
generator, provided by firmware.

This is the arm64 implementation of that interface, implemented in
the arch_get_random_*() code.

Patch 1/2 introduces the SMCCC function identifiers, this is extracted
from Ard's patch, to avoid dependencies between the several patches
floating around (ARM, KVM, arm64).

Patch 2/2 detects the interface and calls into the firmware upon a call
to arch_get_random_seed_long().
Support for the "early" variant is under investigation.

This was tested on:
- QEMU -kernel (no SMCCC, regression test)
- Juno w/ standard firmware (SMCCC, but no TRNG: regression test)
- Juno w/ "fake TRNG" firmware (to verify "random" numbers)
- Juno w/ prototype of the h/w Trusted RNG support
- mainline KVM (SMCCC, but no TRNG: regression test)
- Ard's KVM patch (plus hack to inject fake numbers for verification purposes)

Cheers,
Andre

[1] https://developer.arm.com/documentation/den0098/latest/

Andre Przywara (1):
arm64: Add support for SMCCC TRNG firmware interface

Ard Biesheuvel (1):
firmware: smccc: Add SMCCC TRNG function call IDs

arch/arm64/include/asm/archrandom.h | 83 +++++++++++++++++++++++++----
include/linux/arm-smccc.h | 31 +++++++++++
2 files changed, 104 insertions(+), 10 deletions(-)

--
2.17.1