From: Petr Tesarik <petrtesarik@huaweicloud.com>
To: linux-riscv@lists.infradead.org
Subject: How to deal with openSBI reserved regions?
Date: Fri, 28 Jul 2023 12:02:49 +0200 [thread overview]
Message-ID: <76ff0f51-d6c1-580d-f943-061e93073306@huaweicloud.com> (raw)
Hi all,
I have recently looked into enabling crash kernel and kdump on riscv64.
I can start a new kernel after crash, but I ran into an issue when
reading /proc/vmcore there.
I am testing this inside a QEMU VM and I boot my system in S-Mode using
U-Boot with mbedded openSBI firmware. The problem here is that openSBI
occupies the first 128 pages of RAM, but they are shown as "System RAM"
in /proc/iomem. The kexec_file_load(2) system call uses
walk_system_ram_res() to build a memory map of the currently running
kernel. This is then passed to the crash kernel through ELF core headers
as a LOAD segment. When reading the corresponding part of /proc/iomem,
the crash kernel tries to map these pages, but they can be accessed only
from M-Mode. Any attempt to access them from the Linux kernel fails with
a PMP violation. Consequently, -EFAULT is returned to user space.
Now, the openSBI area is represented in the Device Tree with a
reserved-memory node () which overlaps a memory node. Technically, the
firmware region is indeed RAM, but how should it be excluded from
/proc/iomem?
Should this be fixed in the kernel?
Or, is the provided DTB incorrect?
Should the memory node exclude the firmware area?
Petr T
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next reply other threads:[~2023-07-28 10:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 10:02 Petr Tesarik [this message]
2023-07-28 10:36 ` How to deal with openSBI reserved regions? Alexandre Ghiti
2023-07-31 10:06 ` Petr Tesarik
2023-07-28 10:52 ` Andreas Schwab
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=76ff0f51-d6c1-580d-f943-061e93073306@huaweicloud.com \
--to=petrtesarik@huaweicloud.com \
--cc=linux-riscv@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).