All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] implement flush_cache_vmap for RISC-V
@ 2021-04-12  0:05 ` Jiuyang Liu
  0 siblings, 0 replies; 10+ messages in thread
From: Jiuyang Liu @ 2021-04-12  0:05 UTC (permalink / raw)
  To: Alex Ghiti, Palmer Dabbelt
  Cc: Jiuyang Liu, Andrew Waterman, Paul Walmsley, Albert Ou,
	Andrew Morton, Geert Uytterhoeven, linux-riscv, linux-kernel

This patch implements flush_cache_vmap for RISC-V, since it modifies PTE.
Without this patch, SFENCE.VMA won't be added to related codes, which
might introduce a bug in the out-of-order micro-architecture
implementations.

Signed-off-by: Jiuyang Liu <liu@jiuyang.me>
Reviewed-by: Alexandre Ghiti <alex@ghiti.fr>
Reviewed-by: Palmer Dabbelt <palmer@dabbelt.com>
---
 arch/riscv/include/asm/cacheflush.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/riscv/include/asm/cacheflush.h b/arch/riscv/include/asm/cacheflush.h
index 23ff70350992..3fd528badc35 100644
--- a/arch/riscv/include/asm/cacheflush.h
+++ b/arch/riscv/include/asm/cacheflush.h
@@ -30,6 +30,12 @@ static inline void flush_dcache_page(struct page *page)
 #define flush_icache_user_page(vma, pg, addr, len) \
 	flush_icache_mm(vma->vm_mm, 0)
 
+/*
+ * flush_cache_vmap is invoked after map_kernel_range() has installed the page
+ * table entries, which modifies PTE, SFENCE.VMA should be inserted.
+ */
+#define flush_cache_vmap(start, end) flush_tlb_all()
+
 #ifndef CONFIG_SMP
 
 #define flush_icache_all() local_flush_icache_all()
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-04-23  4:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12  0:05 [PATCH] implement flush_cache_vmap for RISC-V Jiuyang Liu
2021-04-12  0:05 ` Jiuyang Liu
2021-04-12  7:08 ` Jisheng Zhang
2021-04-12  7:08   ` Jisheng Zhang
2021-04-14  7:03   ` Alex Ghiti
2021-04-14  7:03     ` Alex Ghiti
2021-04-14  9:16     ` Jiuyang Liu
2021-04-14  9:16       ` Jiuyang Liu
2021-04-23  4:39     ` Palmer Dabbelt
2021-04-23  4:39       ` Palmer Dabbelt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.