Skip to content

Commit 6279228

Browse files
avpatelMarc Zyngier
authored andcommitted
RISC-V: Use IPIs for remote icache flush when possible
If we have specialized interrupt controller (such as AIA IMSIC) which allows supervisor mode to directly inject IPIs without any assistance from M-mode or HS-mode then using such specialized interrupt controller, we can do remote icache flushe directly from supervisor mode instead of using the SBI RFENCE calls. This patch extends remote icache flush functions to use supervisor mode IPIs whenever direct supervisor mode IPIs.are supported by interrupt controller. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]> Acked-by: Palmer Dabbelt <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 18d2199 commit 6279228

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

arch/riscv/mm/cacheflush.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void flush_icache_all(void)
1919
{
2020
local_flush_icache_all();
2121

22-
if (IS_ENABLED(CONFIG_RISCV_SBI))
22+
if (IS_ENABLED(CONFIG_RISCV_SBI) && !riscv_use_ipi_for_rfence())
2323
sbi_remote_fence_i(NULL);
2424
else
2525
on_each_cpu(ipi_remote_fence_i, NULL, 1);
@@ -67,7 +67,8 @@ void flush_icache_mm(struct mm_struct *mm, bool local)
6767
* with flush_icache_deferred().
6868
*/
6969
smp_mb();
70-
} else if (IS_ENABLED(CONFIG_RISCV_SBI)) {
70+
} else if (IS_ENABLED(CONFIG_RISCV_SBI) &&
71+
!riscv_use_ipi_for_rfence()) {
7172
sbi_remote_fence_i(&others);
7273
} else {
7374
on_each_cpu_mask(&others, ipi_remote_fence_i, NULL, 1);

0 commit comments

Comments
 (0)