vgtod.h (c4755613a1339ea77dbb15de75c9f74217209265) vgtod.h (ffebbaedc8616cffe648202e364dce6a045d65a2)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_VGTOD_H
3#define _ASM_X86_VGTOD_H
4
5#include <linux/compiler.h>
6#include <linux/clocksource.h>
7
8#ifdef BUILD_VDSO32_64

--- 63 unchanged lines hidden (view full) ---

72}
73
74static inline void gtod_write_end(struct vsyscall_gtod_data *s)
75{
76 smp_wmb();
77 ++s->seq;
78}
79
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_VGTOD_H
3#define _ASM_X86_VGTOD_H
4
5#include <linux/compiler.h>
6#include <linux/clocksource.h>
7
8#ifdef BUILD_VDSO32_64

--- 63 unchanged lines hidden (view full) ---

72}
73
74static inline void gtod_write_end(struct vsyscall_gtod_data *s)
75{
76 smp_wmb();
77 ++s->seq;
78}
79
80#ifdef CONFIG_X86_64
81
82#define VGETCPU_CPU_MASK 0xfff
83
84static inline unsigned int __getcpu(void)
85{
86 unsigned int p;
87
88 /*
89 * Load CPU (and node) number from GDT. LSL is faster than RDTSCP
90 * and works on all CPUs. This is volatile so that it orders
91 * correctly with respect to barrier() and to keep GCC from cleverly
92 * hoisting it out of the calling function.
93 *
94 * If RDPID is available, use it.
95 */
96 alternative_io ("lsl %[seg],%[p]",
97 ".byte 0xf3,0x0f,0xc7,0xf8", /* RDPID %eax/rax */
98 X86_FEATURE_RDPID,
99 [p] "=a" (p), [seg] "r" (__CPU_NUMBER_SEG));
100
101 return p;
102}
103
104#endif /* CONFIG_X86_64 */
105
106#endif /* _ASM_X86_VGTOD_H */
80#endif /* _ASM_X86_VGTOD_H */