[Skiboot] [PATCH 07/18] fast-reboot: add sreset initiation error handling

Nicholas Piggin npiggin at gmail.com
Sun Nov 19 20:14:57 AEDT 2017


Change some return codes to OPAL_ errors, and also allow sreset_all_others
to fail.

Errors will revert to the IPL path, so it's not critical to completely
clean up everything if that would be complicated. Detecting the error
and failing is the important thing.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 core/fast-reboot.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index db94469b..3e8a4eb5 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -230,7 +230,7 @@ static int p8_sreset_all_prepare(void)
 	/* Assert special wakup on all cores. Only on operational cores. */
 	for_each_ungarded_primary(cpu) {
 		if (p8_set_special_wakeup(cpu) != OPAL_SUCCESS)
-			return false;
+			return OPAL_HARDWARE;
 	}
 
 	prlog(PR_DEBUG, "RESET: Stopping the world...\n");
@@ -241,7 +241,7 @@ static int p8_sreset_all_prepare(void)
 			p8_set_direct_ctl(cpu, P8_DIRECT_CTL_STOP);
 	}
 
-	return true;
+	return OPAL_SUCCESS;
 }
 
 static void p8_sreset_all_finish(void)
@@ -288,12 +288,12 @@ static void mambo_sreset_cpu(struct cpu_thread *cpu)
 static int sreset_all_prepare(void)
 {
 	if (chip_quirk(QUIRK_MAMBO_CALLOUTS))
-		return true;
+		return OPAL_SUCCESS;
 
 	if (proc_gen == proc_gen_p8)
 		return p8_sreset_all_prepare();
 
-	return false;
+	return OPAL_UNSUPPORTED;
 }
 
 static void sreset_all_finish(void)
@@ -305,28 +305,31 @@ static void sreset_all_finish(void)
 		return p8_sreset_all_finish();
 }
 
-static void sreset_all_others(void)
+static int sreset_all_others(void)
 {
 	if (chip_quirk(QUIRK_MAMBO_CALLOUTS)) {
 		struct cpu_thread *cpu;
 
 		for_each_ungarded_cpu(cpu)
 			mambo_sreset_cpu(cpu);
-		return;
+
+		return OPAL_SUCCESS;
 	}
 
 	if (proc_gen == proc_gen_p8) {
 		p8_sreset_all_others();
-		return;
+		return OPAL_SUCCESS;
 	}
 
+	return OPAL_UNSUPPORTED;
 }
 
 static bool fast_reset_p8(void)
 {
 	struct cpu_thread *cpu;
+	bool ret;
 
-	if (!sreset_all_prepare())
+	if (sreset_all_prepare())
 		return false;
 
 	/* Put everybody in stop except myself */
@@ -342,12 +345,12 @@ static bool fast_reset_p8(void)
 	setup_reset_vector();
 
 	/* Send everyone else to 0x100 */
-	sreset_all_others();
+	ret = (sreset_all_others() == OPAL_SUCCESS);
 
 	prlog(PR_DEBUG, "RESET: Releasing special wakeups...\n");
 	sreset_all_finish();
 
-	return true;
+	return ret;
 }
 
 extern void *fdt;
-- 
2.15.0



More information about the Skiboot mailing list