diff options
| author | Samuel Holland <[email protected]> | 2024-08-30 08:49:07 -0700 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2024-09-25 12:03:30 +0530 |
| commit | 15c4e285db3fe09bf96bddb7c15acb8d8827e1fe (patch) | |
| tree | 164cd41a13b450c562c53c568c8215a01c3df7da /lib | |
| parent | 9d7a983060dc379ae788ed1879371211a1005c6f (diff) | |
lib: sbi: Use current_hartindex() where possible
This avoids calls to the expensive sbi_hartid_to_hartindex() function
and also makes the firmware smaller.
Signed-off-by: Samuel Holland <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sbi/sbi_domain_context.c | 6 | ||||
| -rw-r--r-- | lib/sbi/sbi_hsm.c | 2 | ||||
| -rw-r--r-- | lib/sbi/sbi_ipi.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/sbi/sbi_domain_context.c b/lib/sbi/sbi_domain_context.c index 1432e3a8..bafb6c3e 100644 --- a/lib/sbi/sbi_domain_context.c +++ b/lib/sbi/sbi_domain_context.c @@ -26,7 +26,7 @@ static void switch_to_next_domain_context(struct sbi_context *ctx, struct sbi_context *dom_ctx) { - u32 hartindex = sbi_hartid_to_hartindex(current_hartid()); + u32 hartindex = current_hartindex(); struct sbi_trap_context *trap_ctx; struct sbi_domain *current_dom = ctx->dom; struct sbi_domain *target_dom = dom_ctx->dom; @@ -91,7 +91,7 @@ int sbi_domain_context_enter(struct sbi_domain *dom) { struct sbi_context *ctx = sbi_domain_context_thishart_ptr(); struct sbi_context *dom_ctx = sbi_hartindex_to_domain_context( - sbi_hartid_to_hartindex(current_hartid()), dom); + current_hartindex(), dom); /* Validate the domain context existence */ if (!dom_ctx) @@ -107,7 +107,7 @@ int sbi_domain_context_enter(struct sbi_domain *dom) int sbi_domain_context_exit(void) { - u32 hartindex = sbi_hartid_to_hartindex(current_hartid()); + u32 hartindex = current_hartindex(); struct sbi_domain *dom; struct sbi_context *ctx = sbi_domain_context_thishart_ptr(); struct sbi_context *dom_ctx, *tmp; diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c index 3706acfb..ab11b119 100644 --- a/lib/sbi/sbi_hsm.c +++ b/lib/sbi/sbi_hsm.c @@ -261,7 +261,7 @@ int sbi_hsm_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot) hdata = sbi_scratch_offset_ptr(rscratch, hart_data_offset); ATOMIC_INIT(&hdata->state, - (sbi_hartindex_to_hartid(i) == hartid) ? + (i == current_hartindex()) ? SBI_HSM_STATE_START_PENDING : SBI_HSM_STATE_STOPPED); ATOMIC_INIT(&hdata->start_ticket, 0); diff --git a/lib/sbi/sbi_ipi.c b/lib/sbi/sbi_ipi.c index 048aaa66..505aafd8 100644 --- a/lib/sbi/sbi_ipi.c +++ b/lib/sbi/sbi_ipi.c @@ -233,7 +233,7 @@ void sbi_ipi_process(void) struct sbi_scratch *scratch = sbi_scratch_thishart_ptr(); struct sbi_ipi_data *ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off); - u32 hartindex = sbi_hartid_to_hartindex(current_hartid()); + u32 hartindex = current_hartindex(); sbi_pmu_ctr_incr_fw(SBI_PMU_FW_IPI_RECVD); sbi_ipi_raw_clear(hartindex); |
