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 <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
Anup Patel
2020-03-12 10:21:25 +05:30
committed by Anup Patel
parent 16e7071f6d
commit 823345ecae
20 changed files with 49 additions and 52 deletions

View File

@@ -8,8 +8,8 @@
* Nylon Chen <nylon7@andestech.com>
*/
#include <sbi/riscv_asm.h>
#include <sbi/riscv_io.h>
#include <sbi/sbi_hart.h>
static u32 plmt_time_hart_count;
static volatile void *plmt_time_base;
@@ -34,7 +34,7 @@ u64 plmt_timer_value(void)
void plmt_timer_event_stop(void)
{
u32 target_hart = sbi_current_hartid();
u32 target_hart = current_hartid();
if (plmt_time_hart_count <= target_hart)
return;
@@ -50,7 +50,7 @@ void plmt_timer_event_stop(void)
void plmt_timer_event_start(u64 next_event)
{
u32 target_hart = sbi_current_hartid();
u32 target_hart = current_hartid();
if (plmt_time_hart_count <= target_hart)
return;
@@ -70,7 +70,7 @@ void plmt_timer_event_start(u64 next_event)
int plmt_warm_timer_init(void)
{
u32 target_hart = sbi_current_hartid();
u32 target_hart = current_hartid();
if (plmt_time_hart_count <= target_hart || !plmt_time_base)
return -1;