linux-stable/arch/s390
Jason A. Donenfeld d349ab99ee random: handle archrandom with multiple longs
The archrandom interface was originally designed for x86, which supplies
RDRAND/RDSEED for receiving random words into registers, resulting in
one function to generate an int and another to generate a long. However,
other architectures don't follow this.

On arm64, the SMCCC TRNG interface can return between one and three
longs. On s390, the CPACF TRNG interface can return arbitrary amounts,
with four longs having the same cost as one. On UML, the os_getrandom()
interface can return arbitrary amounts.

So change the api signature to take a "max_longs" parameter designating
the maximum number of longs requested, and then return the number of
longs generated.

Since callers need to check this return value and loop anyway, each arch
implementation does not bother implementing its own loop to try again to
fill the maximum number of longs. Additionally, all existing callers
pass in a constant max_longs parameter. Taken together, these two things
mean that the codegen doesn't really change much for one-word-at-a-time
platforms, while performance is greatly improved on platforms such as
s390.

Acked-by: Heiko Carstens <hca@linux.ibm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Michael Ellerman <mpe@ellerman.id.au>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-07-25 13:26:14 +02:00
..
appldata s390/appldata: use struct_size() helper 2020-06-29 16:32:34 +02:00
boot Kbuild updates for v5.19 2022-05-26 12:09:50 -07:00
configs random: remove CONFIG_ARCH_RANDOM 2022-07-18 15:03:37 +02:00
crypto random: remove CONFIG_ARCH_RANDOM 2022-07-18 15:03:37 +02:00
hypfs s390/hypfs: fix typos in comments 2022-05-06 20:45:13 +02:00
include random: handle archrandom with multiple longs 2022-07-25 13:26:14 +02:00
kernel random: remove CONFIG_ARCH_RANDOM 2022-07-18 15:03:37 +02:00
kvm Bitmap patches for 5.19-rc1 2022-06-04 14:04:27 -07:00
lib s390/alternatives: provide identical sized orginal/alternative sequences 2022-05-17 15:16:28 +02:00
mm virtio: replace arch_has_restricted_virtio_memory_access() 2022-06-06 08:22:01 +02:00
net s390/bpf: Fix typo in comment 2022-05-23 11:25:53 -07:00
pci s390/pci: add error record for CC 2 retries 2022-04-25 13:54:15 +02:00
purgatory s390/purgatory: remove duplicated build rule of kexec-purgatory.o 2022-06-30 14:18:16 +02:00
tools s390: raise minimum supported machine generation to z10 2022-03-10 15:58:17 +01:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig random: remove CONFIG_ARCH_RANDOM 2022-07-18 15:03:37 +02:00
Kconfig.debug s390/Kconfig.debug: fix indentation 2022-06-01 12:03:15 +02:00
Makefile gcc-12: disable '-Warray-bounds' universally for now 2022-06-09 10:11:12 -07:00