summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2018-09-18 15:49:51 +1000
committerStewart Smith <stewart@linux.ibm.com>2018-09-20 14:30:51 +1000
commit20126d2678123161b0d3cac44de452fef60386d6 (patch)
tree239de262b9b19d4909f073e6c5bd25f465236d19 /core
parent129e4408f7f4eb4d0a5f0dfc30dd5f25e5a629af (diff)
downloadtalos-skiboot-20126d2678123161b0d3cac44de452fef60386d6.tar.gz
talos-skiboot-20126d2678123161b0d3cac44de452fef60386d6.zip
core/mem_region: mambo reserve kernel payload areas
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@gmail.com> [stewart: fix up 'make check'] Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/fast-reboot.c4
-rw-r--r--core/mem_region.c24
-rw-r--r--core/test/run-malloc-speed.c1
-rw-r--r--core/test/run-malloc.c1
-rw-r--r--core/test/run-mem_range_is_reserved.c2
-rw-r--r--core/test/run-mem_region.c1
-rw-r--r--core/test/run-mem_region_init.c2
-rw-r--r--core/test/run-mem_region_next.c2
-rw-r--r--core/test/run-mem_region_release_unused.c2
-rw-r--r--core/test/run-mem_region_release_unused_noalloc.c2
-rw-r--r--core/test/run-mem_region_reservations.c2
11 files changed, 40 insertions, 3 deletions
diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index 8a1793f8..2d8dc028 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -376,9 +376,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;
diff --git a/core/test/run-malloc-speed.c b/core/test/run-malloc-speed.c
index 8ecef3a0..94e96e79 100644
--- a/core/test/run-malloc-speed.c
+++ b/core/test/run-malloc-speed.c
@@ -49,6 +49,7 @@ static inline void real_free(void *p)
char __rodata_start[1], __rodata_end[1];
struct dt_node *dt_root;
+enum proc_chip_quirks proc_chip_quirks;
void lock_caller(struct lock *l, const char *caller)
{
diff --git a/core/test/run-malloc.c b/core/test/run-malloc.c
index 0204e77d..cb68768c 100644
--- a/core/test/run-malloc.c
+++ b/core/test/run-malloc.c
@@ -51,6 +51,7 @@ static inline void real_free(void *p)
#define TEST_HEAP_SIZE (1ULL << TEST_HEAP_ORDER)
struct dt_node *dt_root;
+enum proc_chip_quirks proc_chip_quirks;
void lock_caller(struct lock *l, const char *caller)
{
diff --git a/core/test/run-mem_range_is_reserved.c b/core/test/run-mem_range_is_reserved.c
index f44f1c2d..15dc6cbc 100644
--- a/core/test/run-mem_range_is_reserved.c
+++ b/core/test/run-mem_range_is_reserved.c
@@ -53,6 +53,8 @@ static void real_free(void *p)
#include <assert.h>
#include <stdio.h>
+enum proc_chip_quirks proc_chip_quirks;
+
void lock_caller(struct lock *l, const char *caller)
{
(void)caller;
diff --git a/core/test/run-mem_region.c b/core/test/run-mem_region.c
index 1fd20937..4b3aff74 100644
--- a/core/test/run-mem_region.c
+++ b/core/test/run-mem_region.c
@@ -52,6 +52,7 @@ static inline void real_free(void *p)
#include <stdio.h>
struct dt_node *dt_root;
+enum proc_chip_quirks proc_chip_quirks;
void lock_caller(struct lock *l, const char *caller)
{
diff --git a/core/test/run-mem_region_init.c b/core/test/run-mem_region_init.c
index f70d70f8..b6d33f5a 100644
--- a/core/test/run-mem_region_init.c
+++ b/core/test/run-mem_region_init.c
@@ -59,6 +59,8 @@ static inline char *skiboot_strdup(const char *str)
#include <assert.h>
#include <stdio.h>
+enum proc_chip_quirks proc_chip_quirks;
+
void lock_caller(struct lock *l, const char *caller)
{
(void)caller;
diff --git a/core/test/run-mem_region_next.c b/core/test/run-mem_region_next.c
index fec5df8f..3228d4fd 100644
--- a/core/test/run-mem_region_next.c
+++ b/core/test/run-mem_region_next.c
@@ -48,6 +48,8 @@ static void real_free(void *p)
#include <assert.h>
#include <stdio.h>
+enum proc_chip_quirks proc_chip_quirks;
+
void lock_caller(struct lock *l, const char *caller)
{
(void)caller;
diff --git a/core/test/run-mem_region_release_unused.c b/core/test/run-mem_region_release_unused.c
index 4fe62ca5..1834a4c2 100644
--- a/core/test/run-mem_region_release_unused.c
+++ b/core/test/run-mem_region_release_unused.c
@@ -56,6 +56,8 @@ static inline void __free(void *p, const char *location __attribute__((unused)))
#include <assert.h>
#include <stdio.h>
+enum proc_chip_quirks proc_chip_quirks;
+
void lock_caller(struct lock *l, const char *caller)
{
(void)caller;
diff --git a/core/test/run-mem_region_release_unused_noalloc.c b/core/test/run-mem_region_release_unused_noalloc.c
index fe571350..9ee2742a 100644
--- a/core/test/run-mem_region_release_unused_noalloc.c
+++ b/core/test/run-mem_region_release_unused_noalloc.c
@@ -56,6 +56,8 @@ static inline void __free(void *p, const char *location __attribute__((unused)))
#include <assert.h>
#include <stdio.h>
+enum proc_chip_quirks proc_chip_quirks;
+
void lock_caller(struct lock *l, const char *caller)
{
(void)caller;
diff --git a/core/test/run-mem_region_reservations.c b/core/test/run-mem_region_reservations.c
index b0e48474..6cb13612 100644
--- a/core/test/run-mem_region_reservations.c
+++ b/core/test/run-mem_region_reservations.c
@@ -53,6 +53,8 @@ static void real_free(void *p)
#include <assert.h>
#include <stdio.h>
+enum proc_chip_quirks proc_chip_quirks;
+
void lock_caller(struct lock *l, const char *caller)
{
(void)caller;
OpenPOWER on IntegriCloud