linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* How to deal with openSBI reserved regions?
@ 2023-07-28 10:02 Petr Tesarik
  2023-07-28 10:36 ` Alexandre Ghiti
  2023-07-28 10:52 ` Andreas Schwab
  0 siblings, 2 replies; 4+ messages in thread
From: Petr Tesarik @ 2023-07-28 10:02 UTC (permalink / raw)
  To: linux-riscv

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-31 10:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 10:02 How to deal with openSBI reserved regions? Petr Tesarik
2023-07-28 10:36 ` Alexandre Ghiti
2023-07-31 10:06   ` Petr Tesarik
2023-07-28 10:52 ` Andreas Schwab

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).