Skip to content

Commit 674402b

Browse files
smaeuldlezcano
authored andcommitted
clocksource/drivers/riscv: Increase the clock source rating
RISC-V provides an architectural clock source via the time CSR. This clock source exposes a 64-bit counter synchronized across all CPUs. Because it is accessed using a CSR, it is much more efficient to read than MMIO clock sources. For example, on the Allwinner D1, reading the sun4i timer in a loop takes 131 cycles/iteration, while reading the RISC-V time CSR takes only 5 cycles/iteration. Adjust the RISC-V clock source rating so it is preferred over the various platform-specific MMIO clock sources. Signed-off-by: Samuel Holland <[email protected]> Acked-by: Palmer Dabbelt <[email protected]> Reviewed-by: Palmer Dabbelt <[email protected]> Reviewed-by: Anup Patel <[email protected]> Reviewed-by: Lad Prabhakar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent 8932a95 commit 674402b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/clocksource/timer-riscv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static u64 notrace riscv_sched_clock(void)
7474

7575
static struct clocksource riscv_clocksource = {
7676
.name = "riscv_clocksource",
77-
.rating = 300,
77+
.rating = 400,
7878
.mask = CLOCKSOURCE_MASK(64),
7979
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
8080
.read = riscv_clocksource_rdtime,

0 commit comments

Comments
 (0)