]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/powernv: Use darn instruction for get_random_seed() on Power9
authorMatt Brown <matthew.brown.dev@gmail.com>
Fri, 4 Aug 2017 01:12:18 +0000 (11:12 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 8 Aug 2017 09:37:03 +0000 (19:37 +1000)
commit3d9199c8123242444ffd7b8aa46c808951d3b2e9
tree46b0b0ca669a0be0d4bac2e63ca175f0da703dba
parent16fe41223e62013d9da74cb0f1fc7fbf38e957a9
powerpc/powernv: Use darn instruction for get_random_seed() on Power9

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: Matt Brown <matthew.brown.dev@gmail.com>
[mpe: Move init into a function, tweak change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/ppc-opcode.h
arch/powerpc/platforms/powernv/rng.c