Message ID | 47500ae9aa628aead4c5b5a71d5279268cdddb48.1580399657.git.christophe.leroy@c-s.fr (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Paul Burton |
Headers | show |
Series | powerpc: switch VDSO to C implementation. | expand |
diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index 72d65dd50cb4..0b4b71880f22 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -120,12 +120,18 @@ static __always_inline int do_hres(const struct vdso_data *vd, clockid_t clk, cpu_relax(); } smp_rmb(); +#ifdef __arch_vdso_capable + if (unlikely(!__arch_vdso_capable(vd->clock_mode))) + return -1; +#endif cycles = __arch_get_hw_counter(vd->clock_mode); ns = vdso_ts->nsec; last = vd->cycle_last; +#ifndef __arch_vdso_capable if (unlikely((s64)cycles < 0)) return -1; +#endif ns += vdso_calc_delta(cycles, last, vd->mask, vd->mult); ns >>= vd->shift;
Some architectures have a fixed clocksource which is known at compile time and cannot be replaced or disabled at runtime, e.g. timebase on PowerPC. For such cases the clock mode check in the VDSO code is pointless. Therefore, give architectures the opportunity to redefine the way clock_mode is checked by moving the check into an __arch_vdso_capable() macro. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> --- lib/vdso/gettimeofday.c | 6 ++++++ 1 file changed, 6 insertions(+)