get_clock_shifted_nsec macro in vdso/gettimeofday.S has another place where the size of clocksource precision is hardcoded. Use ARCH_TIMER_NBITS to generate mask value.
Signed-off-by: Pavel Tatashin <[email protected]> --- arch/arm64/kernel/asm-offsets.c | 1 + arch/arm64/kernel/vdso/gettimeofday.S | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index 65b8afc84466..32e1b935dd6c 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -107,6 +107,7 @@ int main(void) DEFINE(CLOCK_MONOTONIC_COARSE,CLOCK_MONOTONIC_COARSE); DEFINE(CLOCK_COARSE_RES, LOW_RES_NSEC); DEFINE(NSEC_PER_SEC, NSEC_PER_SEC); + DEFINE(CLOCKSOURCE_MASK, CLOCKSOURCE_MASK(ARCH_TIMER_NBITS)); BLANK(); DEFINE(VDSO_CS_CYCLE_LAST, offsetof(struct vdso_data, cs_cycle_last)); DEFINE(VDSO_RAW_TIME_SEC, offsetof(struct vdso_data, raw_time_sec)); diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S index c39872a7b03c..5a7580d0118e 100644 --- a/arch/arm64/kernel/vdso/gettimeofday.S +++ b/arch/arm64/kernel/vdso/gettimeofday.S @@ -69,8 +69,7 @@ x_tmp .req x8 mrs x_tmp, cntvct_el0 /* Calculate cycle delta and convert to ns. */ sub \res, x_tmp, \cycle_last - /* We can only guarantee 56 bits of precision. */ - movn x_tmp, #0xff00, lsl #48 + mov x_tmp, #CLOCKSOURCE_MASK and \res, x_tmp, \res mul \res, \res, \mult .endm -- 2.20.1

