diff options
| author | Anup Patel <[email protected]> | 2020-03-12 10:21:25 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2020-03-13 12:22:02 +0530 |
| commit | 823345ecaed0deb7770d9bac1c881004a6410e91 (patch) | |
| tree | e3b71fb186be4bebd610e796cc12f2d3f33424e6 /lib/utils | |
| parent | 16e7071f6ddd5ba69d416b5a68e4aa191fc19d3b (diff) | |
include: Make sbi_current_hartid() as macro in riscv_asm.h
The sbi_current_hartid() being a regular function is quite
expensive because for callers it is a function call instead
of a direct CSR read. This patch converts sbi_current_hartid()
into a macro in riscv_asm.h.
Signed-off-by: Anup Patel <[email protected]>
Reviewed-by: Atish Patra <[email protected]>
Diffstat (limited to 'lib/utils')
| -rw-r--r-- | lib/utils/sys/clint.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/utils/sys/clint.c b/lib/utils/sys/clint.c index ec855073..22ba088e 100644 --- a/lib/utils/sys/clint.c +++ b/lib/utils/sys/clint.c @@ -7,9 +7,9 @@ * Anup Patel <[email protected]> */ -#include <sbi/riscv_io.h> +#include <sbi/riscv_asm.h> #include <sbi/riscv_atomic.h> -#include <sbi/sbi_hart.h> +#include <sbi/riscv_io.h> #include <sbi_utils/sys/clint.h> static u32 clint_ipi_hart_count; @@ -36,7 +36,7 @@ void clint_ipi_clear(u32 target_hart) int clint_warm_ipi_init(void) { - u32 hartid = sbi_current_hartid(); + u32 hartid = current_hartid(); if (!clint_ipi_base) return -1; @@ -105,7 +105,7 @@ u64 clint_timer_value(void) void clint_timer_event_stop(void) { - u32 target_hart = sbi_current_hartid(); + u32 target_hart = current_hartid(); if (clint_time_hart_count <= target_hart) return; @@ -116,7 +116,7 @@ void clint_timer_event_stop(void) void clint_timer_event_start(u64 next_event) { - u32 target_hart = sbi_current_hartid(); + u32 target_hart = current_hartid(); if (clint_time_hart_count <= target_hart) return; @@ -127,7 +127,7 @@ void clint_timer_event_start(u64 next_event) int clint_warm_timer_init(void) { - u32 target_hart = sbi_current_hartid(); + u32 target_hart = current_hartid(); if (clint_time_hart_count <= target_hart || !clint_time_base) return -1; |
