[Skiboot] [PATCH v3 26/29] fast-reboot: move fdt freeing into init

Nicholas Piggin npiggin at gmail.com
Wed Nov 29 16:37:04 AEDT 2017


---
 core/fast-reboot.c | 8 ++------
 core/init.c        | 8 +++++++-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index 2547e9086..83328eb97 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -61,9 +61,6 @@ static bool cpu_state_wait_all_others(enum cpu_thread_state state,
 	return true;
 }
 
-extern void *fdt;
-extern struct lock capi_lock;
-
 static const char *fast_reboot_disabled = NULL;
 
 void disable_fast_reboot(const char *reason)
@@ -104,10 +101,9 @@ void fast_reboot(void)
 		return;
 	}
 
-	prlog(PR_NOTICE, "RESET: Initiating fast reboot %d...\n", ++fast_reboot_count);
-
-	free(fdt);
+	/* Should mem_check() all regions before allowing fast reboot? */
 
+	prlog(PR_NOTICE, "RESET: Initiating fast reboot %d...\n", ++fast_reboot_count);
 	fast_boot_release = false;
 	sync();
 
diff --git a/core/init.c b/core/init.c
index 89a275812..51db180b0 100644
--- a/core/init.c
+++ b/core/init.c
@@ -501,8 +501,14 @@ void __noreturn load_and_boot_kernel(bool is_reboot)
 
 		/* Wait for FW VPD data read to complete */
 		fsp_code_update_wait_vpd(true);
-	} else
+
+	} else {
+		/* fdt will be rebuilt */
+		free(fdt);
+		fdt = NULL;
+
 		nvram_reinit();
+	}
 
 	fsp_console_select_stdout();
 
-- 
2.15.0



More information about the Skiboot mailing list