linux-stable/include
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
..
acpi ACPI: CPPC: Don't require _OSC if X86_FEATURE_CPPC is supported 2022-07-05 20:36:11 +02:00
asm-generic random: handle archrandom with multiple longs 2022-07-25 13:26:14 +02:00
clocksource pwm: Changes for v5.19-rc1 2022-06-01 10:49:11 -07:00
crypto
drm drm/ttm: fix bulk move handling v2 2022-06-14 11:15:19 +02:00
dt-bindings Char / Misc / Other smaller driver subsystem updates for 5.19-rc1 2022-06-03 11:36:34 -07:00
keys certs: Move load_certificate_list() to be with the asymmetric keys code 2022-06-21 16:05:06 +01:00
kunit
kvm
linux random: handle archrandom with multiple longs 2022-07-25 13:26:14 +02:00
math-emu
media
memory
misc
net net/tls: Check for errors in tls_device_init 2022-07-14 10:12:39 -07:00
pcmcia
ras
rdma
scsi SCSI misc on 20220524 2022-05-25 19:09:48 -07:00
soc ARM: driver changes for 5.19 2022-05-26 10:32:47 -07:00
sound ASoC: Remove unused hw_write_t type 2022-06-24 16:21:41 +01:00
target SCSI misc on 20220524 2022-05-25 19:09:48 -07:00
trace Including fixes from netfilter, bpf and wireless. 2022-07-14 12:48:07 -07:00
uapi RISC-V: 2022-07-15 10:31:46 -07:00
ufs
vdso
video video: of_display_timing.h: include errno.h 2022-07-06 17:16:20 +02:00
xen arm/xen: Assign xen-grant DMA ops for xen-grant DMA devices 2022-06-06 16:07:30 +02:00