Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
MIPS: csrc-r4k: Refine rating computation
Browse files Browse the repository at this point in the history
Increase frequency addend dividend to 10000000 (10MHz) to
reasonably accommodate multi GHz level mips_hpt_frequency.

Cap rating of csrc-r4k into 299 to ensure it doesn't go into
"Desired" range, given all the drama we have with CP0 count
registers (SMP sync, behaviour on wait etc).

Signed-off-by: Jiaxun Yang <[email protected]>
Signed-off-by: Thomas Bogendoerfer <[email protected]>
  • Loading branch information
FlyGoat authored and tsbogend committed Jul 3, 2024
1 parent 04f38d1 commit c171186
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/mips/kernel/csrc-r4k.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ int __init init_r4k_clocksource(void)
return -ENXIO;

/* Calculate a somewhat reasonable rating value */
clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
clocksource_mips.rating = 200;
clocksource_mips.rating += clamp(mips_hpt_frequency / 10000000, 0, 99);

/*
* R2 onwards makes the count accessible to user mode so it can be used
Expand Down

0 comments on commit c171186

Please sign in to comment.