From d3caa64c4ed364af1be1471ad3d67a6f310552d1 Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Mon, 24 Oct 2016 17:28:29 +1100 Subject: fast-reboot: disable on FSP code update or unrecoverable HMI Signed-off-by: Stewart Smith Reviewed-by: Andrew Donnellan [stewart@linux.vnet.ibm.com: unlock before return (suggested by Mahesh/Andrew), disable only on non-cancelling fsp codeupdate call (suggested by Vasant)] Signed-off-by: Stewart Smith --- core/fast-reboot.c | 19 +++++++++++++++++++ core/hmi.c | 2 ++ hw/fsp/fsp-codeupdate.c | 3 +++ include/skiboot.h | 1 + 4 files changed, 25 insertions(+) diff --git a/core/fast-reboot.c b/core/fast-reboot.c index 66b3182..12ebf5b 100644 --- a/core/fast-reboot.c +++ b/core/fast-reboot.c @@ -281,6 +281,16 @@ static bool fast_reset_p8(void) extern void *fdt; extern struct lock capi_lock; +static const char *fast_reboot_disabled = NULL; +static struct lock fast_reboot_disabled_lock = LOCK_UNLOCKED; + +void disable_fast_reboot(const char *reason) +{ + lock(&fast_reboot_disabled_lock); + fast_reboot_disabled = reason; + unlock(&fast_reboot_disabled_lock); +} + void fast_reboot(void) { bool success; @@ -298,6 +308,15 @@ void fast_reboot(void) return; } + lock(&fast_reboot_disabled_lock); + if (fast_reboot_disabled) { + prlog(PR_DEBUG, "RESET: Fast reboot disabled because %s\n", + fast_reboot_disabled); + unlock(&fast_reboot_disabled_lock); + return; + } + unlock(&fast_reboot_disabled_lock); + lock(&capi_lock); for_each_chip(chip) { if (chip->capp_phb3_attached_mask) { diff --git a/core/hmi.c b/core/hmi.c index 69403c6..6fe060d 100644 --- a/core/hmi.c +++ b/core/hmi.c @@ -836,6 +836,8 @@ int handle_hmi_exception(uint64_t hmer, struct OpalHMIEvent *hmi_evt) } } + if (recover == 0) + disable_fast_reboot("Unrecoverable HMI"); /* * HMER bits are sticky, once set to 1 they remain set to 1 until * they are set to 0. Reset the error source bit to 0, otherwise diff --git a/hw/fsp/fsp-codeupdate.c b/hw/fsp/fsp-codeupdate.c index 2263bf3..f17703a 100644 --- a/hw/fsp/fsp-codeupdate.c +++ b/hw/fsp/fsp-codeupdate.c @@ -1141,6 +1141,9 @@ static int64_t fsp_opal_update_flash(struct opal_sg_list *list) rc = OPAL_SUCCESS; goto out; } + + disable_fast_reboot("FSP Code Update"); + length = (be64_to_cpu(list->length) & ~(SG_LIST_VERSION << 56)) - 16; num_entries = length / sizeof(struct opal_sg_entry); if (num_entries <= 0) diff --git a/include/skiboot.h b/include/skiboot.h index 75c5207..97bdce7 100644 --- a/include/skiboot.h +++ b/include/skiboot.h @@ -190,6 +190,7 @@ extern unsigned long get_symbol(unsigned long addr, char **sym, char **sym_end); /* Fast reboot support */ +extern void disable_fast_reboot(const char *reason); extern void fast_reboot(void); extern void __noreturn __secondary_cpu_entry(void); extern void __noreturn load_and_boot_kernel(bool is_reboot); -- cgit v1.1