pmap_bootstrap() expects the kernel's physical load address, but we have
been providing the start of physical memory. This had the nice effect of
protecting the memory used by the SBI runtime firmware, but now that we
have alternate means of achieving that, we should provide the correct
value. This will free up any memory between the SBI firmware and the
kernel for allocation.
Details
- Reviewers
br markj - Group Reviewers
riscv - Commits
- rS360085: RISC-V: provide the correct value for kernstart
Here's the boot memory report before this patch set was applied:
real memory = 2147483648 (2047 MB) Physical memory chunk(s): 0x0000000080a96000 - 0x00000000821fffff, 24551424 bytes (5994 pages) 0x0000000082300000 - 0x00000000fcabefff, 2054942720 bytes (501695 pages) avail memory = 2069921792 (1974 MB)
Memory starts at 0x80000000, and the kernel is loaded to 0x80200000. As you can see, all memory below kernend has been excluded. This includes the SBI firmware loaded at 0x80000000, and the hole between it and the kernel. Additionally, there was the 1MB hole at 0x82200000, containing the DTB. Now with this patch set applied, we have:
real memory = 2147483648 (2048 MB) Physical memory chunk(s): 0x0000000080020000 - 0x00000000801fffff, 1966080 bytes (480 pages) 0x0000000080a97000 - 0x00000000fcaacfff, 2080464896 bytes (507926 pages) avail memory = 2072920064 (1976 MB)
The hole for the DTB has been reclaimed, since it now resides in the kernel's static allocations. The hole between the end of the SBI firmware and the beginning of the kernel can also be reclaimed, as long as the firmware reports its reserved memory via FDT. In total we regain 2MB for general allocations, and the calculation of realmem is fixed to report the correct size.
Finally, by switching to arm's physmem interface, we can exclude OpenSBI firmware from minidumps:
Excluded memory regions: 0x80000000 - 0x8001ffff, 0 MB ( 32 pages) NoAlloc NoDump 0x80200000 - 0x80a96fff, 8 MB ( 2199 pages) NoAlloc
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable