Skip to content

Commit cc9b2c5

Browse files
FlyGoatdlezcano
authored andcommitted
clocksource/drivers/mips-gic-timer: Refine rating computation
It is a good clocksource which usually go as fast as CPU core and have a low access latency, so raise the base of rating from Good to desired when we know that it has a stable frequency. Increase frequency addend dividend to 10000000 (10MHz) to reasonably accommodate multi GHz level clock, also cap rating within current level. Signed-off-by: Jiaxun Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent db19d3a commit cc9b2c5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/clocksource/mips-gic-timer.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ static int __init __gic_clocksource_init(void)
197197
gic_clocksource.mask = CLOCKSOURCE_MASK(count_width);
198198

199199
/* Calculate a somewhat reasonable rating value. */
200-
gic_clocksource.rating = 200 + gic_frequency / 10000000;
200+
if (mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ))
201+
gic_clocksource.rating = 300; /* Good when frequecy is stable */
202+
else
203+
gic_clocksource.rating = 200;
204+
gic_clocksource.rating += clamp(gic_frequency / 10000000, 0, 99);
201205

202206
ret = clocksource_register_hz(&gic_clocksource, gic_frequency);
203207
if (ret < 0)

0 commit comments

Comments
 (0)