mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-15 06:55:13 +08:00
28b1a824a4
To take advantage of the commonly defined vdso interface for gettimeofday() the architectural code requires an adaptation. Re-implement the gettimeofday VDSO in C in order to use lib/vdso. With the new implementation arm64 gains support for CLOCK_BOOTTIME and CLOCK_TAI. [ tglx: Reformatted the function line breaks ] Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Shijith Thotton <sthotton@marvell.com> Tested-by: Andre Przywara <andre.przywara@arm.com> Cc: linux-arch@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mips@vger.kernel.org Cc: linux-kselftest@vger.kernel.org Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Russell King <linux@armlinux.org.uk> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Paul Burton <paul.burton@mips.com> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Mark Salyzyn <salyzyn@android.com> Cc: Peter Collingbourne <pcc@google.com> Cc: Shuah Khan <shuah@kernel.org> Cc: Dmitry Safonov <0x7f454c46@gmail.com> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Huw Davies <huw@codeweavers.com> Link: https://lkml.kernel.org/r/20190621095252.32307-5-vincenzo.frascino@arm.com
54 lines
1.3 KiB
C
54 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __ASM_VDSO_VSYSCALL_H
|
|
#define __ASM_VDSO_VSYSCALL_H
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/timekeeper_internal.h>
|
|
#include <vdso/datapage.h>
|
|
|
|
#define VDSO_PRECISION_MASK ~(0xFF00ULL<<48)
|
|
|
|
extern struct vdso_data *vdso_data;
|
|
|
|
/*
|
|
* Update the vDSO data page to keep in sync with kernel timekeeping.
|
|
*/
|
|
static __always_inline
|
|
struct vdso_data *__arm64_get_k_vdso_data(void)
|
|
{
|
|
return vdso_data;
|
|
}
|
|
#define __arch_get_k_vdso_data __arm64_get_k_vdso_data
|
|
|
|
static __always_inline
|
|
int __arm64_get_clock_mode(struct timekeeper *tk)
|
|
{
|
|
u32 use_syscall = !tk->tkr_mono.clock->archdata.vdso_direct;
|
|
|
|
return use_syscall;
|
|
}
|
|
#define __arch_get_clock_mode __arm64_get_clock_mode
|
|
|
|
static __always_inline
|
|
int __arm64_use_vsyscall(struct vdso_data *vdata)
|
|
{
|
|
return !vdata[CS_HRES_COARSE].clock_mode;
|
|
}
|
|
#define __arch_use_vsyscall __arm64_use_vsyscall
|
|
|
|
static __always_inline
|
|
void __arm64_update_vsyscall(struct vdso_data *vdata, struct timekeeper *tk)
|
|
{
|
|
vdata[CS_HRES_COARSE].mask = VDSO_PRECISION_MASK;
|
|
vdata[CS_RAW].mask = VDSO_PRECISION_MASK;
|
|
}
|
|
#define __arch_update_vsyscall __arm64_update_vsyscall
|
|
|
|
/* The asm-generic header needs to be included after the definitions above */
|
|
#include <asm-generic/vdso/vsyscall.h>
|
|
|
|
#endif /* !__ASSEMBLY__ */
|
|
|
|
#endif /* __ASM_VDSO_VSYSCALL_H */
|