Commit 9bf39a65 authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Thomas Gleixner
Browse files

s390/vdso: Switch to generic storage implementation



The generic storage implementation provides the same features as the
custom one. However it can be shared between architectures, making
maintenance easier.

Co-developed-by: default avatarNam Cao <namcao@linutronix.de>
Signed-off-by: default avatarNam Cao <namcao@linutronix.de>
Signed-off-by: default avatarThomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Link: https://lore.kernel.org/all/20250204-vdso-store-rng-v3-12-13a4669dfc8c@linutronix.de
parent 31e9fa2b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ config S390
	select GENERIC_PTDUMP
	select GENERIC_SMP_IDLE_THREAD
	select GENERIC_TIME_VSYSCALL
	select GENERIC_VDSO_DATA_STORE
	select GENERIC_VDSO_TIME_NS
	select GENERIC_IOREMAP if PCI
	select HAVE_ALIGNED_STRUCT_PAGE
+1 −3
Original line number Diff line number Diff line
@@ -6,13 +6,11 @@

#ifndef __ASSEMBLY__

extern struct vdso_data *vdso_data;

int vdso_getcpu_init(void);

#endif /* __ASSEMBLY__ */

#define __VVAR_PAGES	2
#define __VDSO_PAGES	4

#define VDSO_VERSION_STRING	LINUX_2.6.29

+0 −12
Original line number Diff line number Diff line
@@ -23,18 +23,6 @@ static __always_inline ssize_t getrandom_syscall(void *buffer, size_t len, unsig
	return syscall3(__NR_getrandom, (long)buffer, (long)len, (long)flags);
}

static __always_inline const struct vdso_rng_data *__arch_get_vdso_rng_data(void)
{
	/*
	 * The RNG data is in the real VVAR data page, but if a task belongs to a time namespace
	 * then VVAR_DATA_PAGE_OFFSET points to the namespace-specific VVAR page and VVAR_TIMENS_
	 * PAGE_OFFSET points to the real VVAR page.
	 */
	if (IS_ENABLED(CONFIG_TIME_NS) && _vdso_data->clock_mode == VDSO_CLOCKMODE_TIMENS)
		return (void *)&_vdso_rng_data + VVAR_TIMENS_PAGE_OFFSET * PAGE_SIZE;
	return &_vdso_rng_data;
}

#endif /* !__ASSEMBLY__ */

#endif /* __ASM_VDSO_GETRANDOM_H */
+1 −14
Original line number Diff line number Diff line
@@ -14,12 +14,7 @@
#include <linux/compiler.h>


static __always_inline const struct vdso_data *__arch_get_vdso_data(void)
{
	return _vdso_data;
}

static inline u64 __arch_get_hw_counter(s32 clock_mode, const struct vdso_data *vd)
static inline u64 __arch_get_hw_counter(s32 clock_mode, const struct vdso_time_data *vd)
{
	u64 adj, now;

@@ -49,12 +44,4 @@ long clock_getres_fallback(clockid_t clkid, struct __kernel_timespec *ts)
	return syscall2(__NR_clock_getres, (long)clkid, (long)ts);
}

#ifdef CONFIG_TIME_NS
static __always_inline
const struct vdso_data *__arch_get_timens_vdso_data(const struct vdso_data *vd)
{
	return _timens_data;
}
#endif

#endif
+0 −20
Original line number Diff line number Diff line
@@ -2,32 +2,12 @@
#ifndef __ASM_VDSO_VSYSCALL_H
#define __ASM_VDSO_VSYSCALL_H

#define __VDSO_RND_DATA_OFFSET	768

#ifndef __ASSEMBLY__

#include <linux/hrtimer.h>
#include <vdso/datapage.h>
#include <asm/vdso.h>

enum vvar_pages {
	VVAR_DATA_PAGE_OFFSET,
	VVAR_TIMENS_PAGE_OFFSET,
	VVAR_NR_PAGES
};

static __always_inline struct vdso_data *__s390_get_k_vdso_data(void)
{
	return vdso_data;
}
#define __arch_get_k_vdso_data __s390_get_k_vdso_data

static __always_inline struct vdso_rng_data *__s390_get_k_vdso_rnd_data(void)
{
	return (void *)vdso_data + __VDSO_RND_DATA_OFFSET;
}
#define __arch_get_k_vdso_rng_data __s390_get_k_vdso_rnd_data

/* The asm-generic header needs to be included after the definitions above */
#include <asm-generic/vdso/vsyscall.h>

Loading