linux-stable/arch
Jason A. Donenfeld 836a2cea5b s390/archrandom: simplify back to earlier design and initialize earlier
commit e4f7440030 upstream.

s390x appears to present two RNG interfaces:
- a "TRNG" that gathers entropy using some hardware function; and
- a "DRBG" that takes in a seed and expands it.

Previously, the TRNG was wired up to arch_get_random_{long,int}(), but
it was observed that this was being called really frequently, resulting
in high overhead. So it was changed to be wired up to arch_get_random_
seed_{long,int}(), which was a reasonable decision. Later on, the DRBG
was then wired up to arch_get_random_{long,int}(), with a complicated
buffer filling thread, to control overhead and rate.

Fortunately, none of the performance issues matter much now. The RNG
always attempts to use arch_get_random_seed_{long,int}() first, which
means a complicated implementation of arch_get_random_{long,int}() isn't
really valuable or useful to have around. And it's only used when
reseeding, which means it won't hit the high throughput complications
that were faced before.

So this commit returns to an earlier design of just calling the TRNG in
arch_get_random_seed_{long,int}(), and returning false in arch_get_
random_{long,int}().

Part of what makes the simplification possible is that the RNG now seeds
itself using the TRNG at bootup. But this only works if the TRNG is
detected early in boot, before random_init() is called. So this commit
also causes that check to happen in setup_arch().

Cc: stable@vger.kernel.org
Cc: Harald Freudenberger <freude@linux.ibm.com>
Cc: Ingo Franzki <ifranzki@linux.ibm.com>
Cc: Juergen Christ <jchrist@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Link: https://lore.kernel.org/r/20220610222023.378448-1-Jason@zx2c4.com
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-07 17:31:16 +02:00
..
alpha alpha: define get_cycles macro for arch-override 2022-06-25 11:46:38 +02:00
arc ARC: entry: fix syscall_trace_exit argument 2022-04-27 13:15:31 +02:00
arm ARM: cns3xxx: Fix refcount leak in cns3xxx_init 2022-07-02 16:18:10 +02:00
arm64 arm64: ftrace: fix branch range checks 2022-06-25 11:46:44 +02:00
blackfin
c6x
cris
frv
h8300 h8300: fix PREEMPTION build, TI_PRE_COUNT undefined 2021-02-23 14:00:33 +01:00
hexagon hexagon: export raw I/O routines for modules 2021-11-26 11:40:40 +01:00
ia64 ia64: define get_cycles macro for arch-override 2022-06-25 11:46:38 +02:00
m32r
m68k m68k: use fallback for random_get_entropy() instead of zero 2022-06-25 11:46:38 +02:00
metag
microblaze microblaze: Prevent the overflow of the start 2020-02-28 16:36:08 +01:00
mips MIPS: Remove repetitive increase irq_err_count 2022-07-02 16:18:08 +02:00
mn10300
nios2 nios2: use fallback for random_get_entropy() instead of zero 2022-06-25 11:46:38 +02:00
openrisc openrisc: start CPU timer early in boot 2022-06-14 16:53:45 +02:00
parisc parisc: define get_cycles macro for arch-override 2022-06-25 11:46:38 +02:00
powerpc powerpc/pseries: wire up rng during setup_arch() 2022-07-02 16:18:10 +02:00
s390 s390/archrandom: simplify back to earlier design and initialize earlier 2022-07-07 17:31:16 +02:00
score
sh mips,s390,sh,sparc: gup: Work around the "COW can break either way" issue 2022-01-27 09:01:01 +01:00
sparc sparc: use fallback for random_get_entropy() instead of zero 2022-06-25 11:46:39 +02:00
tile
um um: use fallback for random_get_entropy() instead of zero 2022-06-25 11:46:39 +02:00
unicore32
x86 kexec_file: drop weak attribute from arch_kexec_apply_relocations[_add] 2022-07-02 16:18:11 +02:00
xtensa xtensa: Fix refcount leak bug in time.c 2022-07-02 16:18:09 +02:00
.gitignore
Kconfig x86: Make ARCH_USE_MEMREMAP_PROT a generic Kconfig symbol 2021-12-22 09:17:59 +01:00