mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: guoren@kernel.org
To: guoren@kernel.org, palmer@dabbelt.com, bjorn@kernel.org,
	cuiyunhui@bytedance.com, samuel.holland@sifive.com,
	pjw@kernel.org, alex@ghiti.fr, fangyu.yu@linux.alibaba.com
Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
	"Alexandre Ghiti" <alexghiti@rivosinc.com>,
	"Björn Töpel" <bjorn@rivosinc.com>
Subject: [PATCH] riscv: mm: Fixup no5lvl fails on physical address base = 128TiB
Date: Sun, 18 Jan 2026 09:54:41 -0500	[thread overview]
Message-ID: <20260118145441.291302-1-guoren@kernel.org> (raw)

From: "Guo Ren (Alibaba DAMO Academy)" <guoren@kernel.org>

Unlike no4lvl, no5lvl still continues detect satp, which
requires va=pa mapping. When pa=0x800000000000, no5lvl
would fail in Sv48 mode due to an illegal VA value of
0x800000000000.

So, prevent detecting the satp flow for no5lvl, which is
the same as no4lvl. That means the user needs to know the
machine's exact mode when using no5lvl.

Fixes: 26e7aacb83df ("riscv: Allow to downgrade paging mode from the command line")
Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
Cc: Björn Töpel <bjorn@rivosinc.com>
Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@kernel.org>
---
 arch/riscv/mm/init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index addb8a9305be..6b526f1e276a 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -872,6 +872,7 @@ static __init void set_satp_mode(uintptr_t dtb_pa)
 
 	if (satp_mode_limit == SATP_MODE_48) {
 		disable_pgtable_l5();
+		return;
 	} else if (satp_mode_limit == SATP_MODE_39) {
 		disable_pgtable_l5();
 		disable_pgtable_l4();
-- 
2.40.1


                 reply	other threads:[~2026-01-18 14:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260118145441.291302-1-guoren@kernel.org \
    --to=guoren@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=alexghiti@rivosinc.com \
    --cc=bjorn@kernel.org \
    --cc=bjorn@rivosinc.com \
    --cc=cuiyunhui@bytedance.com \
    --cc=fangyu.yu@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=samuel.holland@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®