diff options
author | Atish Patra <atish.patra@wdc.com> | 2019-09-10 03:40:38 -0700 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2019-09-10 17:44:10 +0530 |
commit | 98ee15ca3adcf7bc22695897cd63a3ce8c5c53ff (patch) | |
tree | fad1689c391ba8660674e2b80cab3c9df5900aba /lib/sbi/sbi_tlb.c | |
parent | f2e82c3d797d9f64ec8f33365c35a2b5f7ea2bbb (diff) |
lib: provide a platform specific tlb range flush threshold
Currently, the tlb range flush threshold is fixed and set to 4k for
all platforms. However, it should be platform specific as it completely
depends upon how platform actually implements sfence instruction.
Define a platform feature that allows every individual platform to set
different values. If a platform doesn't define it, just use a page size as
the threshold.
Signed-off-by: Atish Patra <atish.patra@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_tlb.c')
-rw-r--r-- | lib/sbi/sbi_tlb.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sbi/sbi_tlb.c b/lib/sbi/sbi_tlb.c index c4e5f48..5c4c596 100644 --- a/lib/sbi/sbi_tlb.c +++ b/lib/sbi/sbi_tlb.c @@ -23,6 +23,7 @@ static unsigned long tlb_sync_off; static unsigned long tlb_fifo_off; static unsigned long tlb_fifo_mem_off; +static unsigned long tlb_range_flush_limit; static void sbi_tlb_flush_all(void) { @@ -232,7 +233,7 @@ int sbi_tlb_fifo_update(struct sbi_scratch *rscratch, u32 hartid, void *data) * upgrade it to flush all because we can only flush * 4KB at a time. */ - if (tinfo->size > SBI_TLB_FLUSH_MAX_SIZE) { + if (tinfo->size > tlb_range_flush_limit) { tinfo->start = 0; tinfo->size = SBI_TLB_FLUSH_ALL; } @@ -276,6 +277,7 @@ int sbi_tlb_fifo_init(struct sbi_scratch *scratch, bool cold_boot) void *tlb_mem; unsigned long *tlb_sync; struct sbi_fifo *tlb_q; + const struct sbi_platform *plat = sbi_platform_ptr(scratch); if (cold_boot) { tlb_sync_off = sbi_scratch_alloc_offset(sizeof(*tlb_sync), @@ -296,6 +298,7 @@ int sbi_tlb_fifo_init(struct sbi_scratch *scratch, bool cold_boot) sbi_scratch_free_offset(tlb_sync_off); return SBI_ENOMEM; } + tlb_range_flush_limit = sbi_platform_tlbr_flush_limit(plat); } else { if (!tlb_sync_off || !tlb_fifo_off || |