Re: [patch 06/38] calibrate: Rework delay timer calibration
Jon Hunter <[email protected]>
| Newsgroups | gmane.linux.ports.parisc,gmane.linux.kernel,gmane.linux.network,gmane.linux.kernel.wireless.general,gmane.linux.kernel.cryptoapi,gmane.linux.kernel.mm,gmane.comp.file-systems.ext4,gmane.linux.hams,gmane.linux.ports.alpha,gmane.linux.ports.arm.kernel,gmane.linux.ports.ppc64.devel,gmane.linux.ports.riscv,gmane.linux.ports.sparc,gmane.linux.ports.tegra |
|---|---|
| Message-ID | <[email protected]> |
Hi Thomas, On 10/04/2026 13:18, Thomas Gleixner wrote: > The header define in asm/timex,h and the naming of the function to read the > delay timer are confusing at best. > > Convert it to a config switch selected by the archictures, which provide > the functionality, and rename the function to delay_read_timer(), which > makes the purpose clear. Move the declaration to linux/delay.h where it > belongs. > > Remove the resulting empty asm/timex.h files as well. > > No functional change. > > Signed-off-by: Thomas Gleixner <[email protected]> > Cc: Arnd Bergmann <[email protected]> ... > --- a/arch/arm/include/asm/timex.h > +++ b/arch/arm/include/asm/timex.h > @@ -10,7 +10,10 @@ > #define _ASMARM_TIMEX_H > > typedef unsigned long cycles_t; > -#define get_cycles() ({ cycles_t c; read_current_timer(&c) ? 0 : c; }) > +// Temporary workaround > +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()) I have noticed a boot regression on some of our 32-bit Tegra platforms. Bisect is pointing to this commit. Making the following change does fix it, as delay_read_timer() now returns a valid value when true ... diff --git a/arch/arm/include/asm/timex.h b/arch/arm/include/asm/timex.h index 94e40c19cfc5..4d31eab9dba2 100644 --- a/arch/arm/include/asm/timex.h +++ b/arch/arm/include/asm/timex.h @@ -13,7 +13,7 @@ typedef unsigned long cycles_t; // 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 get_cycles() ({ cycles_t c; delay_read_timer(&c) ? c : 0; }) #define random_get_entropy() (((unsigned long)get_cycles()) ?: random_get_entropy_fallback()) Cheers Jon -- nvpublic