summaryrefslogtreecommitdiffstats
path: root/core/test/run-mem_region_init.c
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-09-21 11:19:23 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-09-22 16:28:49 +1000
commit084f1deb99f10b210ac2751b60b65f35ffca2a22 (patch)
treedf9fffd34dd113307e369a2492e5c816046cbd44 /core/test/run-mem_region_init.c
parent1e147dcdd6c0456ca0ab1f079898f2e90f90bdd1 (diff)
downloadblackbird-skiboot-084f1deb99f10b210ac2751b60b65f35ffca2a22.tar.gz
blackbird-skiboot-084f1deb99f10b210ac2751b60b65f35ffca2a22.zip
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 'core/test/run-mem_region_init.c')
-rw-r--r--core/test/run-mem_region_init.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/test/run-mem_region_init.c b/core/test/run-mem_region_init.c
index 7ab23d26..d780ae5d 100644
--- a/core/test/run-mem_region_init.c
+++ b/core/test/run-mem_region_init.c
@@ -164,7 +164,7 @@ int main(void)
r == &skiboot_os_reserve)
builtins++;
else
- assert(r->type == REGION_SKIBOOT_HEAP);
+ assert(r->type == REGION_MEMORY);
assert(mem_check(r));
}
assert(builtins == 5);
OpenPOWER on IntegriCloud