platform: Uses hart count as the default size of tlb info

For platform with high number of harts, it is better to auto detect a
suitable number of entries in tlb fifo. Since allocating tlb entry for
all online harts can reduce the wait time significantly, using the
number of the online harts can make most platforms happy. This auto
detection can avoid most duplicate code for setting tlb fifo size.

Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
Acked-by: Guo Ren <guoren@kernel.org>
Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Inochi Amaoto 2023-10-12 16:33:28 +08:00 committed by Anup Patel
parent 88ae718d36
commit 52fd64b82c
2 changed files with 2 additions and 3 deletions

View file

@ -41,7 +41,6 @@
#define SBI_PLATFORM_HART_INDEX2ID_OFFSET (0x60 + (__SIZEOF_POINTER__ * 2))
#define SBI_PLATFORM_TLB_RANGE_FLUSH_LIMIT_DEFAULT (1UL << 12)
#define SBI_PLATFORM_TLB_FIFO_NUM_ENTRIES 8
#ifndef __ASSEMBLER__
@ -330,7 +329,7 @@ static inline u32 sbi_platform_tlb_fifo_num_entries(const struct sbi_platform *p
{
if (plat && sbi_platform_ops(plat)->get_tlb_num_entries)
return sbi_platform_ops(plat)->get_tlb_num_entries();
return SBI_PLATFORM_TLB_FIFO_NUM_ENTRIES;
return sbi_scratch_last_hartindex() + 1;
}
/**

View file

@ -260,7 +260,7 @@ static u32 generic_tlb_num_entries(void)
{
if (generic_plat && generic_plat->tlb_num_entries)
return generic_plat->tlb_num_entries(generic_plat_match);
return SBI_PLATFORM_TLB_FIFO_NUM_ENTRIES;
return sbi_scratch_last_hartindex() + 1;
}
static int generic_pmu_init(void)