Skip to content

Commit f16ff2b

Browse files
mpredfearnDaniel Lezcano
authored andcommitted
clocksource/drivers/mips-gic-timer: Add fastpath for local timer updates
Always accessing the compare register via the CM redirect region is (relatively) slow. If the timer being updated is the current CPUs then this can be shortcutted by writing to the CM VP local region. Signed-off-by: Matt Redfearn <matt.redfearn@mips.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent 7957b07 commit f16ff2b

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎drivers/clocksource/mips-gic-timer.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,18 @@ static u64 notrace gic_read_count(void)
3939

4040
static int gic_next_event(unsigned long delta, struct clock_event_device *evt)
4141
{
42+
int cpu = cpumask_first(evt->cpumask);
4243
u64 cnt;
4344
int res;
4445

4546
cnt = gic_read_count();
4647
cnt += (u64)delta;
47-
write_gic_vl_other(mips_cm_vp_id(cpumask_first(evt->cpumask)));
48-
write_gic_vo_compare(cnt);
48+
if (cpu == raw_smp_processor_id()) {
49+
write_gic_vl_compare(cnt);
50+
} else {
51+
write_gic_vl_other(mips_cm_vp_id(cpu));
52+
write_gic_vo_compare(cnt);
53+
}
4954
res = ((int)(gic_read_count() - cnt) >= 0) ? -ETIME : 0;
5055
return res;
5156
}

0 commit comments

Comments
 (0)