lib: sbi: Use sbi_scratch_last_hartindex() in remote TLB managment
authorAnup Patel <apatel@ventanamicro.com>
Fri, 1 Sep 2023 11:29:58 +0000 (16:59 +0530)
committerAnup Patel <anup@brainfault.org>
Sun, 24 Sep 2023 06:09:35 +0000 (11:39 +0530)
The sbi_hartid_to_scratch() involves translating hartid to hartindex
which is expensive so let's use sbi_hartindex_to_scratch() instead.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
lib/sbi/sbi_tlb.c

index 0573bb19037fc40539c8d227d9707176a45ec2a1..bfcb4d832701712a675ae02c23d5fdf829261980 100644 (file)
@@ -214,14 +214,14 @@ static void tlb_pmu_incr_fw_ctr(struct sbi_tlb_info *data)
 
 static void tlb_entry_process(struct sbi_tlb_info *tinfo)
 {
-       u32 rhartid, rindex;
+       u32 rindex;
        struct sbi_scratch *rscratch = NULL;
        atomic_t *rtlb_sync = NULL;
 
        tinfo->local_fn(tinfo);
 
-       sbi_hartmask_for_each_hart(rhartid, rindex, &tinfo->smask) {
-               rscratch = sbi_hartid_to_scratch(rhartid);
+       sbi_hartmask_for_each_hartindex(rindex, &tinfo->smask) {
+               rscratch = sbi_hartindex_to_scratch(rindex);
                if (!rscratch)
                        continue;