forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/arm64/include/asm/vdso/gettimeofday.h
....@@ -7,13 +7,10 @@
77
88 #ifndef __ASSEMBLY__
99
10
+#include <asm/barrier.h>
1011 #include <asm/unistd.h>
1112
12
-#define __VDSO_USE_SYSCALL ULLONG_MAX
13
-
1413 #define VDSO_HAS_CLOCK_GETRES 1
15
-
16
-#define VDSO_HAS_TIME 1
1714
1815 static __always_inline
1916 int gettimeofday_fallback(struct __kernel_old_timeval *_tv,
....@@ -67,16 +64,18 @@
6764 return ret;
6865 }
6966
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)
7169 {
7270 u64 res;
7371
7472 /*
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.
7776 */
78
- if (clock_mode)
79
- return __VDSO_USE_SYSCALL;
77
+ if (clock_mode == VDSO_CLOCKMODE_NONE)
78
+ return 0;
8079
8180 /*
8281 * This isb() is required to prevent that the counter value
....@@ -84,11 +83,7 @@
8483 */
8584 isb();
8685 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);
9287
9388 return res;
9489 }
....@@ -99,6 +94,14 @@
9994 return _vdso_data;
10095 }
10196
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
+
102105 #endif /* !__ASSEMBLY__ */
103106
104107 #endif /* __ASM_VDSO_GETTIMEOFDAY_H */