[Skiboot] [RFC PATCH 6/6] core/init: Allow setting size of payload in device-tree

Jordan Niethe jniethe5 at gmail.com
Wed Dec 18 15:49:11 AEDT 2019


When a kernel is preloaded by Mambo, the size is already known. Make
this available in the device-tree so that the size does not need to be
calculated from the elf by skiboot.

Signed-off-by: Jordan Niethe <jniethe5 at gmail.com>
---
 core/init.c                | 5 ++++-
 external/mambo/skiboot.tcl | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/init.c b/core/init.c
index 58e99c6163c1..419bfe28996b 100644
--- a/core/init.c
+++ b/core/init.c
@@ -415,7 +415,10 @@ static bool load_kernel(void)
 			memcpy_null(NULL, old_vectors, EXCEPTION_VECTORS_END);
 			sync_icache();
 		}
-		kernel_size = 0;
+		if (dt_has_node_property(dt_chosen, "kernel-size", NULL))
+			kernel_size = dt_prop_get_u64(dt_chosen, "kernel-size");
+		else
+			kernel_size = 0;
 	} else {
 		kernel_entry = (uint64_t)KERNEL_LOAD_BASE;
 		if (!kernel_size) {
diff --git a/external/mambo/skiboot.tcl b/external/mambo/skiboot.tcl
index f03ea4f4ef81..0fac2a14149a 100644
--- a/external/mambo/skiboot.tcl
+++ b/external/mambo/skiboot.tcl
@@ -674,6 +674,7 @@ mysim memory fread $mconf(payload_addr) $payload_size $mconf(payload)
 if { $payload_size > [expr $mconf(boot_load) - $mconf(payload_addr)] } {
 	error "vmlinux is too large, consider adjusting PAYLOAD_ADDR"
 }
+mysim of addprop $chosen_node array64 "kernel-size" payload_size
 
 # Flatten it
 epapr::of2dtb mysim $mconf(epapr_dt_addr)
-- 
2.17.1



More information about the Skiboot mailing list