]> www.infradead.org Git - users/hch/misc.git/commitdiff
riscv: mm: Return intended SATP mode for noXlvl options
authorJunhui Liu <junhui.liu@pigmoral.tech>
Mon, 21 Jul 2025 16:53:10 +0000 (00:53 +0800)
committerPaul Walmsley <pjw@kernel.org>
Wed, 17 Sep 2025 23:00:59 +0000 (17:00 -0600)
Change the return value of match_noXlvl() to return the SATP mode that
will be used, rather than the mode being disabled. This enables unified
logic for return value judgement with the function that obtains mmu-type
from the fdt, avoiding extra conversion. This only changes the naming,
with no functional impact.

Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Nutty Liu <liujingqi@lanxincomputing.com>
Link: https://lore.kernel.org/r/20250722-satp-from-fdt-v1-1-5ba22218fa5f@pigmoral.tech
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/kernel/pi/cmdline_early.c
arch/riscv/mm/init.c

index fbcdc9e4e14322af0cedd31343aeb9403ba2dd14..389d086a071876dde2fd57ee6f6661e65c38b7c4 100644 (file)
@@ -41,9 +41,9 @@ static char *get_early_cmdline(uintptr_t dtb_pa)
 static u64 match_noXlvl(char *cmdline)
 {
        if (strstr(cmdline, "no4lvl"))
-               return SATP_MODE_48;
+               return SATP_MODE_39;
        else if (strstr(cmdline, "no5lvl"))
-               return SATP_MODE_57;
+               return SATP_MODE_48;
 
        return 0;
 }
index 15683ae13fa5d121c850c20037984f237602a4d1..054265b3f2680382cb4027b85e2a2f8530ad9e08 100644 (file)
@@ -864,9 +864,9 @@ static __init void set_satp_mode(uintptr_t dtb_pa)
 
        kernel_map.page_offset = PAGE_OFFSET_L5;
 
-       if (satp_mode_cmdline == SATP_MODE_57) {
+       if (satp_mode_cmdline == SATP_MODE_48) {
                disable_pgtable_l5();
-       } else if (satp_mode_cmdline == SATP_MODE_48) {
+       } else if (satp_mode_cmdline == SATP_MODE_39) {
                disable_pgtable_l5();
                disable_pgtable_l4();
                return;