linux/arch/arm64
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
..
boot This pull request contains Broadcom ARM64-based SoCs Device Tree fixes 2022-07-13 09:35:56 +02:00
configs - Enable essential PMIC and regulatro drivers for MT8195. 2022-05-13 14:02:30 +02:00
crypto crypto: arm64/sm4 - Fix wrong dependency of NEON/CE implementation 2022-04-15 16:34:30 +08:00
hyperv arm64: hyperv: Initialize hypervisor on boot 2021-08-04 16:54:36 +00:00
include random: handle archrandom with multiple longs 2022-07-25 13:26:14 +02:00
kernel random: handle archrandom with multiple longs 2022-07-25 13:26:14 +02:00
kvm KVM: arm64: Prevent kmemleak from accessing pKVM memory 2022-06-17 09:48:38 +01:00
lib S390: 2022-05-26 14:20:14 -07:00
mm arm64: hugetlb: Restore TLB invalidation for BBM on contiguous ptes 2022-07-01 18:29:26 +01:00
net bpf, arm64: Clear prog->jited_len along prog->jited 2022-06-07 10:40:53 -07:00
tools arm64/sysreg: Fix typo in Enum element regex 2022-06-10 16:23:48 +01:00
xen xen: allow pv-only hypercalls only with CONFIG_XEN_PV 2021-11-02 08:11:01 -05: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
Kconfig.platforms arm64 updates for 5.19: 2022-05-23 21:06:11 -07:00
Makefile kbuild: factor out the common installation code into scripts/install.sh 2022-05-11 21:45:53 +09:00