[Skiboot] [PATCH] core/mem_region: Create reservations of type REGION_HW_RESERVED

Jeremy Kerr jk at ozlabs.org
Thu Jun 4 11:28:11 AEST 2015


All current users of mem_reserve are actually wanting HW_RESERVED
memory; these reservations are for memory initialised pre-skiboot.

This change marks these regions as REGION_HW_RESERVED instead of
REGION_RESERVED. We also rename mem_reserve to mem_reserve_hw to reflect
this change.

This fixes an issue where the PRD daemon cannot find reserved ranges
(eg, the homer image) that have been created by skiboot itself.

Signed-off-by: Jeremy Kerr <jk at ozlabs.org>

---
 core/mem_region.c                       |    4 ++--
 core/test/run-mem_region_reservations.c |    3 ++-
 hw/homer.c                              |    6 +++---
 include/mem_region.h                    |    2 +-
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/core/mem_region.c b/core/mem_region.c
index f6d5a7a..21c48bc 100644
--- a/core/mem_region.c
+++ b/core/mem_region.c
@@ -664,13 +664,13 @@ static bool add_region(struct mem_region *region)
 	return true;
 }
 
-void mem_reserve(const char *name, uint64_t start, uint64_t len)
+void mem_reserve_hw(const char *name, uint64_t start, uint64_t len)
 {
 	struct mem_region *region;
 	bool added;
 
 	lock(&mem_region_lock);
-	region = new_region(name, start, len, NULL, REGION_RESERVED);
+	region = new_region(name, start, len, NULL, REGION_HW_RESERVED);
 	assert(region);
 	added = add_region(region);
 	assert(added);
diff --git a/core/test/run-mem_region_reservations.c b/core/test/run-mem_region_reservations.c
index fcde110..59b6e06 100644
--- a/core/test/run-mem_region_reservations.c
+++ b/core/test/run-mem_region_reservations.c
@@ -208,7 +208,8 @@ int main(void)
 
 	/* create our reservations */
 	for (i = 0; i < ARRAY_SIZE(test_regions); i++)
-		mem_reserve(test_regions[i].name, test_regions[i].addr, 0x1000);
+		mem_reserve_hw(test_regions[i].name,
+				test_regions[i].addr, 0x1000);
 
 	/* release unused */
 	mem_region_release_unused();
diff --git a/hw/homer.c b/hw/homer.c
index 95ae73a..6d5544e 100644
--- a/hw/homer.c
+++ b/hw/homer.c
@@ -72,7 +72,7 @@ static void homer_init_chip(struct proc_chip *chip)
 	if (read_pba_bar(chip, 0, &hbase, &hsize)) {
 		prlog(PR_DEBUG, "  HOMER Image at 0x%llx size %lldMB\n",
 		      hbase, hsize / 0x100000);
-		mem_reserve("ibm,homer-image", hbase, hsize);
+		mem_reserve_hw("ibm,homer-image", hbase, hsize);
 
 		chip->homer_base = hbase;
 		chip->homer_size = hsize;
@@ -92,7 +92,7 @@ static void homer_init_chip(struct proc_chip *chip)
 		 */
 		if (sbase < hbase || sbase > (hbase + hsize) ||
 			(hbase == 0 && sbase > 0))
-			mem_reserve("ibm,slw-image", sbase, ssize);
+			mem_reserve_hw("ibm,slw-image", sbase, ssize);
 
 		chip->slw_base = sbase;
 		chip->slw_bar_size = ssize;
@@ -133,7 +133,7 @@ void homer_init(void)
 	chip = next_chip(NULL);
 	if (chip->homer_base && chip->occ_common_base) {
 		/* Reserve OCC comman area from BAR */
-		mem_reserve("ibm,occ-common-area", chip->occ_common_base,
+		mem_reserve_hw("ibm,occ-common-area", chip->occ_common_base,
 						chip->occ_common_size);
 	} else {
 		/* Allocate memory for HOMER and OCC common area */
diff --git a/include/mem_region.h b/include/mem_region.h
index e2827c3..d1da02a 100644
--- a/include/mem_region.h
+++ b/include/mem_region.h
@@ -70,7 +70,7 @@ void mem_region_init(void);
 void mem_region_add_dt_reserved(void);
 
 /* Mark memory as reserved */
-void mem_reserve(const char *name, uint64_t start, uint64_t len);
+void mem_reserve_hw(const char *name, uint64_t start, uint64_t len);
 
 struct mem_region *find_mem_region(const char *name);
 


More information about the Skiboot mailing list