aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2018-02-02 15:46:24 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2018-02-08 18:21:42 -0600
commitd2cc3957abef48f3afdf8ec61d69e87e3446d562 (patch)
tree5636662ffddd64e4a6fd45056a36ef6cf6e5e83f /core
parente88bb694d32e909960b1ae6f717265cc0aba8e4d (diff)
downloadskiboot-d2cc3957abef48f3afdf8ec61d69e87e3446d562.zip
skiboot-d2cc3957abef48f3afdf8ec61d69e87e3446d562.tar.gz
skiboot-d2cc3957abef48f3afdf8ec61d69e87e3446d562.tar.bz2
fast-reboot: move pci_reset error handling into fast-reboot code
pci_reset() currently does a platform reboot if it fails. It should not know about fast-reboot at this level, so instead have it return an error, and the fast reboot caller will do the platform reboot. The code essentially does the same thing, but flexibility is improved. Ideally the fast reboot code should perform pci_reset and all such fail-able operations before the CPU resets itself and destroys its own stack. That's not the case now, but that should be the goal. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Acked-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/fast-reboot.c13
-rw-r--r--core/pci.c11
2 files changed, 17 insertions, 7 deletions
diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index 1c76c08..382e781 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -348,7 +348,18 @@ void __noreturn fast_reboot_entry(void)
}
/* Remove all PCI devices */
- pci_reset();
+ if (pci_reset()) {
+ prlog(PR_NOTICE, "RESET: Fast reboot failed to reset PCI\n");
+
+ /*
+ * Can't return to caller here because we're past no-return.
+ * Attempt an IPL here which is what the caller would do.
+ */
+ if (platform.cec_reboot)
+ platform.cec_reboot();
+ for (;;)
+ ;
+ }
ipmi_set_fw_progress_sensor(IPMI_FW_PCI_INIT);
diff --git a/core/pci.c b/core/pci.c
index 0809521..494a33a 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1668,7 +1668,7 @@ static void __pci_reset(struct list_head *list)
}
}
-void pci_reset(void)
+int64_t pci_reset(void)
{
unsigned int i;
struct pci_slot *slot;
@@ -1695,11 +1695,9 @@ void pci_reset(void)
rc = slot->ops.run_sm(slot);
}
if (rc < 0) {
- PCIERR(phb, 0, "Complete reset failed, aborting"
- "fast reboot (rc=%lld)\n", rc);
- if (platform.cec_reboot)
- platform.cec_reboot();
- while (true) {}
+ PCIERR(phb, 0, "Complete reset failed "
+ "(rc=%lld)\n", rc);
+ return rc;
}
}
@@ -1710,6 +1708,7 @@ void pci_reset(void)
/* Re-Initialize all discovered PCI slots */
pci_init_slots();
+ return 0;
}
static void pci_do_jobs(void (*fn)(void *))