| .. | .. |
|---|
| 7 | 7 | |
|---|
| 8 | 8 | #ifndef __ASSEMBLY__ |
|---|
| 9 | 9 | |
|---|
| 10 | +#include <asm/barrier.h> |
|---|
| 10 | 11 | #include <asm/unistd.h> |
|---|
| 11 | 12 | |
|---|
| 12 | | -#define __VDSO_USE_SYSCALL ULLONG_MAX |
|---|
| 13 | | - |
|---|
| 14 | 13 | #define VDSO_HAS_CLOCK_GETRES 1 |
|---|
| 15 | | - |
|---|
| 16 | | -#define VDSO_HAS_TIME 1 |
|---|
| 17 | 14 | |
|---|
| 18 | 15 | static __always_inline |
|---|
| 19 | 16 | int gettimeofday_fallback(struct __kernel_old_timeval *_tv, |
|---|
| .. | .. |
|---|
| 67 | 64 | return ret; |
|---|
| 68 | 65 | } |
|---|
| 69 | 66 | |
|---|
| 70 | | -static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) |
|---|
| 67 | +static __always_inline u64 __arch_get_hw_counter(s32 clock_mode, |
|---|
| 68 | + const struct vdso_data *vd) |
|---|
| 71 | 69 | { |
|---|
| 72 | 70 | u64 res; |
|---|
| 73 | 71 | |
|---|
| 74 | 72 | /* |
|---|
| 75 | | - * clock_mode == 0 implies that vDSO are enabled otherwise |
|---|
| 76 | | - * fallback on syscall. |
|---|
| 73 | + * Core checks for mode already, so this raced against a concurrent |
|---|
| 74 | + * update. Return something. Core will do another round and then |
|---|
| 75 | + * see the mode change and fallback to the syscall. |
|---|
| 77 | 76 | */ |
|---|
| 78 | | - if (clock_mode) |
|---|
| 79 | | - return __VDSO_USE_SYSCALL; |
|---|
| 77 | + if (clock_mode == VDSO_CLOCKMODE_NONE) |
|---|
| 78 | + return 0; |
|---|
| 80 | 79 | |
|---|
| 81 | 80 | /* |
|---|
| 82 | 81 | * This isb() is required to prevent that the counter value |
|---|
| .. | .. |
|---|
| 84 | 83 | */ |
|---|
| 85 | 84 | isb(); |
|---|
| 86 | 85 | asm volatile("mrs %0, cntvct_el0" : "=r" (res) :: "memory"); |
|---|
| 87 | | - /* |
|---|
| 88 | | - * This isb() is required to prevent that the seq lock is |
|---|
| 89 | | - * speculated.# |
|---|
| 90 | | - */ |
|---|
| 91 | | - isb(); |
|---|
| 86 | + arch_counter_enforce_ordering(res); |
|---|
| 92 | 87 | |
|---|
| 93 | 88 | return res; |
|---|
| 94 | 89 | } |
|---|
| .. | .. |
|---|
| 99 | 94 | return _vdso_data; |
|---|
| 100 | 95 | } |
|---|
| 101 | 96 | |
|---|
| 97 | +#ifdef CONFIG_TIME_NS |
|---|
| 98 | +static __always_inline |
|---|
| 99 | +const struct vdso_data *__arch_get_timens_vdso_data(void) |
|---|
| 100 | +{ |
|---|
| 101 | + return _timens_data; |
|---|
| 102 | +} |
|---|
| 103 | +#endif |
|---|
| 104 | + |
|---|
| 102 | 105 | #endif /* !__ASSEMBLY__ */ |
|---|
| 103 | 106 | |
|---|
| 104 | 107 | #endif /* __ASM_VDSO_GETTIMEOFDAY_H */ |
|---|