summaryrefslogtreecommitdiff
path: root/include/vdso
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>2025-02-04 13:05:39 +0100
committerThomas Gleixner <tglx@linutronix.de>2025-02-21 09:54:01 +0100
commit365841e1557ace6e8b4d5ba06a6cf53f699bc684 (patch)
treee224d903a601777f65478c93712aaade86c362ee /include/vdso
parent51d6ca373f459fa6c91743e14ae69854d844aa38 (diff)
vdso: Add generic architecture-specific data storage
Some architectures need to expose architecture-specific data to the vDSO. Enable the generic vDSO storage mechanism to both store and map this data. Some architectures require more than a single page, like LoongArch, so prepare for that usecase, too. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20250204-vdso-store-rng-v3-7-13a4669dfc8c@linutronix.de
Diffstat (limited to 'include/vdso')
-rw-r--r--include/vdso/datapage.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h
index 7dbc8797e3b8..46658b39c282 100644
--- a/include/vdso/datapage.h
+++ b/include/vdso/datapage.h
@@ -9,11 +9,13 @@
#include <uapi/linux/types.h>
#include <uapi/asm-generic/errno-base.h>
+#include <vdso/align.h>
#include <vdso/bits.h>
#include <vdso/clocksource.h>
#include <vdso/ktime.h>
#include <vdso/limits.h>
#include <vdso/math64.h>
+#include <vdso/page.h>
#include <vdso/processor.h>
#include <vdso/time.h>
#include <vdso/time32.h>
@@ -25,6 +27,15 @@
struct arch_vdso_time_data {};
#endif
+#if defined(CONFIG_ARCH_HAS_VDSO_ARCH_DATA)
+#include <asm/vdso/arch_data.h>
+#elif defined(CONFIG_GENERIC_VDSO_DATA_STORE)
+struct vdso_arch_data {
+ /* Needed for the generic code, never actually used at runtime */
+ char __unused;
+};
+#endif
+
#define VDSO_BASES (CLOCK_TAI + 1)
#define VDSO_HRES (BIT(CLOCK_REALTIME) | \
BIT(CLOCK_MONOTONIC) | \
@@ -145,9 +156,11 @@ extern struct vdso_rng_data _vdso_rng_data __attribute__((visibility("hidden")))
#else
extern struct vdso_time_data vdso_u_time_data[CS_BASES] __attribute__((visibility("hidden")));
extern struct vdso_rng_data vdso_u_rng_data __attribute__((visibility("hidden")));
+extern struct vdso_arch_data vdso_u_arch_data __attribute__((visibility("hidden")));
extern struct vdso_time_data *vdso_k_time_data;
extern struct vdso_rng_data *vdso_k_rng_data;
+extern struct vdso_arch_data *vdso_k_arch_data;
#endif
/**
@@ -160,10 +173,15 @@ union vdso_data_store {
#ifdef CONFIG_GENERIC_VDSO_DATA_STORE
+#define VDSO_ARCH_DATA_SIZE ALIGN(sizeof(struct vdso_arch_data), PAGE_SIZE)
+#define VDSO_ARCH_DATA_PAGES (VDSO_ARCH_DATA_SIZE >> PAGE_SHIFT)
+
enum vdso_pages {
VDSO_TIME_PAGE_OFFSET,
VDSO_TIMENS_PAGE_OFFSET,
VDSO_RNG_PAGE_OFFSET,
+ VDSO_ARCH_PAGES_START,
+ VDSO_ARCH_PAGES_END = VDSO_ARCH_PAGES_START + VDSO_ARCH_DATA_PAGES - 1,
VDSO_NR_PAGES
};
@@ -193,10 +211,17 @@ enum vdso_pages {
#define __vdso_u_rng_data
#endif
+#ifdef CONFIG_ARCH_HAS_VDSO_ARCH_DATA
+#define __vdso_u_arch_data PROVIDE(vdso_u_arch_data = vdso_u_data + 3 * PAGE_SIZE);
+#else
+#define __vdso_u_arch_data
+#endif
+
#define VDSO_VVAR_SYMS \
PROVIDE(vdso_u_data = . - __VDSO_PAGES * PAGE_SIZE); \
PROVIDE(vdso_u_time_data = vdso_u_data); \
__vdso_u_rng_data \
+ __vdso_u_arch_data \
#endif /* !__ASSEMBLY__ */