riscv: Use global mappings for kernel pages
authorGuo Ren <guoren@linux.alibaba.com>
Wed, 26 May 2021 05:49:20 +0000 (05:49 +0000)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Sun, 30 May 2021 01:17:23 +0000 (18:17 -0700)
We map kernel pages into all addresses spages, so they can be marked as
global.  This allows hardware to avoid flushing the kernel mappings when
moving between address spaces.

Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
[Palmer: commit text]
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/include/asm/pgtable.h

index bde8ce3..c103f0a 100644 (file)
                                | _PAGE_WRITE \
                                | _PAGE_PRESENT \
                                | _PAGE_ACCESSED \
-                               | _PAGE_DIRTY)
+                               | _PAGE_DIRTY \
+                               | _PAGE_GLOBAL)
 
 #define PAGE_KERNEL            __pgprot(_PAGE_KERNEL)
 #define PAGE_KERNEL_READ       __pgprot(_PAGE_KERNEL & ~_PAGE_WRITE)