clocksource/drivers/riscv: Patch riscv_clock_next_event() jump before first use
authorMatt Evans <mev@rivosinc.com>
Wed, 1 Feb 2023 19:49:42 +0000 (19:49 +0000)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Mon, 13 Feb 2023 12:10:17 +0000 (13:10 +0100)
commit225b9596cb0227c1c1b1e4a836dad43595c3e61a
treeb1d67493daa4f2f1db2fadae83f997daf2e4d74e
parentf3af3dc7cc351bd22742eac992c72c76749ce8c3
clocksource/drivers/riscv: Patch riscv_clock_next_event() jump before first use

A static key is used to select between SBI and Sstc timer usage in
riscv_clock_next_event(), but currently the direction is resolved
after cpuhp_setup_state() is called (which sets the next event).  The
first event will therefore fall through the sbi_set_timer() path; this
breaks Sstc-only systems.  So, apply the jump patching before first
use.

Fixes: 9f7a8ff6391f ("RISC-V: Prefer sstc extension if available")
Signed-off-by: Matt Evans <mev@rivosinc.com>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/CDDAB2D0-264E-42F3-8E31-BA210BEB8EC1@rivosinc.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/clocksource/timer-riscv.c