riscv-software-src/opensbi

Linux RISCV Kernel memory layout has changed in 6.4-rc1, has OpenSBI consider the changes?

david-sia opened this issue · 0 comments

In the past, the physical memory range from 0x80000000 to 0x80200000 was not usable for Linux. However, in Linux 6.4-rc1, it appears that the memory layout has changed. The memory range from 0x80000000 to 0x80200000 now seems to be usable by Linux, but it will cause a kernel crash if the kernel tries to access that memory range. This memory range is typically reserved by OpenSBI. Is there an updated documentation/patches available to OpenSBI?

Below is the Linux's PTDump

---[ Linear mapping ]--- [Start of Physical Addr]

0xff60000000000000-0xff60000000200000 0x0000000080000000 <<<<-------- This memory range is now visible to Linux, but it is reserved in OpenSBI

0xff60000000200000-0xff60000000c00000 0x0000000080200000

0xff60000000c00000-0xff60000001c00000 0x0000000080c00000

0xff60000001c00000-0xff60000002200000 0x0000000081c00000

0xff60000002200000-0xff60000040000000 0x0000000082200000

---[ Kernel mapping ]--- [Start of Physical Addr]

0xffffffff80000000-0xffffffff80a00000 0x0000000080200000

0xffffffff80a00000-0xffffffff80c00000 0x0000000080c00000

0xffffffff80c00000-0xffffffff81a00000 0x0000000080e00000

0xffffffff81a00000-0xffffffff82000000 0x0000000081c00000

0xffffffff82000000-0xffffffff82200000 0x0000000082200000

Below is the memory info from OpenSBI console:

Domain0 Name : root

Domain0 Boot HART : 1

Domain0 HARTs : 0*,1*

Domain0 Region00 : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: ()

Domain0 Region01 : 0x0000000080000000-0x000000008001ffff M: (R,X) S/U: () <<<<<<----- This memory range is not accessible to S/U mode

Domain0 Region02 : 0x0000000080020000-0x000000008003ffff M: (R,W) S/U: () <<<<<<----- This memory range is not accessible to S/U mode

Domain0 Region03 : 0x0000000000000000-0xffffffffffffffff M: (R,W,X) S/U: (R,W,X)

Domain0 Next Address : 0x0000000080200000