Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

timekeeping: add CONFIG_LEGACY_TIMER_TICK

All platforms that currently do not use generic clockevents roughly call
the same set of functions in their timer interrupts: xtime_update(),
update_process_times() and profile_tick(), sometimes in a different
sequence.

Add a helper function that performs all three of them, to make the
callers more uniform and simplify the interface.

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+28
+1
include/linux/timekeeping.h
··· 12 12 /* Architecture timer tick functions: */ 13 13 extern void update_process_times(int user); 14 14 extern void xtime_update(unsigned long ticks); 15 + extern void legacy_timer_tick(unsigned long ticks); 15 16 16 17 /* 17 18 * Get and set timeofday
+7
kernel/time/Kconfig
··· 57 57 bool 58 58 default y if POSIX_TIMERS && HAVE_POSIX_CPU_TIMERS_TASK_WORK 59 59 60 + config LEGACY_TIMER_TICK 61 + bool 62 + help 63 + The legacy timer tick helper is used by platforms that 64 + lack support for the generic clockevent framework. 65 + New platforms should use generic clockevents instead. 66 + 60 67 if GENERIC_CLOCKEVENTS 61 68 menu "Timers subsystem" 62 69
+1
kernel/time/Makefile
··· 16 16 endif 17 17 obj-$(CONFIG_GENERIC_SCHED_CLOCK) += sched_clock.o 18 18 obj-$(CONFIG_TICK_ONESHOT) += tick-oneshot.o tick-sched.o 19 + obj-$(CONFIG_LEGACY_TIMER_TICK) += tick-legacy.o 19 20 obj-$(CONFIG_HAVE_GENERIC_VDSO) += vsyscall.o 20 21 obj-$(CONFIG_DEBUG_FS) += timekeeping_debug.o 21 22 obj-$(CONFIG_TEST_UDELAY) += test_udelay.o
+19
kernel/time/tick-legacy.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Timer tick function for architectures that lack generic clockevents, 4 + * consolidated here from m68k/ia64/parisc/arm. 5 + */ 6 + 7 + #include <linux/irq.h> 8 + #include <linux/profile.h> 9 + #include <linux/timekeeper_internal.h> 10 + 11 + #include "tick-internal.h" 12 + 13 + void legacy_timer_tick(unsigned long ticks) 14 + { 15 + if (ticks) 16 + xtime_update(ticks); 17 + update_process_times(user_mode(get_irq_regs())); 18 + profile_tick(CPU_PROFILING); 19 + }