HomeFreeBSD

RISC-V: exclude reserved memory regions

Description

RISC-V: exclude reserved memory regions

The device tree may contain a "reserved-memory" node, whose purpose is
to communicate sections of physical memory that should not be used for
general allocations. Add the logic to parse and exclude these regions.

The particular motivation for this is protection of the SBI runtime
firmware. Currently, there is no mechanism through which the SBI
can communicate the details of its reserved memory region(s) to
a supervisor payload. There has been some discussion recently on how
this can be achieved [1], and it seems that the path going forward
will be to add an entry to the reserved-memory node.

This hasn't caused any issues for us yet, since we exclude all physical
memory below the kernel's load address from being allocated, and on all
currently supported platforms this covers the SBI firmware region. This
will change in another commit, so as a safety measure, ensure that the
lowest 2MB of memory is excluded if this region has not been reported.

[1] https://github.com/riscv/riscv-sbi-doc/pull/37

Reviewed by: markj, nick (older version)
Differential Revision: https://reviews.freebsd.org/D24155

Details

Provenance
mhorneAuthored on
Reviewer
markj
Differential Revision
D24155: RISC-V: exclude reserved memory regions
Parents
rS360083: RISC-V: use physmem to manage physical memory
Branches
Unknown
Tags
Unknown