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  640
6 #define __VVAR_PAGES	4
7 
8 #define VDSO_NR_VCLOCK_PAGES	2
9 #define VDSO_VCLOCK_PAGES_START(_b)	((_b) + (__VVAR_PAGES - VDSO_NR_VCLOCK_PAGES) * PAGE_SIZE)
10 #define VDSO_PAGE_PVCLOCK_OFFSET	0
11 #define VDSO_PAGE_HVCLOCK_OFFSET	1
12 
13 #ifndef __ASSEMBLY__
14 
15 #include <vdso/datapage.h>
16 #include <asm/vgtod.h>
17 
18 extern struct vdso_data *vdso_data;
19 
20 /*
21  * Update the vDSO data page to keep in sync with kernel timekeeping.
22  */
23 static __always_inline
__x86_get_k_vdso_data(void)24 struct vdso_data *__x86_get_k_vdso_data(void)
25 {
26 	return vdso_data;
27 }
28 #define __arch_get_k_vdso_data __x86_get_k_vdso_data
29 
30 static __always_inline
__x86_get_k_vdso_rng_data(void)31 struct vdso_rng_data *__x86_get_k_vdso_rng_data(void)
32 {
33 	return (void *)vdso_data + __VDSO_RND_DATA_OFFSET;
34 }
35 #define __arch_get_k_vdso_rng_data __x86_get_k_vdso_rng_data
36 
37 /* The asm-generic header needs to be included after the definitions above */
38 #include <asm-generic/vdso/vsyscall.h>
39 
40 #endif /* !__ASSEMBLY__ */
41 
42 #endif /* __ASM_VDSO_VSYSCALL_H */
43