[Skiboot] [RFC/WIP/PATCH v2] Fast reboot for P8

Michael Neuling mikey at neuling.org
Wed Jul 27 15:31:31 AEST 2016


> This is an experimental patch that implements "Fast reboot" on P8
> machines.
> 
> The basic idea is that when the OS calls OPAL reboot, we gather all
> the threads in the system using a combination of patching the reset
> vector and soft-resetting them, then cleanup a few bits of hardware
> (we do re-probe PCIe for example), and reload & restart the bootloader.

Awesome!!!

FWIW This is an additional patch to get it to work with 1 CPU on mambo.  It
works nicely if you pass in a PNOR image via bogus disk. It'll reload the
kernel & petitboot on each reboot.

Mikey


diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index ce6c967..8991654 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -54,6 +54,8 @@ static int set_special_wakeup(struct cpu_thread *cpu)
 	core_id = pir_to_core_id(cpu->pir);
 
 	prlog(PR_DEBUG, "RESET Waking up core 0x%x\n", core_id);
+	if (chip_quirk(QUIRK_MAMBO_CALLOUTS))
+		return OPAL_SUCCESS;
 
 	/*
 	 * The original HWp reads the XSCOM first but ignores the result
@@ -165,6 +167,8 @@ static int clr_special_wakeup(struct cpu_thread *cpu)
 	core_id = pir_to_core_id(cpu->pir);
 
 	prlog(PR_DEBUG, "RESET: Releasing core 0x%x wakeup\n", core_id);
+	if (chip_quirk(QUIRK_MAMBO_CALLOUTS))
+		return OPAL_SUCCESS;
 
 	/*
 	 * The original HWp reads the XSCOM first but ignores the result
@@ -204,6 +208,9 @@ static void set_direct_ctl(struct cpu_thread *cpu, uint64_t bits)
 	uint32_t thread_id = pir_to_thread_id(cpu->pir);
 	uint32_t xscom_addr;
 
+	if (chip_quirk(QUIRK_MAMBO_CALLOUTS))
+		return;
+
 	xscom_addr = XSCOM_ADDR_P8_EX(core_id,
 				      P8_EX_TCTL_DIRECT_CONTROLS(thread_id));
 
@@ -301,10 +308,14 @@ void fast_reboot(void)
 	/* Unlock, at this point we go away */
 	unlock(&reset_lock);
 
-	if (success)
+	if (success) {
+		if (!next_cpu(first_cpu()))
+			/*  Only 1 CPU, so fake a reset of myself */
+			asm volatile("ba 0x100 " : : : );
 		/* Don't return */
 		for (;;)
 			;
+	}
 }
 
 static void cleanup_cpu_state(void)


More information about the Skiboot mailing list