public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Guo Ren <guoren@kernel.org>
To: wangruikang@iscas.ac.cn
Cc: alex@ghiti.fr, gaohan@iscas.ac.cn, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, palmer@dabbelt.com,
	pjw@kernel.org
Subject: Re: [PATCH] riscv: mm: Do not probe satp mode limit if known in FDT
Date: Sat, 25 Apr 2026 02:02:51 +0000	[thread overview]
Message-ID: <20260425020253.3323599-1-guoren@kernel.org> (raw)
In-Reply-To: <20260424-riscv-mm-trust-fdt-mmu-type-v1-1-57f3313275d2@iscas.ac.cn>

> Some systems may only have memory at such a high address that an
> identity mapping cannot be made in Sv48, or even Sv57. To avoid crashing
> while probing satp mode support, trust the mmu-type property from FDT
> and avoid probing if it is set.
> 
> For example, if a CPU supports (up to) Sv57 but the SoC it is on only
> has memory starting at 128 TiB, an identity mapping cannot be made in
> Sv48. If the user specifies "no5lvl" on the command line,
> set_satp_mode() will attempt to test Sv48 support and crash, since the
> virtual address is too high. Instead, given the correct FDT CPU node
> property mmu-type = "riscv,sv57", set_satp_mode() can pick the maximum
> allowed mode from command line and FDT, namely Sv48, without probing.
> 
> Handling of mmu-type "riscv,sv57" in set_satp_mode_from_fdt() is added
> since it is now needed.
> 
> Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
> ---
> Tested on QEMU 10.2.2 on all 3*3 combinations of Sv39/Sv48/Sv57 and
> (none)/no4lvl/no5lvl.
> 
> In theory this could be a break if mmu-type is wrong, but so many other
> things would break if the FDT is wrong anyway.
> 
> Also note that this doesn't apply on ACPI since it is difficult to use
> ACPICA and read ACPI RHCT at this point, so that will just fall back to
> probing. Hopefully UEFI/ACPI + this atrocious SoC design never happens,
> since the high memory base address would prevent a lot of PCI(e) devices
> from working without an IOMMU. (Fingers crossed.)

Missing UEFI/ACPI is incorrect. RISC-V servers standardize on UEFI+ACPI.
We should support RHCT parsing instead of hoping high-memory ACPI systems
“never happen”.

Calling the high-memory SoC design “atrocious” is technically wrong and
concerning. The RISC-V spec explicitly allows DRAM at any physical address
(e.g. 128 TiB). With TB/PB-scale memory on the horizon, this is a valid SoC
choice.

This patch does not solve the problem at its root. The core issue is that
we are passing an invalid virtual address (VA) as input to satp mode
probing. Strengthening the VA check on the input side would fix it cleanly.

I already posted the fix for this exact issue three months ago: [1].
This should address both DT and UEFI/ACPI scenarios.

[1]: https://lore.kernel.org/linux-riscv/20260125055212.433163-1-guoren@kernel.org/

Best Regards
  GUO Ren

  reply	other threads:[~2026-04-25  2:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-24  3:03 [PATCH] riscv: mm: Do not probe satp mode limit if known in FDT Vivian Wang
2026-04-25  2:02 ` Guo Ren [this message]
2026-04-25  5:23   ` Vivian Wang
2026-04-25  6:32     ` Guo Ren

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=20260425020253.3323599-1-guoren@kernel.org \
    --to=guoren@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=gaohan@iscas.ac.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=wangruikang@iscas.ac.cn \
    /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