diff options
author | Paul Mackerras <paulus@samba.org> | 2015-07-17 13:11:43 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-07-23 12:52:03 +0300 |
commit | 01c9348c7620ec650aaeb3ce339f614709b2fb5a (patch) | |
tree | 519bbfcb73d48637750357676b3f024761dfa68d /arch/powerpc/platforms/pseries/rng.c | |
parent | 1c2cb594441d02815d304cccec9742ff5c707495 (diff) | |
download | linux-01c9348c7620ec650aaeb3ce339f614709b2fb5a.tar.xz |
powerpc: Use hardware RNG for arch_get_random_seed_* not arch_get_random_*
The hardware RNG on POWER8 and POWER7+ can be relatively slow, since
it can only supply one 64-bit value per microsecond. Currently we
read it in arch_get_random_long(), but that slows down reading from
/dev/urandom since the code in random.c calls arch_get_random_long()
for every longword read from /dev/urandom.
Since the hardware RNG supplies high-quality entropy on every read, it
matches the semantics of arch_get_random_seed_long() better than those
of arch_get_random_long(). Therefore this commit makes the code use
the POWER8/7+ hardware RNG only for arch_get_random_seed_{long,int}
and not for arch_get_random_{long,int}.
This won't affect any other PowerPC-based platforms because none of
them currently support a hardware RNG. To make it clear that the
ppc_md function pointer is used for arch_get_random_seed_*, we rename
it from get_random_long to get_random_seed.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/platforms/pseries/rng.c')
-rw-r--r-- | arch/powerpc/platforms/pseries/rng.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/pseries/rng.c b/arch/powerpc/platforms/pseries/rng.c index e09608770909..31ca557af60b 100644 --- a/arch/powerpc/platforms/pseries/rng.c +++ b/arch/powerpc/platforms/pseries/rng.c @@ -38,7 +38,7 @@ static __init int rng_init(void) pr_info("Registering arch random hook.\n"); - ppc_md.get_random_long = pseries_get_random_long; + ppc_md.get_random_seed = pseries_get_random_long; return 0; } |