Skip to content

Commit f3243be

Browse files
pigmoralPaul Walmsley
authored andcommitted
riscv: mm: Return intended SATP mode for noXlvl options
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>
1 parent 4d4a3cc commit f3243be

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

arch/riscv/kernel/pi/cmdline_early.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ static char *get_early_cmdline(uintptr_t dtb_pa)
4141
static u64 match_noXlvl(char *cmdline)
4242
{
4343
if (strstr(cmdline, "no4lvl"))
44-
return SATP_MODE_48;
44+
return SATP_MODE_39;
4545
else if (strstr(cmdline, "no5lvl"))
46-
return SATP_MODE_57;
46+
return SATP_MODE_48;
4747

4848
return 0;
4949
}

arch/riscv/mm/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,9 +864,9 @@ static __init void set_satp_mode(uintptr_t dtb_pa)
864864

865865
kernel_map.page_offset = PAGE_OFFSET_L5;
866866

867-
if (satp_mode_cmdline == SATP_MODE_57) {
867+
if (satp_mode_cmdline == SATP_MODE_48) {
868868
disable_pgtable_l5();
869-
} else if (satp_mode_cmdline == SATP_MODE_48) {
869+
} else if (satp_mode_cmdline == SATP_MODE_39) {
870870
disable_pgtable_l5();
871871
disable_pgtable_l4();
872872
return;

0 commit comments

Comments
 (0)