]> Git Repo - linux.git/commitdiff
clocksource/drivers/riscv: Patch riscv_clock_next_event() jump before first use
authorMatt Evans <[email protected]>
Wed, 1 Feb 2023 19:49:42 +0000 (19:49 +0000)
committerDaniel Lezcano <[email protected]>
Mon, 13 Feb 2023 12:10:17 +0000 (13:10 +0100)
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 <[email protected]>
Reviewed-by: Palmer Dabbelt <[email protected]>
Acked-by: Palmer Dabbelt <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Daniel Lezcano <[email protected]>
drivers/clocksource/timer-riscv.c

index d8cb629d3aab26d562143dde4d4c23238c8eaad1..5f0f10c7e2226700ea56686a08e0f85e6a591fcc 100644 (file)
@@ -192,6 +192,11 @@ static int __init riscv_timer_init_dt(struct device_node *n)
                return error;
        }
 
+       if (riscv_isa_extension_available(NULL, SSTC)) {
+               pr_info("Timer interrupt in S-mode is available via sstc extension\n");
+               static_branch_enable(&riscv_sstc_available);
+       }
+
        error = cpuhp_setup_state(CPUHP_AP_RISCV_TIMER_STARTING,
                         "clockevents/riscv/timer:starting",
                         riscv_timer_starting_cpu, riscv_timer_dying_cpu);
@@ -199,11 +204,6 @@ static int __init riscv_timer_init_dt(struct device_node *n)
                pr_err("cpu hp setup state failed for RISCV timer [%d]\n",
                       error);
 
-       if (riscv_isa_extension_available(NULL, SSTC)) {
-               pr_info("Timer interrupt in S-mode is available via sstc extension\n");
-               static_branch_enable(&riscv_sstc_available);
-       }
-
        return error;
 }
 
This page took 0.058813 seconds and 4 git commands to generate.