mirror-linux/arch/s390/include/asm
Heiko Carstens b920aa77be s390/vdso: Wire up getrandom() vdso implementation
Provide the s390 specific vdso getrandom() architecture backend.

_vdso_rng_data required data is placed within the _vdso_data vvar page,
by using a hardcoded offset larger than vdso_data.

As required the chacha20 implementation does not write to the stack.

The implementation follows more or less the arm64 implementations and
makes use of vector instructions. It has a fallback to the getrandom()
system call for machines where the vector facility is not installed.

The check if the vector facility is installed, as well as an
optimization for machines with the vector-enhancements facility 2, is
implemented with alternatives, avoiding runtime checks.

Note that __kernel_getrandom() is implemented without the vdso user
wrapper which would setup a stack frame for odd cases (aka very old
glibc variants) where the caller has not done that. All callers of
__kernel_getrandom() are required to setup a stack frame, like the C ABI
requires it.

The vdso testcases vdso_test_getrandom and vdso_test_chacha pass.

Benchmark on a z16:

    $ ./vdso_test_getrandom bench-single
       vdso: 25000000 times in 0.493703559 seconds
    syscall: 25000000 times in 6.584025337 seconds

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2024-09-13 20:57:31 +02:00
..
trace
vdso s390/vdso: Wire up getrandom() vdso implementation 2024-09-13 20:57:31 +02:00
Kbuild s390: remove <asm/export.h> 2023-08-09 15:20:51 +02:00
abs_lowcore.h s390: Add infrastructure to patch lowcore accesses 2024-07-23 16:02:32 +02:00
access-regs.h s390/acrs: cleanup access register handling 2024-02-12 15:03:33 +01:00
airq.h s390/airq: remove lsi_mask from airq_struct 2023-08-30 11:03:28 +02:00
alternative.h s390/alternatives: Remove ALT_FACILITY_EARLY 2024-09-13 17:28:36 +02:00
ap.h s390/chsc: use notifier for AP configuration changes 2024-04-09 17:29:55 +02:00
appldata.h s390/appldata: fix virtual vs physical address confusion 2024-02-09 13:58:13 +01:00
arch_hweight.h s390: Provide optimized __arch_hweight*() implementations 2024-06-24 11:12:39 +02:00
archrandom.h Random number generator updates for Linux 6.0-rc1. 2022-08-02 17:31:35 -07:00
asm-const.h
asm-extable.h s390: add support for DCACHE_WORD_ACCESS 2023-10-16 13:04:09 +02:00
asm-prototypes.h s390/expoline: Make modules use kernel expolines 2024-04-17 13:38:03 +02:00
atomic.h s390/atomic: mark all functions __always_inline 2024-04-03 15:00:19 +02:00
atomic_ops.h s390/atomic_ops: Disable flag outputs constraint for GCC versions below 14.2.0 2024-07-23 16:02:31 +02:00
barrier.h
bitops.h s390: Provide optimized __arch_hweight*() implementations 2024-06-24 11:12:39 +02:00
boot_data.h
bug.h s390/bug: remove entry size from __bug_table section 2024-02-14 13:50:53 +01:00
cache.h
ccwdev.h driver core: have match() callback in struct bus_type take a const * 2024-07-03 15:16:54 +02:00
ccwgroup.h
checksum.h s390/checksum: add a KMSAN check 2024-07-03 19:30:24 -07:00
chpid.h
chsc.h s390/chsc: use notifier for AP configuration changes 2024-04-09 17:29:55 +02:00
cio.h s390/virtio_ccw: use DMA handle from DMA API 2024-03-13 09:23:46 +01:00
clocksource.h
clp.h
cmb.h
cmpxchg.h arch: Remove cmpxchg_double 2023-06-05 09:36:39 +02:00
compat.h s390/uapi: cover statfs padding by growing f_spare 2023-05-17 15:20:17 +02:00
cpacf.h s390/cpacf: unpoison the results of cpacf_trng() 2024-07-03 19:30:24 -07:00
cpcmd.h
cpu.h
cpu_mf-insn.h
cpu_mf.h s390/cpumf: unpoison STCCTM output buffer 2024-07-03 19:30:24 -07:00
cpufeature.h s390/uvdevice: autoload module based on CPU facility 2022-07-19 16:18:49 +02:00
cputime.h s390/idle: remove arch_cpu_idle_time() and corresponding code 2023-02-09 20:11:23 +01:00
crw.h
css_chars.h
ctlreg.h s390/ctlreg: return old register contents when changing bits 2023-12-11 14:33:04 +01:00
current.h s390: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
dat-bits.h s390/kvm: Move bitfields for dat tables 2024-07-10 19:50:45 +02:00
debug.h docs: move s390 under arch 2023-07-24 12:12:24 +02:00
delay.h
diag.h s390/hypfs_diag: Diag204 busy loop 2024-07-10 19:50:45 +02:00
dis.h
dma-types.h s390/mm: provide simple ARCH_HAS_DEBUG_VIRTUAL support 2024-03-13 09:23:49 +01:00
dma.h s390/mm: fix MAX_DMA_ADDRESS physical vs virtual confusion 2023-09-05 20:12:51 +02:00
dwarf.h s390/vdso: Add CFI for RA register to asm macro vdso_func 2024-04-26 16:22:38 +02:00
eadm.h s390/cio: use bitwise types to allow for type checking 2024-03-13 09:23:46 +01:00
ebcdic.h
elf.h s390/hwcaps: Add documentation for HWCAP flags 2024-07-02 10:17:16 +02:00
entry-common.h randomize_kstack: Remove non-functional per-arch entropy filtering 2024-06-28 08:54:56 -07:00
exec.h
extable.h
extmem.h s390/boot: Consider DCSS segments on memory layout setup 2024-04-17 13:37:59 +02:00
facility.h s390/facility: Let test_facility() generate static branch if possible 2024-09-13 17:28:36 +02:00
fault.h s390/mm: move translation-exception identification structure to fault.h 2023-10-23 18:21:22 +02:00
fcx.h s390/cio: use bitwise types to allow for type checking 2024-03-13 09:23:46 +01:00
fpu-insn-asm.h s390/vdso: Wire up getrandom() vdso implementation 2024-09-13 20:57:31 +02:00
fpu-insn.h s390/fpu: add vector instruction inline assemblies for crc32 2024-02-16 14:30:18 +01:00
fpu-types.h s390/checksum: provide vector register variant of csum_partial() 2024-02-16 14:30:17 +01:00
fpu.h s390/fpu: limit save and restore to used registers 2024-02-16 14:30:16 +01:00
ftrace.h function_graph: Everyone uses HAVE_FUNCTION_GRAPH_RET_ADDR_PTR, remove it 2024-06-11 11:18:24 -04:00
ftrace.lds.h
futex.h s390/futex: add missing EX_TABLE entry to __futex_atomic_op() 2022-10-26 14:47:31 +02:00
gmap.h s390/mm: Re-enable the shared zeropage for !PV and !skeys KVM guests 2024-04-18 15:02:53 +02:00
hardirq.h s390: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
hugetlb.h mm: provide mm_struct and address to huge_ptep_get() 2024-07-12 15:52:15 -07:00
hw_irq.h
idals.h s390/cio,idal: fix virtual vs physical address confusion 2024-03-13 09:23:47 +01:00
idle.h s390/irq,idle: simplify idle check 2023-02-15 11:07:01 +01:00
io.h s390: Stop using weak symbols for __iowrite64_copy() 2024-04-22 17:11:20 -03:00
ipl.h s390/ipl: add eckd dump support 2022-12-06 16:18:22 +01:00
irq.h s390/irq: use CR0 defines to define CR0_IRQ_SUBCLASS_MASK 2023-09-19 13:26:57 +02:00
irq_work.h arch: consolidate arch_irq_work_raise prototypes 2023-11-23 11:32:29 +01:00
irqflags.h s390/irqflags: do not instrument arch_local_irq_*() with KMSAN 2024-07-03 19:30:25 -07:00
isc.h
itcw.h
jump_label.h work around gcc bugs with 'asm goto' with outputs 2024-02-09 15:57:48 -08:00
kasan.h s390/kasan: move shadow mapping to decompressor 2023-03-20 11:02:51 +01:00
kdebug.h
kexec.h kexec: drop weak attribute from functions 2022-07-15 12:21:16 -04:00
kfence.h s390/mm: make virt_to_pfn() a static inline 2023-08-16 15:13:03 +02:00
kmsan.h s390/kmsan: Fix merge conflict with get_lowcore() introduction 2024-07-23 16:01:51 +02:00
kprobes.h kprobes: unify kprobes_exceptions_nofify() prototypes 2023-11-10 19:59:05 +09:00
kvm_host.h ARM: 2024-07-20 12:41:03 -07:00
kvm_para.h
linkage.h s390: make use of CONFIG_FUNCTION_ALIGNMENT 2023-03-20 11:12:46 +01:00
lowcore.h s390/entry: Make pgm_check_handler() ready for lowcore relocation 2024-07-23 16:02:32 +02:00
maccess.h s390/mm: define Real Memory Copy size and mask macros 2023-08-16 15:13:02 +02:00
mem_encrypt.h s390/mm: fix virtual-physical address confusion for swiotlb 2022-11-07 14:33:40 +01:00
mmu.h s390/mm: Re-enable the shared zeropage for !PV and !skeys KVM guests 2024-04-18 15:02:53 +02:00
mmu_context.h s390: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
mmzone.h
module.h s390/module: Provide find_section() helper 2024-09-13 17:28:36 +02:00
msi.h irq/s390: Add arch_is_isolated_msi() for s390 2023-01-11 16:27:23 -04:00
nmi.h s390/mcck: cleanup user process termination path 2023-02-28 13:19:05 +01:00
nospec-branch.h s390/nospec: Push down alternative handling 2024-07-23 16:02:31 +02:00
nospec-insn.h s390/expoline: Make modules use kernel expolines 2024-04-17 13:38:03 +02:00
numa.h
os_info.h s390/os_info: Fix array size in struct os_info 2024-04-29 17:33:29 +02:00
page-states.h s390/cmma: move arch_set_page_dat() to header file 2023-11-05 22:34:58 +01:00
page.h s390/boot: Fix KASLR base offset off by __START_KERNEL bytes 2024-08-22 19:24:13 +02:00
pai.h s390: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
pci.h s390/pci: introduce lock to synchronize state of zpci_dev's 2024-02-20 14:37:32 +01:00
pci_clp.h s390/pci: Use dma-iommu layer 2023-10-02 08:43:00 +02:00
pci_debug.h
pci_dma.h s390/pci: Use dma-iommu layer 2023-10-02 08:43:00 +02:00
pci_insn.h KVM: s390: pci: do initial setup for AEN interpretation 2022-07-11 09:54:28 +02:00
pci_io.h s390/pci: fix max size calculation in zpci_memcpy_toio() 2024-01-11 18:22:58 +01:00
percpu.h s390: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
perf_event.h s390/cpum_sf: remove flag PERF_CPUM_SF_FULL_BLOCKS 2023-03-27 17:19:52 +02:00
pfault.h s390/pfault: cleanup inline assemblies 2023-07-29 14:57:18 +02:00
pgalloc.h s390: supplement for ptdesc conversion 2024-03-06 13:04:18 -08:00
pgtable.h - 875fa64577da ("mm/hugetlb_vmemmap: fix race with speculative PFN 2024-07-21 17:15:46 -07:00
physmem_info.h s390/boot: Do not rescue .vmlinux.relocs section 2024-04-17 13:38:02 +02:00
pkey.h s390/pkey: do not use struct pkey_protkey 2023-06-01 17:10:21 +02:00
pnet.h
preempt.h s390: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
processor.h s390/entry: Move SIE indicator flag to thread info 2024-07-23 16:02:31 +02:00
ptrace.h s390/entry: compare gmap asce to determine guest/host fault 2024-03-17 19:08:50 +01:00
purgatory.h
qdio.h s390/cio: use bitwise types to allow for type checking 2024-03-13 09:23:46 +01:00
runtime-const.h s390: Add runtime constant support 2024-07-23 15:54:58 +02:00
runtime_instr.h
rwonce.h s390/rwonce: add READ_ONCE_ALIGNED_128() macro 2023-02-28 13:19:05 +01:00
schid.h
sclp.h s390/sclp: Diag204 busy indication facility detection 2024-07-10 19:50:44 +02:00
scsw.h s390/cio: use bitwise types to allow for type checking 2024-03-13 09:23:46 +01:00
seccomp.h
sections.h s390/amode31: change type of __samode31, __eamode31, etc 2023-08-30 11:03:27 +02:00
set_memory.h s390/set_memory: add __set_memory() variant 2023-08-30 11:03:28 +02:00
setup.h s390: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
signal.h
sigp.h
smp.h s390/smp: Handle restart interrupt on ipl cpu 2024-07-23 16:02:31 +02:00
softirq_stack.h s390: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
sparsemem.h
spinlock.h s390/alternatives: Rework to allow for callbacks 2024-07-23 16:02:31 +02:00
spinlock_types.h
stacktrace.h s390/entry: Pass the asce as parameter to sie64a() 2024-07-10 19:50:45 +02:00
stp.h s390/stp: fix todoff size 2022-05-11 14:40:57 +02:00
string.h s390/string: add KMSAN support 2024-07-03 19:30:25 -07:00
syscall.h
syscall_wrapper.h posix-timers: Get rid of [COMPAT_]SYS_NI() uses 2023-12-20 21:30:27 -08:00
sysinfo.h s390/sysinfo: add variable capacity information 2023-11-22 14:07:28 +01:00
text-patching.h
thread_info.h s390/entry: Move SIE indicator flag to thread info 2024-07-23 16:02:31 +02:00
timex.h s390: Replace S390_lowcore by get_lowcore() 2024-06-18 17:01:33 +02:00
tlb.h mm/mmu_gather: add __tlb_remove_folio_pages() 2024-02-22 15:27:17 -08:00
tlbflush.h
topology.h
tpi.h KVM: s390: pci: enable host forwarding of Adapter Event Notifications 2022-07-11 09:54:29 +02:00
types.h
uaccess.h s390/uaccess: Make s390_kernel_write() usable for decompressor 2024-07-23 16:02:31 +02:00
unistd.h clone3: drop __ARCH_WANT_SYS_CLONE3 macro 2024-07-10 14:23:38 +02:00
unwind.h s390/kprobes: replace kretprobe with rethook 2023-01-22 18:42:35 +01:00
uprobes.h
user.h
uv.h s390/uv: Panic for set and remove shared access UVC errors 2024-08-07 11:04:43 +00:00
vdso-symbols.h s390/vdso: Move vdso symbol handling to separate header file 2024-09-13 17:28:36 +02:00
vdso.h s390/vdso: Move vdso symbol handling to separate header file 2024-09-13 17:28:36 +02:00
vmalloc.h
vmlinux.lds.h
vtime.h s390/vtime: Remove duplicate get_lowcore() calls 2024-06-18 17:01:33 +02:00
vtimer.h
word-at-a-time.h kernel.h: removed REPEAT_BYTE from kernel.h 2024-02-01 09:47:59 -08:00
xor.h