diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-09-21 11:19:23 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-09-22 16:28:49 +1000 |
commit | 084f1deb99f10b210ac2751b60b65f35ffca2a22 (patch) | |
tree | df9fffd34dd113307e369a2492e5c816046cbd44 /include/mem_region.h | |
parent | 1e147dcdd6c0456ca0ab1f079898f2e90f90bdd1 (diff) | |
download | skiboot-084f1deb99f10b210ac2751b60b65f35ffca2a22.zip skiboot-084f1deb99f10b210ac2751b60b65f35ffca2a22.tar.gz skiboot-084f1deb99f10b210ac2751b60b65f35ffca2a22.tar.bz2 |
Ensure reserved memory ranges are exposed correctly to host (fix corrupted SLW image)
Memory regions in skiboot have an interesting life cycle. First, we get
a bunch from the initial device tree or hdat specifying some existing
reserved ranges (as well as adding some of our own if they're missing)
but we also get ranges for the entirety of RAM.
The idea is that we can do node local allocations for per node resources
(which we do) and then, just prior to booting linux, we copy the reserved
memory regions to expose to linux along with a set of reserver regions
to cover the node local allocations.
The problem was that mem_range_is_reserved() was wanting subtle different
semantics for memory region type than region_is_reserved() provided.
That is, we were overriding the meaning of REGION_SKIBOOT_HEAP to mean both
"this is reserved by skiboot" *and* "this is a memory region that covers
all of memory and will be shrunk to cover just the memory we have allocated
for it just before we boot the payload (linux)".
So what would happen is we would ask "hey, is the memory holding the SLW
image reserved?" and we'd get the answer of "yes" but referring to the memory
region that covers the entirety of memory in a NUMA node, *not* meaning
our intent of "this will be reserved when we start linux".
To fix this, introduce a new memory region type REGION_MEMORY. This has
the semantics of a memory region that covers a block of memory that we can
allocate from (using local_alloc) and that the part that was allocated
will be passed to linux as reserved, but that the entire range will not
be reserved.
So our new semantics are:
- region_is_reservable() is true if the region *MAY* be reserved
(i.e. is the regions that cover the whole of memory OR is explicitly reserved)
- region_is_reserved() is true if the region *WILL* be reserved
(i.e. is explicitly reserved)
This way we check that the SLW image is explicitly reserved and if it isn't,
we reserve it.
Fixes: 58033e44
Acked-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'include/mem_region.h')
-rw-r--r-- | include/mem_region.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/mem_region.h b/include/mem_region.h index 913dbb6..c34858e 100644 --- a/include/mem_region.h +++ b/include/mem_region.h @@ -25,6 +25,9 @@ enum mem_region_type { /* ranges allocatable by mem_alloc: this will be most of memory */ REGION_SKIBOOT_HEAP, + /* ranges allocatable by mem_alloc but shrunk (e.g. whole memory) */ + REGION_MEMORY, + /* ranges used explicitly for skiboot, but not allocatable. eg .text */ REGION_SKIBOOT_FIRMWARE, |