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/**
14 * legacy_timer_tick() - advances the timekeeping infrastructure
15 * @ticks:	number of ticks, that have elapsed since the last call.
16 *
17 * This is used by platforms that have not been converted to
18 * generic clockevents.
19 *
20 * If 'ticks' is zero, the CPU is not handling timekeeping, so
21 * only perform process accounting and profiling.
22 *
23 * Must be called with interrupts disabled.
24 */
25void legacy_timer_tick(unsigned long ticks)
26{
27	if (ticks) {
28		raw_spin_lock(&jiffies_lock);
29		write_seqcount_begin(&jiffies_seq);
30		do_timer(ticks);
31		write_seqcount_end(&jiffies_seq);
32		raw_spin_unlock(&jiffies_lock);
33		update_wall_time();
34	}
35	update_process_times(user_mode(get_irq_regs()));
36	profile_tick(CPU_PROFILING);
37}
38