• Andre Przywara's avatar
    arm64: Add support for SMCCC TRNG entropy source · 38db9873
    Andre Przywara authored
    The ARM architected TRNG firmware interface, described in ARM spec
    DEN0098, defines an ARM SMCCC based interface to a true random number
    generator, provided by firmware.
    This can be discovered via the SMCCC >=v1.1 interface, and provides
    up to 192 bits of entropy per call.
    
    Hook this SMC call into arm64's arch_get_random_*() implementation,
    coming to the rescue when the CPU does not implement the ARM v8.5 RNG
    system registers.
    
    For the detection, we piggy back on the PSCI/SMCCC discovery (which gives
    us the conduit to use (hvc/smc)), then try to call the
    ARM_SMCCC_TRNG_VERSION function, which returns -1 if this interface is
    not implemented.
    Reviewed-by: default avatarMark Brown <broonie@kernel.org>
    Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
    Signed-off-by: default avatarWill Deacon <will@kernel.org>
    38db9873
archrandom.h 3.05 KB