mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yu Jin <lambda.jinyu@gmail.com>
To: linux-riscv@lists.infradead.org
Cc: Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>, Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Paul Walmsley <pjw@kernel.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Yu Jin <lambda.jinyu@gmail.com>
Subject: [RFC PATCH 1/2] docs: riscv: document the Sv32 virtual memory layout
Date: Mon, 31 Aug 2026 00:12:04 +0800	[thread overview]
Message-ID: <20260830161205.80162-2-lambda.jinyu@gmail.com> (raw)
In-Reply-To: <20260830161205.80162-1-lambda.jinyu@gmail.com>

The RISC-V virtual memory layout documentation describes the 64-bit
paging modes but leaves the Sv32 section as a TODO.

Document the rv32_defconfig layout and clarify which boundaries depend
on the configured size of struct page. Distinguish the maximum direct-map
range from the portion backed by physical memory. Also explain why the
34-bit physical addresses encoded by Sv32 page table entries do not make
all of that address space usable as RAM by the current RV32 kernel.

Signed-off-by: Yu Jin <lambda.jinyu@gmail.com>
---
 Documentation/arch/riscv/vm-layout.rst | 28 +++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/Documentation/arch/riscv/vm-layout.rst b/Documentation/arch/riscv/vm-layout.rst
index eabec99b5852..8e1447cf574e 100644
--- a/Documentation/arch/riscv/vm-layout.rst
+++ b/Documentation/arch/riscv/vm-layout.rst
@@ -16,7 +16,33 @@ RISC-V Linux Kernel 32bit
 RISC-V Linux Kernel SV32
 ------------------------
 
-TODO
+Sv32 provides a 4GB virtual address space, with the upper part used by the
+kernel. Unlike the 64-bit layouts, the kernel image is part of the direct
+mapping. The following layout is produced by ``rv32_defconfig``.
+
+::
+
+  ========================================================================================================================
+      Start addr    |   Offset   |     End addr     |  Size   | VM area description
+  ========================================================================================================================
+                    |            |                  |         |
+           00000000 |    0       |         9c7fffff | 2504 MB | user-space virtual memory, different per mm
+  __________________|____________|__________________|_________|___________________________________________________________
+                                                              |
+                                                              | Kernel-space virtual memory, shared between all processes:
+  ____________________________________________________________|___________________________________________________________
+                    |            |                  |         |
+           9c800000 | -1592   MB |         9cffffff |    8 MB | fixmap
+           9d000000 | -1584   MB |         9dffffff |   16 MB | PCI io
+           9e000000 | -1568   MB |         9fffffff |   32 MB | vmemmap-sized reserved area
+           a0000000 |   -1.5  GB |         bfffffff |  512 MB | vmalloc/ioremap/modules; BPF JIT uses the last 128 MB
+           c0000000 |   -1    GB |         ffffffff |    1 GB | direct mapping of physical memory
+  __________________|____________|__________________|_________|___________________________________________________________
+
+The layout before ``VMALLOC_START`` depends on the configured size of
+``struct page``. The direct mapping row shows its maximum range; usable RAM is
+limited by its mapped portion and the 32-bit ``phys_addr_t``, despite the
+34-bit physical addresses encoded by Sv32 page table entries.
 
 RISC-V Linux Kernel 64bit
 =========================
-- 
2.43.0


  reply	other threads:[~2026-08-30 16:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-30 16:12 [RFC PATCH 0/2] " Yu Jin
2026-08-30 16:12 ` Yu Jin [this message]
2026-08-30 16:12 ` [RFC PATCH 2/2] riscv: mm: correct the stale RV32 TASK_SIZE comment Yu Jin

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=20260830161205.80162-2-lambda.jinyu@gmail.com \
    --to=lambda.jinyu@gmail.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    /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®