mm: make wait_on_page_writeback() wait for multiple pending writebacks
[linux/fpc-iii.git] / arch / s390 / include / asm / vdso / gettimeofday.h
blobbf123065ad3b841ffb86d28ac128bd37f8733094
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef ASM_VDSO_GETTIMEOFDAY_H
3 #define ASM_VDSO_GETTIMEOFDAY_H
5 #define VDSO_HAS_TIME 1
7 #define VDSO_HAS_CLOCK_GETRES 1
9 #include <asm/timex.h>
10 #include <asm/unistd.h>
11 #include <asm/vdso.h>
12 #include <linux/compiler.h>
14 #define vdso_calc_delta __arch_vdso_calc_delta
15 static __always_inline u64 __arch_vdso_calc_delta(u64 cycles, u64 last, u64 mask, u32 mult)
17 return (cycles - last) * mult;
20 static __always_inline const struct vdso_data *__arch_get_vdso_data(void)
22 return _vdso_data;
25 static inline u64 __arch_get_hw_counter(s32 clock_mode, const struct vdso_data *vd)
27 const struct vdso_data *vdso = __arch_get_vdso_data();
28 u64 adj, now;
30 now = get_tod_clock();
31 adj = vdso->arch_data.tod_steering_end - now;
32 if (unlikely((s64) adj > 0))
33 now += (vdso->arch_data.tod_steering_delta < 0) ? (adj >> 15) : -(adj >> 15);
34 return now;
37 static __always_inline
38 long clock_gettime_fallback(clockid_t clkid, struct __kernel_timespec *ts)
40 register unsigned long r1 __asm__("r1") = __NR_clock_gettime;
41 register unsigned long r2 __asm__("r2") = (unsigned long)clkid;
42 register void *r3 __asm__("r3") = ts;
44 asm ("svc 0\n" : "+d" (r2) : "d" (r1), "d" (r3) : "cc", "memory");
45 return r2;
48 static __always_inline
49 long gettimeofday_fallback(register struct __kernel_old_timeval *tv,
50 register struct timezone *tz)
52 register unsigned long r1 __asm__("r1") = __NR_gettimeofday;
53 register unsigned long r2 __asm__("r2") = (unsigned long)tv;
54 register void *r3 __asm__("r3") = tz;
56 asm ("svc 0\n" : "+d" (r2) : "d" (r1), "d" (r3) : "cc", "memory");
57 return r2;
60 static __always_inline
61 long clock_getres_fallback(clockid_t clkid, struct __kernel_timespec *ts)
63 register unsigned long r1 __asm__("r1") = __NR_clock_getres;
64 register unsigned long r2 __asm__("r2") = (unsigned long)clkid;
65 register void *r3 __asm__("r3") = ts;
67 asm ("svc 0\n" : "+d" (r2) : "d" (r1), "d" (r3) : "cc", "memory");
68 return r2;
71 #endif