Commit cc9b2c59 authored by Jiaxun Yang's avatar Jiaxun Yang Committed by Daniel Lezcano

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: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
Link: https://lore.kernel.org/r/20240612-mips-clks-v2-6-a57e6f49f3db@flygoat.comSigned-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent db19d3aa
...@@ -197,7 +197,11 @@ static int __init __gic_clocksource_init(void) ...@@ -197,7 +197,11 @@ static int __init __gic_clocksource_init(void)
gic_clocksource.mask = CLOCKSOURCE_MASK(count_width); gic_clocksource.mask = CLOCKSOURCE_MASK(count_width);
/* Calculate a somewhat reasonable rating value. */ /* Calculate a somewhat reasonable rating value. */
gic_clocksource.rating = 200 + gic_frequency / 10000000; if (mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ))
gic_clocksource.rating = 300; /* Good when frequecy is stable */
else
gic_clocksource.rating = 200;
gic_clocksource.rating += clamp(gic_frequency / 10000000, 0, 99);
ret = clocksource_register_hz(&gic_clocksource, gic_frequency); ret = clocksource_register_hz(&gic_clocksource, gic_frequency);
if (ret < 0) if (ret < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment