riscv: Use accessors to page table entries instead of direct dereference
authorAlexandre Ghiti <alexghiti@rivosinc.com>
Wed, 13 Dec 2023 20:30:01 +0000 (21:30 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 20 Dec 2023 18:48:15 +0000 (10:48 -0800)
commitedf955647269422e387732870d04fc15933a25ea
treea7474d4bdd56a5c3c2c9ad3040235a076f0ac970
parentd6508999d1882ddd0db8b3b4bd7967d83e9909fa
riscv: Use accessors to page table entries instead of direct dereference

As very well explained in commit 20a004e7b017 ("arm64: mm: Use
READ_ONCE/WRITE_ONCE when accessing page tables"), an architecture whose
page table walker can modify the PTE in parallel must use
READ_ONCE()/WRITE_ONCE() macro to avoid any compiler transformation.

So apply that to riscv which is such architecture.

Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Acked-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20231213203001.179237-5-alexghiti@rivosinc.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/include/asm/kfence.h
arch/riscv/include/asm/pgtable-64.h
arch/riscv/include/asm/pgtable.h
arch/riscv/kernel/efi.c
arch/riscv/kvm/mmu.c
arch/riscv/mm/fault.c
arch/riscv/mm/hugetlbpage.c
arch/riscv/mm/kasan_init.c
arch/riscv/mm/pageattr.c
arch/riscv/mm/pgtable.c