From nobody Mon Sep 28 21:09:55 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0641C3FF1B9 for ; Mon, 17 Aug 2026 11:23:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786965839; cv=none; b=nMVPqsJHc1ycmkkRwTXzdGGOF4VW6NwA7tWQCaEXK/8uQs9nPnXDIh8Uj4nWD5t5qhjTVfM56c9H1xNjK2VRQB/Kr5GiIZ6F+CRo+j0t4Z4v3gzps3plu6UgB2Fq2MQZOkN5Ofr8fc9g74gegvbeMFD3s2Mxt/8B+fwgH9x1lNA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786965839; c=relaxed/simple; bh=w/tD9/jfRBp49UngMgbAHL/2lTxliFflFayrxE3blyc=; h=Date:From:To:Cc:Subject:References:Message-ID:Content-Type: MIME-Version; b=snSo05eixbXepLU3h7sg2wpFH+PsrzE/SAJ78FBIq/VLeYI2b5JCd1jZNpNSSxS0ebJE4TvDWdhGY5x3Ujmz6zjhxMf6hmSTTzdysp3yuNXgZnJU9/yFonSgJLIzXXktw7p+biUHr3DunzDi/Yj4KJt4ZMg2Us6TljGU7zg10uw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ms9mOlft; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ms9mOlft" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1EFC1F000E9; Mon, 17 Aug 2026 11:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1786965835; bh=Im7QBSzuQBC5Yelk5FN8SAb50hhT7TAQWlyAK3BTlb0=; h=Date:From:To:Cc:Subject:References; b=Ms9mOlftfT6+iYHdzO6u6mZwfNMOLoccpidEx2VqwlBWF/1p1aoakp6FYX8DdkoYK aGNFXB4aB/MakZ9szcqc2c9Qmc6V04OVE1LqiDkLuGkeRDz5h3JcqzTG2vDLlCULUE b1PdOHc5Jul52tf9MeiRU2+BY5AK0tA9FKMcpvOAaOh429Us543KoT2QDLorkVTjnJ wfAIc8XbE35OZbcB/VjkcwjWgjJE/vtR25GGuGH8vwUThxJBa24MjuQ6pLNuWx+v2n 3lSwq8Gwr6WV3YuwBbSl6v3kSK4YuSBHhjPO4jWyw1ei2QIty3I2ecUomQq6WClxCm q3ZrK+YQE8Mfg== Date: Mon, 17 Aug 2026 13:23:52 +0200 From: Thomas Gleixner To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, x86@kernel.org Subject: [GIT pull] timers/cleanups for v7.3-rc1 References: <178696575118.1270771.17154447195623102039.tglx@fw13> Message-ID: <178696575847.1270771.17330908414715876847.tglx@fw13> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Linus, please pull the latest timers/cleanups branch from: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-cleanup= s-2026-08-17 up to: dfc256dac54c: calibrate: Rework delay timer calibration Treewide timer related cleanups: - Remove the leftover CLOCK_TICK_RATE which has been scheduled for removal more than a decade ago along with some now empty asm/timex.h files. - Consolidate delay timer calibration The construct of having a define in a header requires that architectures provided asm/timex.h for no reason. Also the function name for reading the delay timer is confusing at best. Use a config switch to enable that functionality and rename the function to delay_read_timer() to make the purpose clear. This removes some more now empty asm/timex.h files as well. Thanks, tglx ------------------> Thomas Gleixner (3): x86: Use PIT_TICK_RATE instead of CLOCK_TICK_RATE treewide: Remove CLOCK_TICK_RATE calibrate: Rework delay timer calibration arch/Kconfig | 3 +++ arch/alpha/include/asm/timex.h | 4 ---- arch/arc/include/asm/timex.h | 15 --------------- arch/arm/Kconfig | 1 + arch/arm/include/asm/delay.h | 1 - arch/arm/include/asm/timex.h | 5 ++++- arch/arm/lib/delay.c | 10 ++++------ arch/arm/mach-omap1/Kconfig | 2 +- arch/hexagon/Kconfig | 1 + arch/hexagon/include/asm/timex.h | 23 ----------------------- arch/hexagon/kernel/time.c | 8 +++++++- arch/m68k/include/asm/timex.h | 15 --------------- arch/microblaze/include/asm/timex.h | 13 ------------- arch/mips/include/asm/timex.h | 8 -------- arch/openrisc/Kconfig | 1 + arch/openrisc/include/asm/timex.h | 5 ----- arch/openrisc/lib/delay.c | 9 ++++----- arch/parisc/include/asm/timex.h | 2 -- arch/powerpc/include/asm/timex.h | 2 -- arch/riscv/Kconfig | 1 + arch/riscv/include/asm/timex.h | 8 -------- arch/riscv/lib/delay.c | 7 ++++++- arch/s390/include/asm/timex.h | 2 -- arch/sh/include/asm/timex.h | 24 ------------------------ arch/sparc/Kconfig | 1 + arch/sparc/include/asm/timex.h | 2 +- arch/sparc/include/asm/timex_32.h | 14 -------------- arch/sparc/include/asm/timex_64.h | 4 ---- arch/sparc/kernel/time_64.c | 4 ++-- arch/um/include/asm/timex.h | 9 --------- arch/x86/Kconfig | 1 + arch/x86/include/asm/timex.h | 5 ----- arch/x86/kernel/setup.c | 2 +- arch/x86/lib/delay.c | 8 +++----- include/asm-generic/timex.h | 7 ------- include/linux/delay.h | 2 ++ include/linux/timex.h | 2 -- init/calibrate.c | 19 +++++++++---------- 38 files changed, 53 insertions(+), 197 deletions(-) delete mode 100644 arch/arc/include/asm/timex.h delete mode 100644 arch/hexagon/include/asm/timex.h delete mode 100644 arch/microblaze/include/asm/timex.h delete mode 100644 arch/sh/include/asm/timex.h delete mode 100644 arch/sparc/include/asm/timex_32.h delete mode 100644 arch/um/include/asm/timex.h diff --git a/arch/Kconfig b/arch/Kconfig index fa7507ac8e13..3d8550b12312 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -363,6 +363,9 @@ config ARCH_HAS_DMA_CLEAR_UNCACHED config ARCH_HAS_CPU_FINALIZE_INIT bool =20 +config ARCH_HAS_DELAY_TIMER + bool + # The architecture has a per-task state that includes the mm's PASID config ARCH_HAS_CPU_PASID bool diff --git a/arch/alpha/include/asm/timex.h b/arch/alpha/include/asm/timex.h index f89798da8a14..5a71ba6136b9 100644 --- a/arch/alpha/include/asm/timex.h +++ b/arch/alpha/include/asm/timex.h @@ -7,10 +7,6 @@ #ifndef _ASMALPHA_TIMEX_H #define _ASMALPHA_TIMEX_H =20 -/* With only one or two oddballs, we use the RTC as the ticker, selecting - the 32.768kHz reference clock, which nicely divides down to our HZ. */ -#define CLOCK_TICK_RATE 32768 - /* * Standard way to access the cycle counter. * Currently only used on SMP for scheduling. diff --git a/arch/arc/include/asm/timex.h b/arch/arc/include/asm/timex.h deleted file mode 100644 index 48b3482bc97f..000000000000 --- a/arch/arc/include/asm/timex.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.c= om) - */ - -#ifndef _ASM_ARC_TIMEX_H -#define _ASM_ARC_TIMEX_H - -#define CLOCK_TICK_RATE 80000000 /* slated to be removed */ - -#include - -/* XXX: get_cycles() to be implemented with RTSC insn */ - -#endif /* _ASM_ARC_TIMEX_H */ diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 9187240a02db..7788949992f4 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -11,6 +11,7 @@ config ARM select ARCH_HAS_CPU_FINALIZE_INIT if MMU select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL if MMU + select ARCH_HAS_DELAY_TIMER select ARCH_HAS_DMA_ALLOC if MMU select ARCH_HAS_DMA_OPS select ARCH_HAS_DMA_WRITE_COMBINE if !ARM_DMA_MEM_BUFFERABLE diff --git a/arch/arm/include/asm/delay.h b/arch/arm/include/asm/delay.h index 1d069e558d8d..d2231deb90fa 100644 --- a/arch/arm/include/asm/delay.h +++ b/arch/arm/include/asm/delay.h @@ -91,7 +91,6 @@ extern void __loop_udelay(unsigned long usecs); extern void __loop_const_udelay(unsigned long); =20 /* Delay-loop timer registration. */ -#define ARCH_HAS_READ_CURRENT_TIMER extern void register_current_timer_delay(const struct delay_timer *timer); =20 #endif /* __ASSEMBLY__ */ diff --git a/arch/arm/include/asm/timex.h b/arch/arm/include/asm/timex.h index 6d1337c169cd..94e40c19cfc5 100644 --- a/arch/arm/include/asm/timex.h +++ b/arch/arm/include/asm/timex.h @@ -10,7 +10,10 @@ #define _ASMARM_TIMEX_H =20 typedef unsigned long cycles_t; -#define get_cycles() ({ cycles_t c; read_current_timer(&c) ? 0 : c; }) +// Temporary workaround until timex.h is cleaned up +bool delay_read_timer(unsigned long *t); + +#define get_cycles() ({ cycles_t c; delay_read_timer(&c) ? 0 : c; }) #define random_get_entropy() (((unsigned long)get_cycles()) ?: random_get_= entropy_fallback()) =20 #endif diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c index b7fe84f68bf1..7e9304012a68 100644 --- a/arch/arm/lib/delay.c +++ b/arch/arm/lib/delay.c @@ -12,7 +12,6 @@ #include #include #include -#include =20 /* * Default to the loop-based delay implementation. @@ -27,15 +26,14 @@ static const struct delay_timer *delay_timer; static bool delay_calibrated; static u64 delay_res; =20 -int read_current_timer(unsigned long *timer_val) +bool delay_read_timer(unsigned long *timer_val) { if (!delay_timer) - return -ENXIO; - + return false; *timer_val =3D delay_timer->read_current_timer(); - return 0; + return true; } -EXPORT_SYMBOL_GPL(read_current_timer); +EXPORT_SYMBOL_GPL(delay_read_timer); =20 static inline u64 cyc_to_ns(u64 cyc, u32 mult, u32 shift) { diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig index b114f7ca2173..2a724aa6674c 100644 --- a/arch/arm/mach-omap1/Kconfig +++ b/arch/arm/mach-omap1/Kconfig @@ -74,7 +74,7 @@ config OMAP_32K_TIMER currently only available for OMAP16XX, 24XX, 34XX, OMAP4/5 and DRA7XX. =20 On OMAP2PLUS this value is only used for CONFIG_HZ and - CLOCK_TICK_RATE compile time calculation. + timer frequency compile time calculation. The actual timer selection is done in the board file through the (DT_)MACHINE_START structure. =20 diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig index d987ba368ed6..b48491140013 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig @@ -5,6 +5,7 @@ comment "Linux Kernel Configuration for Hexagon" config HEXAGON def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_DELAY_TIMER select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_NO_PREEMPT select ARCH_WANT_FRAME_POINTERS diff --git a/arch/hexagon/include/asm/timex.h b/arch/hexagon/include/asm/ti= mex.h deleted file mode 100644 index dfe69e118b2b..000000000000 --- a/arch/hexagon/include/asm/timex.h +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. - */ - -#ifndef _ASM_TIMEX_H -#define _ASM_TIMEX_H - -#include -#include - -/* Using TCX0 as our clock. CLOCK_TICK_RATE scheduled to be removed. */ -#define CLOCK_TICK_RATE 19200 - -#define ARCH_HAS_READ_CURRENT_TIMER - -static inline int read_current_timer(unsigned long *timer_val) -{ - *timer_val =3D __vmgettime(); - return 0; -} - -#endif diff --git a/arch/hexagon/kernel/time.c b/arch/hexagon/kernel/time.c index 6f851e1cd4ee..05c5d6c96d96 100644 --- a/arch/hexagon/kernel/time.c +++ b/arch/hexagon/kernel/time.c @@ -6,6 +6,7 @@ */ =20 #include +#include #include #include #include @@ -17,7 +18,6 @@ #include #include =20 -#include #include #include =20 @@ -231,3 +231,9 @@ void __udelay(unsigned long usecs) cpu_relax(); /* not sure how this improves readability */ } EXPORT_SYMBOL(__udelay); + +bool delay_read_timer(unsigned long *timer_val) +{ + *timer_val =3D __vmgettime(); + return true; +} diff --git a/arch/m68k/include/asm/timex.h b/arch/m68k/include/asm/timex.h index f4a7a340f4ca..b58115f3a282 100644 --- a/arch/m68k/include/asm/timex.h +++ b/arch/m68k/include/asm/timex.h @@ -7,21 +7,6 @@ #ifndef _ASMm68K_TIMEX_H #define _ASMm68K_TIMEX_H =20 -#ifdef CONFIG_COLDFIRE -/* - * CLOCK_TICK_RATE should give the underlying frequency of the tick timer - * to make ntp work best. For Coldfires, that's the main clock. - */ -#include -#define CLOCK_TICK_RATE MCF_CLK -#else -/* - * This default CLOCK_TICK_RATE is probably wrong for many 68k boards - * Users of those boards will need to check and modify accordingly - */ -#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ -#endif - typedef unsigned long cycles_t; =20 static inline cycles_t get_cycles(void) diff --git a/arch/microblaze/include/asm/timex.h b/arch/microblaze/include/= asm/timex.h deleted file mode 100644 index e99cc29cbe57..000000000000 --- a/arch/microblaze/include/asm/timex.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2006 Atmark Techno, Inc. - */ - -#ifndef _ASM_MICROBLAZE_TIMEX_H -#define _ASM_MICROBLAZE_TIMEX_H - -#include - -#define CLOCK_TICK_RATE 1000 /* Timer input freq. */ - -#endif /* _ASM_TIMEX_H */ diff --git a/arch/mips/include/asm/timex.h b/arch/mips/include/asm/timex.h index 7ef06dcdc46e..daedc62f0fb8 100644 --- a/arch/mips/include/asm/timex.h +++ b/arch/mips/include/asm/timex.h @@ -18,14 +18,6 @@ #include #include =20 -/* - * This is the clock rate of the i8253 PIT. A MIPS system may not have - * a PIT by the symbol is used all over the kernel including some APIs. - * So keeping it defined to the number for the PIT is the only sane thing - * for now. - */ -#define CLOCK_TICK_RATE 1193182 - /* * Standard way to access the cycle counter. * Currently only used on SMP for scheduling. diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index 9156635dd264..5eb995c13074 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig @@ -7,6 +7,7 @@ config OPENRISC def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_DELAY_TIMER select ARCH_HAS_DMA_SET_UNCACHED select ARCH_HAS_DMA_CLEAR_UNCACHED select ARCH_HAS_SYNC_DMA_FOR_DEVICE diff --git a/arch/openrisc/include/asm/timex.h b/arch/openrisc/include/asm/= timex.h index 5487fa93dd9b..574e80e6d1f3 100644 --- a/arch/openrisc/include/asm/timex.h +++ b/arch/openrisc/include/asm/timex.h @@ -25,9 +25,4 @@ static inline cycles_t get_cycles(void) } #define get_cycles get_cycles =20 -/* This isn't really used any more */ -#define CLOCK_TICK_RATE 1000 - -#define ARCH_HAS_READ_CURRENT_TIMER - #endif diff --git a/arch/openrisc/lib/delay.c b/arch/openrisc/lib/delay.c index 5e89e4131304..661f9f8f6292 100644 --- a/arch/openrisc/lib/delay.c +++ b/arch/openrisc/lib/delay.c @@ -13,18 +13,17 @@ */ =20 #include +#include #include #include -#include + #include -#include -#include #include =20 -int read_current_timer(unsigned long *timer_value) +bool delay_read_timer(unsigned long *timer_value) { *timer_value =3D get_cycles(); - return 0; + return true; } =20 void __delay(unsigned long cycles) diff --git a/arch/parisc/include/asm/timex.h b/arch/parisc/include/asm/time= x.h index b4622cb06a75..453468ba4e3a 100644 --- a/arch/parisc/include/asm/timex.h +++ b/arch/parisc/include/asm/timex.h @@ -9,8 +9,6 @@ =20 #include =20 -#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ - typedef unsigned long cycles_t; =20 static inline cycles_t get_cycles(void) diff --git a/arch/powerpc/include/asm/timex.h b/arch/powerpc/include/asm/ti= mex.h index 14b4489de52c..b48b78e47958 100644 --- a/arch/powerpc/include/asm/timex.h +++ b/arch/powerpc/include/asm/timex.h @@ -11,8 +11,6 @@ #include #include =20 -#define CLOCK_TICK_RATE 1024000 /* Underlying HZ */ - typedef unsigned long cycles_t; =20 static inline cycles_t get_cycles(void) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index c0a6992933e4..a0635743cf8f 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -29,6 +29,7 @@ config RISCV select ARCH_HAS_DEBUG_VIRTUAL if MMU select ARCH_HAS_DEBUG_VM_PGTABLE select ARCH_HAS_DEBUG_WX + select ARCH_HAS_DELAY_TIMER select ARCH_HAS_ELF_CORE_EFLAGS if BINFMT_ELF && ELF_CORE select ARCH_HAS_FAST_MULTIPLIER select ARCH_HAS_FORTIFY_SOURCE diff --git a/arch/riscv/include/asm/timex.h b/arch/riscv/include/asm/timex.h index a06697846e69..76c9417fdba3 100644 --- a/arch/riscv/include/asm/timex.h +++ b/arch/riscv/include/asm/timex.h @@ -80,12 +80,4 @@ static inline u64 get_cycles64(void) return ((u64)hi << 32) | lo; } #endif /* CONFIG_64BIT */ - -#define ARCH_HAS_READ_CURRENT_TIMER -static inline int read_current_timer(unsigned long *timer_val) -{ - *timer_val =3D get_cycles(); - return 0; -} - #endif /* _ASM_RISCV_TIMEX_H */ diff --git a/arch/riscv/lib/delay.c b/arch/riscv/lib/delay.c index 49d510ba75fd..bd9b3825656f 100644 --- a/arch/riscv/lib/delay.c +++ b/arch/riscv/lib/delay.c @@ -6,7 +6,6 @@ #include #include #include -#include #include #include =20 @@ -109,3 +108,9 @@ void ndelay(unsigned long nsecs) __delay(ncycles >> NDELAY_SHIFT); } EXPORT_SYMBOL(ndelay); + +bool delay_read_timer(unsigned long *timer_val) +{ + *timer_val =3D get_cycles(); + return true; +} diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h index ac3ab6c29912..23421b6eb225 100644 --- a/arch/s390/include/asm/timex.h +++ b/arch/s390/include/asm/timex.h @@ -159,8 +159,6 @@ static inline void local_tick_enable(unsigned long comp) set_clock_comparator(get_lowcore()->clock_comparator); } =20 -#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ - typedef unsigned long cycles_t; =20 static __always_inline unsigned long get_tod_clock(void) diff --git a/arch/sh/include/asm/timex.h b/arch/sh/include/asm/timex.h deleted file mode 100644 index f53f95bf4288..000000000000 --- a/arch/sh/include/asm/timex.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/include/asm-sh/timex.h - * - * sh architecture timex specifications - */ -#ifndef __ASM_SH_TIMEX_H -#define __ASM_SH_TIMEX_H - -/* - * Only parts using the legacy CPG code for their clock framework - * implementation need to define their own Pclk value. If provided, this - * can be used for accurately setting CLOCK_TICK_RATE, otherwise we - * simply fall back on the i8253 PIT value. - */ -#ifdef CONFIG_SH_PCLK_FREQ -#define CLOCK_TICK_RATE (CONFIG_SH_PCLK_FREQ / 4) /* Underlying HZ */ -#else -#define CLOCK_TICK_RATE 1193180 -#endif - -#include - -#endif /* __ASM_SH_TIMEX_H */ diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 0e9c906c4b5d..a979a4be79a9 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -70,6 +70,7 @@ config SPARC32 config SPARC64 def_bool 64BIT select ALTERNATE_USER_ADDRESS_SPACE + select ARCH_HAS_DELAY_TIMER select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_GRAPH_TRACER select HAVE_KRETPROBES diff --git a/arch/sparc/include/asm/timex.h b/arch/sparc/include/asm/timex.h index 9aac26b1f45f..f0f980581590 100644 --- a/arch/sparc/include/asm/timex.h +++ b/arch/sparc/include/asm/timex.h @@ -4,6 +4,6 @@ #if defined(__sparc__) && defined(__arch64__) #include #else -#include +#include #endif #endif diff --git a/arch/sparc/include/asm/timex_32.h b/arch/sparc/include/asm/tim= ex_32.h deleted file mode 100644 index f86326a6f89e..000000000000 --- a/arch/sparc/include/asm/timex_32.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/include/asm/timex.h - * - * sparc architecture timex specifications - */ -#ifndef _ASMsparc_TIMEX_H -#define _ASMsparc_TIMEX_H - -#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ - -#include - -#endif diff --git a/arch/sparc/include/asm/timex_64.h b/arch/sparc/include/asm/tim= ex_64.h index 076c44f6845d..fa004ef3bb9a 100644 --- a/arch/sparc/include/asm/timex_64.h +++ b/arch/sparc/include/asm/timex_64.h @@ -9,12 +9,8 @@ =20 #include =20 -#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ - /* Getting on the cycle counter on sparc64. */ typedef unsigned long cycles_t; #define get_cycles() tick_ops->get_tick() =20 -#define ARCH_HAS_READ_CURRENT_TIMER - #endif diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c index 87b267043ccd..b1c54ab4b15b 100644 --- a/arch/sparc/kernel/time_64.c +++ b/arch/sparc/kernel/time_64.c @@ -894,8 +894,8 @@ unsigned long long sched_clock(void) return ((get_tick() * quotient) >> SPARC64_NSEC_PER_CYC_SHIFT) - offset; } =20 -int read_current_timer(unsigned long *timer_val) +bool delay_read_timer(unsigned long *timer_val) { *timer_val =3D get_tick(); - return 0; + return true; } diff --git a/arch/um/include/asm/timex.h b/arch/um/include/asm/timex.h deleted file mode 100644 index 9f27176adb26..000000000000 --- a/arch/um/include/asm/timex.h +++ /dev/null @@ -1,9 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __UM_TIMEX_H -#define __UM_TIMEX_H - -#define CLOCK_TICK_RATE (HZ) - -#include - -#endif diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index bdad90f210e4..ec9e1d4c85b1 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -80,6 +80,7 @@ config X86 select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL select ARCH_HAS_DEBUG_VM_PGTABLE if !X86_PAE + select ARCH_HAS_DELAY_TIMER select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DMA_OPS if GART_IOMMU || XEN select ARCH_HAS_EARLY_DEBUG if KGDB diff --git a/arch/x86/include/asm/timex.h b/arch/x86/include/asm/timex.h index 6e57e3c0fdd2..f397072cf294 100644 --- a/arch/x86/include/asm/timex.h +++ b/arch/x86/include/asm/timex.h @@ -13,9 +13,4 @@ static inline unsigned long random_get_entropy(void) } #define random_get_entropy random_get_entropy =20 -/* Assume we use the PIT time source for the clock tick */ -#define CLOCK_TICK_RATE PIT_TICK_RATE - -#define ARCH_HAS_READ_CURRENT_TIMER - #endif /* _ASM_X86_TIMEX_H */ diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 46882ce79c3a..0e75eb07990b 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1268,7 +1268,7 @@ void __init setup_arch(char **cmdline_p) =20 mcheck_init(); =20 - register_refined_jiffies(CLOCK_TICK_RATE); + register_refined_jiffies(PIT_TICK_RATE); =20 #ifdef CONFIG_EFI if (efi_enabled(EFI_BOOT)) diff --git a/arch/x86/lib/delay.c b/arch/x86/lib/delay.c index eb2d2e1cbddd..70ad000e91e7 100644 --- a/arch/x86/lib/delay.c +++ b/arch/x86/lib/delay.c @@ -14,12 +14,10 @@ =20 #include #include -#include #include #include =20 #include -#include #include #include =20 @@ -189,13 +187,13 @@ void use_mwaitx_delay(void) delay_fn =3D delay_halt; } =20 -int read_current_timer(unsigned long *timer_val) +bool delay_read_timer(unsigned long *timer_val) { if (delay_fn =3D=3D delay_tsc) { *timer_val =3D rdtsc(); - return 0; + return true; } - return -1; + return false; } =20 void __delay(unsigned long loops) diff --git a/include/asm-generic/timex.h b/include/asm-generic/timex.h index 50ba9b5ce983..2032fda7052c 100644 --- a/include/asm-generic/timex.h +++ b/include/asm-generic/timex.h @@ -13,11 +13,4 @@ static inline cycles_t get_cycles(void) } #endif =20 -/* - * Architectures are encouraged to implement read_current_timer - * and define this in order to avoid the expensive delay loop - * calibration during boot. - */ -#undef ARCH_HAS_READ_CURRENT_TIMER - #endif /* __ASM_GENERIC_TIMEX_H */ diff --git a/include/linux/delay.h b/include/linux/delay.h index 68b2a69dd24d..82409e55b6ae 100644 --- a/include/linux/delay.h +++ b/include/linux/delay.h @@ -17,6 +17,8 @@ extern unsigned long loops_per_jiffy; =20 #include =20 +bool delay_read_timer(unsigned long *t); + /* * Using udelay() for intervals greater than a few milliseconds can * risk overflow for high loops_per_jiffy (high bogomips) machines. The diff --git a/include/linux/timex.h b/include/linux/timex.h index 4ee32eff3f22..7014ccc638fc 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h @@ -156,8 +156,6 @@ extern int do_clock_adjtime(const clockid_t which_clock= , struct __kernel_timex * =20 extern void hardpps(const struct timespec64 *, const struct timespec64 *); =20 -int read_current_timer(unsigned long *timer_val); - /* The clock frequency of the i8253/i8254 PIT */ #define PIT_TICK_RATE 1193182ul =20 diff --git a/init/calibrate.c b/init/calibrate.c index 63be4c65bc52..2bfe97034e42 100644 --- a/init/calibrate.c +++ b/init/calibrate.c @@ -13,7 +13,6 @@ #include #include #include -#include =20 unsigned long lpj_fine; unsigned long preset_lpj; @@ -25,9 +24,9 @@ static int __init lpj_setup(char *str) =20 __setup("lpj=3D", lpj_setup); =20 -#ifdef ARCH_HAS_READ_CURRENT_TIMER +#ifdef CONFIG_ARCH_HAS_DELAY_TIMER =20 -/* This routine uses the read_current_timer() routine and gets the +/* This routine uses the delay_read_timer() routine and gets the * loops per jiffy directly, instead of guessing it using delay(). * Also, this code tries to handle non-maskable asynchronous events * (like SMIs) @@ -48,13 +47,13 @@ static unsigned long calibrate_delay_direct(void) int min =3D -1; int i; =20 - if (read_current_timer(&pre_start) < 0 ) + if (!delay_read_timer(&pre_start)) return 0; =20 /* * A simple loop like * while ( jiffies < start_jiffies+1) - * start =3D read_current_timer(); + * start =3D delay_read_timer(); * will not do. As we don't really know whether jiffy switch * happened first or timer_value was read first. And some asynchronous * event can happen between these two events introducing errors in lpj. @@ -72,22 +71,22 @@ static unsigned long calibrate_delay_direct(void) =20 for (i =3D 0; i < MAX_DIRECT_CALIBRATION_RETRIES; i++) { pre_start =3D 0; - read_current_timer(&start); + delay_read_timer(&start); start_jiffies =3D jiffies; while (time_before_eq(jiffies, start_jiffies + 1)) { pre_start =3D start; - read_current_timer(&start); + delay_read_timer(&start); } - read_current_timer(&post_start); + delay_read_timer(&post_start); =20 pre_end =3D 0; end =3D post_start; while (time_before_eq(jiffies, start_jiffies + 1 + DELAY_CALIBRATION_TICKS)) { pre_end =3D end; - read_current_timer(&end); + delay_read_timer(&end); } - read_current_timer(&post_end); + delay_read_timer(&post_end); =20 timer_rate_max =3D (post_end - pre_start) / DELAY_CALIBRATION_TICKS;