Commit 46fe55b2 authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Thomas Gleixner
Browse files

riscv: 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>
Link: https://lore.kernel.org/all/20250204-vdso-store-rng-v3-9-13a4669dfc8c@linutronix.de
parent 0b3bc335
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ config RISCV
	select ARCH_HAS_SYSCALL_WRAPPER
	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
	select ARCH_HAS_UBSAN
	select ARCH_HAS_VDSO_TIME_DATA
	select ARCH_HAS_VDSO_ARCH_DATA if GENERIC_VDSO_DATA_STORE
	select ARCH_KEEP_MEMBLOCK if ACPI
	select ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE	if 64BIT && MMU
	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
@@ -116,6 +116,7 @@ config RISCV
	select GENERIC_SCHED_CLOCK
	select GENERIC_SMP_IDLE_THREAD
	select GENERIC_TIME_VSYSCALL if MMU && 64BIT
	select GENERIC_VDSO_DATA_STORE if MMU
	select GENERIC_VDSO_TIME_NS if HAVE_GENERIC_VDSO
	select HARDIRQS_SW_RESEND
	select HAS_IOPORT if MMU
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 */
#ifdef CONFIG_MMU

#define __VVAR_PAGES    2
#define __VDSO_PAGES    4

#ifndef __ASSEMBLY__
#include <generated/vdso-offsets.h>
+4 −4
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __RISCV_ASM_VDSO_TIME_DATA_H
#define __RISCV_ASM_VDSO_TIME_DATA_H
#ifndef __RISCV_ASM_VDSO_ARCH_DATA_H
#define __RISCV_ASM_VDSO_ARCH_DATA_H

#include <linux/types.h>
#include <vdso/datapage.h>
#include <asm/hwprobe.h>

struct arch_vdso_time_data {
struct vdso_arch_data {
	/* Stash static answers to the hwprobe queries when all CPUs are selected. */
	__u64 all_cpu_hwprobe_values[RISCV_HWPROBE_MAX_KEY + 1];

@@ -14,4 +14,4 @@ struct arch_vdso_time_data {
	__u8 homogeneous_cpus;
};

#endif /* __RISCV_ASM_VDSO_TIME_DATA_H */
#endif /* __RISCV_ASM_VDSO_ARCH_DATA_H */
+1 −13
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ int clock_getres_fallback(clockid_t _clkid, struct __kernel_timespec *_ts)
#endif /* CONFIG_GENERIC_TIME_VSYSCALL */

static __always_inline u64 __arch_get_hw_counter(s32 clock_mode,
						 const struct vdso_data *vd)
						 const struct vdso_time_data *vd)
{
	/*
	 * The purpose of csr_read(CSR_TIME) is to trap the system into
@@ -79,18 +79,6 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode,
	return csr_read(CSR_TIME);
}

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

#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 /* !__ASSEMBLY__ */

#endif /* __ASM_VDSO_GETTIMEOFDAY_H */
+0 −9
Original line number Diff line number Diff line
@@ -6,15 +6,6 @@

#include <vdso/datapage.h>

extern struct vdso_data *vdso_data;

static __always_inline struct vdso_data *__riscv_get_k_vdso_data(void)
{
	return vdso_data;
}

#define __arch_get_k_vdso_data __riscv_get_k_vdso_data

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

Loading