xref: /linux/arch/arm64/include/asm/vdso/vsyscall.h (revision a0efa2f362a69e47b9d8b48f770ef3a0249a7911)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_VDSO_VSYSCALL_H
3 #define __ASM_VDSO_VSYSCALL_H
4 
5 #define __VDSO_RND_DATA_OFFSET  480
6 
7 #ifndef __ASSEMBLY__
8 
9 #include <linux/timekeeper_internal.h>
10 #include <vdso/datapage.h>
11 
12 enum vvar_pages {
13 	VVAR_DATA_PAGE_OFFSET,
14 	VVAR_TIMENS_PAGE_OFFSET,
15 	VVAR_NR_PAGES,
16 };
17 
18 #define VDSO_PRECISION_MASK	~(0xFF00ULL<<48)
19 
20 extern struct vdso_data *vdso_data;
21 
22 /*
23  * Update the vDSO data page to keep in sync with kernel timekeeping.
24  */
25 static __always_inline
26 struct vdso_data *__arm64_get_k_vdso_data(void)
27 {
28 	return vdso_data;
29 }
30 #define __arch_get_k_vdso_data __arm64_get_k_vdso_data
31 
32 static __always_inline
33 struct vdso_rng_data *__arm64_get_k_vdso_rnd_data(void)
34 {
35 	return (void *)vdso_data + __VDSO_RND_DATA_OFFSET;
36 }
37 #define __arch_get_k_vdso_rng_data __arm64_get_k_vdso_rnd_data
38 
39 static __always_inline
40 void __arm64_update_vsyscall(struct vdso_data *vdata, struct timekeeper *tk)
41 {
42 	vdata[CS_HRES_COARSE].mask	= VDSO_PRECISION_MASK;
43 	vdata[CS_RAW].mask		= VDSO_PRECISION_MASK;
44 }
45 #define __arch_update_vsyscall __arm64_update_vsyscall
46 
47 /* The asm-generic header needs to be included after the definitions above */
48 #include <asm-generic/vdso/vsyscall.h>
49 
50 #endif /* !__ASSEMBLY__ */
51 
52 #endif /* __ASM_VDSO_VSYSCALL_H */
53