xref: /openbmc/linux/kernel/time/tick-legacy.c (revision 56cc7b8a)
1b3550164SArnd Bergmann // SPDX-License-Identifier: GPL-2.0
2b3550164SArnd Bergmann /*
3b3550164SArnd Bergmann  * Timer tick function for architectures that lack generic clockevents,
4b3550164SArnd Bergmann  * consolidated here from m68k/ia64/parisc/arm.
5b3550164SArnd Bergmann  */
6b3550164SArnd Bergmann 
7b3550164SArnd Bergmann #include <linux/irq.h>
8b3550164SArnd Bergmann #include <linux/profile.h>
9b3550164SArnd Bergmann #include <linux/timekeeper_internal.h>
10b3550164SArnd Bergmann 
11b3550164SArnd Bergmann #include "tick-internal.h"
12b3550164SArnd Bergmann 
13*56cc7b8aSArnd Bergmann /**
14*56cc7b8aSArnd Bergmann  * legacy_timer_tick() - advances the timekeeping infrastructure
15*56cc7b8aSArnd Bergmann  * @ticks:	number of ticks, that have elapsed since the last call.
16*56cc7b8aSArnd Bergmann  *
17*56cc7b8aSArnd Bergmann  * This is used by platforms that have not been converted to
18*56cc7b8aSArnd Bergmann  * generic clockevents.
19*56cc7b8aSArnd Bergmann  *
20*56cc7b8aSArnd Bergmann  * If 'ticks' is zero, the CPU is not handling timekeeping, so
21*56cc7b8aSArnd Bergmann  * only perform process accounting and profiling.
22*56cc7b8aSArnd Bergmann  *
23*56cc7b8aSArnd Bergmann  * Must be called with interrupts disabled.
24*56cc7b8aSArnd Bergmann  */
legacy_timer_tick(unsigned long ticks)25b3550164SArnd Bergmann void legacy_timer_tick(unsigned long ticks)
26b3550164SArnd Bergmann {
27*56cc7b8aSArnd Bergmann 	if (ticks) {
28*56cc7b8aSArnd Bergmann 		raw_spin_lock(&jiffies_lock);
29*56cc7b8aSArnd Bergmann 		write_seqcount_begin(&jiffies_seq);
30*56cc7b8aSArnd Bergmann 		do_timer(ticks);
31*56cc7b8aSArnd Bergmann 		write_seqcount_end(&jiffies_seq);
32*56cc7b8aSArnd Bergmann 		raw_spin_unlock(&jiffies_lock);
33*56cc7b8aSArnd Bergmann 		update_wall_time();
34*56cc7b8aSArnd Bergmann 	}
35b3550164SArnd Bergmann 	update_process_times(user_mode(get_irq_regs()));
36b3550164SArnd Bergmann 	profile_tick(CPU_PROFILING);
37b3550164SArnd Bergmann }
38