powerpc/vdso: Implement __arch_get_vdso_rng_data()
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Wed, 2 Oct 2024 08:39:29 +0000 (10:39 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 16 Oct 2024 00:14:40 +0000 (11:14 +1100)
commit4e3fa1aecb2c1f128f7289272fe2947e4396f1ce
tree843e9c30d0364332d2a73a46743380d379746c65
parentc39b1dcf055d420a498d1047c645b776e4d1a7aa
powerpc/vdso: Implement __arch_get_vdso_rng_data()

VDSO time functions do not call any other function, so they don't
need to save/restore LR. However, retrieving the address of VDSO data
page requires using LR hence saving then restoring it, which can be
heavy on some CPUs. On the other hand, VDSO functions on powerpc are
not standard functions and require a wrapper function to call C VDSO
functions. And that wrapper has to save and restore LR in order to
call the C VDSO function, so retrieving VDSO data page address in that
wrapper doesn't require additional save/restore of LR.

For random VDSO functions it is a bit different. Because the function
calls __arch_chacha20_blocks_nostack(), it saves and restores LR.
Retrieving VDSO data page address can then be done there without
additional save/restore of LR.

So lets implement __arch_get_vdso_rng_data() and simplify the wrapper.

It starts paving the way for the day powerpc will implement a more
standard ABI for VDSO functions.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://patch.msgid.link/a1a9bd0df508f1b5c04684b7366940577dfc6262.1727858295.git.christophe.leroy@csgroup.eu
arch/powerpc/include/asm/vdso/getrandom.h
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/vdso/getrandom.S
arch/powerpc/kernel/vdso/vgetrandom.c