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

Inochi Amaoto inochiama at outlook.com
Wed Oct 11 20:29:29 PDT 2023


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 at outlook.com>
---
 platform/generic/platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/generic/platform.c b/platform/generic/platform.c
index 66a0b77..4246efd 100644
--- a/platform/generic/platform.c
+++ b/platform/generic/platform.c
@@ -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)
-- 
2.42.0




More information about the opensbi mailing list