[Skiboot] [PATCH 2/4] core/mem_region: mambo reserve kernel payload areas

Nicholas Piggin npiggin at gmail.com
Tue Sep 18 15:49:51 AEST 2018


Mambo image payloads get overwritten by the OS and by
fast reboot memory clearing because they have no region
defined. Add them, which allows fast reboot to work.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 core/fast-reboot.c |  4 +---
 core/mem_region.c  | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index e127b9bd..c3eb50ba 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -365,9 +365,7 @@ void __noreturn fast_reboot_entry(void)
 		 * preload.
 		 *
 		 * Mambo may have embedded payload here, so don't clear
-		 * it at all. The OS may have already overwritten it, so
-		 * mambo really should reserve memory regions for this, if
-		 * fast reboot is to work reliably.
+		 * it at all.
 		 */
 		memset(KERNEL_LOAD_BASE, 0, KERNEL_LOAD_SIZE);
 		memset(INITRAMFS_LOAD_BASE, 0, INITRAMFS_LOAD_SIZE);
diff --git a/core/mem_region.c b/core/mem_region.c
index bd387f3c..7aac4e1c 100644
--- a/core/mem_region.c
+++ b/core/mem_region.c
@@ -21,6 +21,7 @@
 #include <lock.h>
 #include <device.h>
 #include <cpu.h>
+#include <chip.h>
 #include <affinity.h>
 #include <types.h>
 #include <mem_region.h>
@@ -93,6 +94,21 @@ static struct mem_region skiboot_cpu_stacks = {
 	.type		= REGION_SKIBOOT_FIRMWARE,
 };
 
+static struct mem_region skiboot_mambo_kernel = {
+	.name		= "ibm,firmware-mambo-kernel",
+	.start		= (unsigned long)KERNEL_LOAD_BASE,
+	.len		= KERNEL_LOAD_SIZE,
+	.type		= REGION_SKIBOOT_FIRMWARE,
+};
+
+static struct mem_region skiboot_mambo_initramfs = {
+	.name		= "ibm,firmware-mambo-initramfs",
+	.start		= (unsigned long)INITRAMFS_LOAD_BASE,
+	.len		= INITRAMFS_LOAD_SIZE,
+	.type		= REGION_SKIBOOT_FIRMWARE,
+};
+
+
 struct alloc_hdr {
 	bool free : 1;
 	bool prev_free : 1;
@@ -1107,6 +1123,14 @@ void mem_region_init(void)
 		abort();
 	}
 
+	if (chip_quirk(QUIRK_MAMBO_CALLOUTS)) {
+		if (!add_region(&skiboot_mambo_kernel) ||
+		    !add_region(&skiboot_mambo_initramfs)) {
+			prerror("Out of memory adding mambo payload\n");
+			abort();
+		}
+	}
+
 	/* Add reserved reanges from HDAT */
 	list_for_each_safe(&early_reserves, region, next, list) {
 		bool added;
-- 
2.18.0



More information about the Skiboot mailing list