]> 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)
commit02a483995a608ca8c937e25662e624453256dec9
tree46b0b0ca669a0be0d4bac2e63ca175f0da703dba
parent94129964a4d79ee097dfbb1541e71350d073ff01
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