riscv: Improve flush_tlb_kernel_range()
authorAlexandre Ghiti <alexghiti@rivosinc.com>
Mon, 30 Oct 2023 13:30:28 +0000 (14:30 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Tue, 7 Nov 2023 06:49:22 +0000 (22:49 -0800)
commit62b78fd5fe39b5b82e4b4b8d0ba87ad40d1a99bb
treefab0fd3904000adb03b3f01512aa9d12c64f3fc4
parentba6f35964c518b4520bc3f2fe25d8457cb4a7be5
riscv: Improve flush_tlb_kernel_range()

This function used to simply flush the whole tlb of all harts, be more
subtile and try to only flush the range.

The problem is that we can only use PAGE_SIZE as stride since we don't know
the size of the underlying mapping and then this function will be improved
only if the size of the region to flush is < threshold * PAGE_SIZE.

Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # On RZ/Five SMARC
Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
Tested-by: Samuel Holland <samuel.holland@sifive.com>
Link: https://lore.kernel.org/r/20231030133027.19542-5-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/tlbflush.h
arch/riscv/mm/tlbflush.c