xref: /openbmc/linux/arch/x86/include/asm/clocksource.h (revision 5d51bee7)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* x86-specific clocksource additions */
3 
4 #ifndef _ASM_X86_CLOCKSOURCE_H
5 #define _ASM_X86_CLOCKSOURCE_H
6 
7 #define VCLOCK_NONE	0	/* No vDSO clock available.		*/
8 #define VCLOCK_TSC	1	/* vDSO should use vread_tsc.		*/
9 #define VCLOCK_PVCLOCK	2	/* vDSO should use vread_pvclock.	*/
10 #define VCLOCK_HVCLOCK	3	/* vDSO should use vread_hvclock.	*/
11 #define VCLOCK_MAX	3
12 
13 struct arch_clocksource_data {
14 	int vclock_mode;
15 };
16 
17 extern unsigned int vclocks_used;
18 
19 static inline bool vclock_was_used(int vclock)
20 {
21 	return READ_ONCE(vclocks_used) & (1U << vclock);
22 }
23 
24 static inline void vclocks_set_used(unsigned int which)
25 {
26 	WRITE_ONCE(vclocks_used, READ_ONCE(vclocks_used) | (1 << which));
27 }
28 
29 #endif /* _ASM_X86_CLOCKSOURCE_H */
30