• Matt Brown's avatar
    powerpc/powernv: Use darn instruction for get_random_seed() on Power9 · e66ca3db
    Matt Brown authored
    This adds powernv_get_random_darn() which utilises the darn instruction,
    introduced in ISA v3.0/POWER9.
    
    The darn instruction can potentially return an error, which is supported
    by the get_random_seed() API, in normal usage if we see an error we just
    return that to the caller.
    
    However when detecting whether darn is functional at boot we try up to
    10 times, before deciding that darn doesn't work and failing the
    registration of get_random_seed(). That way an intermittent failure
    at boot doesn't deprive the system of randomness until the next reboot.
    Signed-off-by: default avatarMatt Brown <matthew.brown.dev@gmail.com>
    [mpe: Move init into a function, tweak change log]
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    e66ca3db
ppc-opcode.h 18.1 KB