RISC-V: Add Svade and Svadu Extensions Support
authorYong-Xuan Wang <yongxuan.wang@sifive.com>
Fri, 26 Jul 2024 08:49:26 +0000 (16:49 +0800)
committerAnup Patel <anup@brainfault.org>
Thu, 21 Nov 2024 12:10:06 +0000 (17:40 +0530)
commit94a7734d0967e89fac5be1fd5115f5194e4a4017
tree144a5cec81cd175c97b5eb84df576f2b1dbdd9f9
parent332fa4a802b16ccb727199da685294f85f9880cb
RISC-V: Add Svade and Svadu Extensions Support

Svade and Svadu extensions represent two schemes for managing the PTE A/D
bits. When the PTE A/D bits need to be set, Svade extension intdicates
that a related page fault will be raised. In contrast, the Svadu extension
supports hardware updating of PTE A/D bits. Since the Svade extension is
mandatory and the Svadu extension is optional in RVA23 profile, by default
the M-mode firmware will enable the Svadu extension in the menvcfg CSR
when only Svadu is present in DT.

This patch detects Svade and Svadu extensions from DT and adds
arch_has_hw_pte_young() to enable optimization in MGLRU and
__wp_page_copy_user() when we have the PTE A/D bits hardware updating
support.

Co-developed-by: Jinyu Tang <tjytimi@163.com>
Signed-off-by: Jinyu Tang <tjytimi@163.com>
Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Link: https://lore.kernel.org/r/20240726084931.28924-2-yongxuan.wang@sifive.com
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/Kconfig
arch/riscv/include/asm/csr.h
arch/riscv/include/asm/hwcap.h
arch/riscv/include/asm/pgtable.h
arch/riscv/kernel/cpufeature.c