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