[PATCH] RISC-V: Allow the used to downgrade to sv48 when HW supports sv57

Palmer Dabbelt palmer at rivosinc.com
Fri Apr 22 14:10:55 PDT 2022


Similar to the previous patch, this allows a dt-selected downgrade to
sv48 on systems that support sv57 in case users don't need the extra VA
bits and want to save memory or improve performance.

Signed-off-by: Palmer Dabbelt <palmer at rivosinc.com>
---
This is on top of the patches from Alex's set that I dropped.
---
 arch/riscv/mm/init.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 16a0fa2e8432..33f7f9357ffa 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -740,6 +740,11 @@ static __init void set_satp_mode(uintptr_t dtb_pa)
 			if (!mmu_type)
 				continue;
 
+			if (!strcmp(mmu_type, "riscv,sv48")) {
+				disable_pgtable_l5();
+				return;
+			}
+
 			if (!strcmp(mmu_type, "riscv,sv39")) {
 				disable_pgtable_l5();
 				disable_pgtable_l4();
-- 
2.34.1




More information about the linux-riscv mailing list