hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/include/vdso/datapage.h
....@@ -5,7 +5,6 @@
55 #ifndef __ASSEMBLY__
66
77 #include <linux/compiler.h>
8
-#include <linux/compat_time.h>
98 #include <uapi/linux/time.h>
109 #include <uapi/linux/types.h>
1110 #include <uapi/asm-generic/errno-base.h>
....@@ -19,6 +18,12 @@
1918 #include <vdso/time.h>
2019 #include <vdso/time32.h>
2120 #include <vdso/time64.h>
21
+
22
+#ifdef CONFIG_ARCH_HAS_VDSO_DATA
23
+#include <asm/vdso/data.h>
24
+#else
25
+struct arch_vdso_data {};
26
+#endif
2227
2328 #define VDSO_BASES (CLOCK_TAI + 1)
2429 #define VDSO_HRES (BIT(CLOCK_REALTIME) | \
....@@ -60,13 +65,27 @@
6065 * @mult: clocksource multiplier
6166 * @shift: clocksource shift
6267 * @basetime[clock_id]: basetime per clock_id
68
+ * @offset[clock_id]: time namespace offset per clock_id
6369 * @tz_minuteswest: minutes west of Greenwich
6470 * @tz_dsttime: type of DST correction
6571 * @hrtimer_res: hrtimer resolution
6672 * @__unused: unused
73
+ * @arch_data: architecture specific data (optional, defaults
74
+ * to an empty struct)
6775 *
6876 * vdso_data will be accessed by 64 bit and compat code at the same time
6977 * so we should be careful before modifying this structure.
78
+ *
79
+ * @basetime is used to store the base time for the system wide time getter
80
+ * VVAR page.
81
+ *
82
+ * @offset is used by the special time namespace VVAR pages which are
83
+ * installed instead of the real VVAR page. These namespace pages must set
84
+ * @seq to 1 and @clock_mode to VDSO_CLOCKMODE_TIMENS to force the code into
85
+ * the time namespace slow path. The namespace aware functions retrieve the
86
+ * real system wide VVAR page, read host time and add the per clock offset.
87
+ * For clocks which are not affected by time namespace adjustment the
88
+ * offset must be zero.
7089 */
7190 struct vdso_data {
7291 u32 seq;
....@@ -77,12 +96,17 @@
7796 u32 mult;
7897 u32 shift;
7998
80
- struct vdso_timestamp basetime[VDSO_BASES];
99
+ union {
100
+ struct vdso_timestamp basetime[VDSO_BASES];
101
+ struct timens_offset offset[VDSO_BASES];
102
+ };
81103
82104 s32 tz_minuteswest;
83105 s32 tz_dsttime;
84106 u32 hrtimer_res;
85107 u32 __unused;
108
+
109
+ struct arch_vdso_data arch_data;
86110 };
87111
88112 /*
....@@ -95,6 +119,7 @@
95119 * relocation, and this is what we need.
96120 */
97121 extern struct vdso_data _vdso_data[CS_BASES] __attribute__((visibility("hidden")));
122
+extern struct vdso_data _timens_data[CS_BASES] __attribute__((visibility("hidden")));
98123
99124 /*
100125 * The generic vDSO implementation requires that gettimeofday.h