mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
clocksource/drivers/mips-gic-timer: Simplify gic_next_event() for per-cpu timer
The GIC clock event device is registered per CPU and is flagged with CLOCK_EVT_FEAT_C3STOP. This guarantees that the set_next_event() callback is always invoked on the CPU of the event. Drop the code path configuring the compare register of another CPU as it is never called and does not correctly handle the case of having multiple clusters, and document this guarantee by adding the CLOCK_EVT_FEAT_PERCPU flag to the clock event device features. Signed-off-by: Benoît Monin <benoit.monin@bootlin.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org> Reviewed-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Link: https://patch.msgid.link/20260929-sync-gic-counters-v4-4-ec70c4b60434@bootlin.com
This commit is contained in:
parent
57fb7ac358
commit
a05997891e
|
|
@ -52,18 +52,13 @@ static u64 notrace gic_read_count(void)
|
|||
|
||||
static int gic_next_event(unsigned long delta, struct clock_event_device *evt)
|
||||
{
|
||||
int cpu = cpumask_first(evt->cpumask);
|
||||
u64 cnt;
|
||||
int res;
|
||||
|
||||
cnt = gic_read_count();
|
||||
cnt += (u64)delta;
|
||||
if (cpu == raw_smp_processor_id()) {
|
||||
write_gic_vl_compare(cnt);
|
||||
} else {
|
||||
write_gic_vl_other(mips_cm_vp_id(cpu));
|
||||
write_gic_vo_compare(cnt);
|
||||
}
|
||||
write_gic_vl_compare(cnt);
|
||||
|
||||
res = ((int)(gic_read_count() - cnt) >= 0) ? -ETIME : 0;
|
||||
return res;
|
||||
}
|
||||
|
|
@ -82,6 +77,7 @@ static void gic_clockevent_cpu_init(unsigned int cpu,
|
|||
{
|
||||
cd->name = "MIPS GIC";
|
||||
cd->features = CLOCK_EVT_FEAT_ONESHOT |
|
||||
CLOCK_EVT_FEAT_PERCPU |
|
||||
CLOCK_EVT_FEAT_C3STOP;
|
||||
|
||||
cd->rating = 350;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user