From patchwork Tue Oct 25 08:26:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 686368 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3t35q63z4jz9t87 for ; Tue, 25 Oct 2016 19:26:58 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3t35q62yQQzDvlg for ; Tue, 25 Oct 2016 19:26:58 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3t35q20R5rzDvhT for ; Tue, 25 Oct 2016 19:26:53 +1100 (AEDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9P8NdaQ035328 for ; Tue, 25 Oct 2016 04:26:52 -0400 Received: from e37.co.us.ibm.com (e37.co.us.ibm.com [32.97.110.158]) by mx0a-001b2d01.pphosted.com with ESMTP id 269wee0f05-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 25 Oct 2016 04:26:52 -0400 Received: from localhost by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 25 Oct 2016 02:26:51 -0600 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 25 Oct 2016 02:26:50 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id DF48F19D8026 for ; Tue, 25 Oct 2016 02:26:14 -0600 (MDT) Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9P8QnEP15925728; Tue, 25 Oct 2016 01:26:49 -0700 Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 96977C6043; Tue, 25 Oct 2016 02:26:48 -0600 (MDT) Received: from birb.localdomain (unknown [9.83.7.67]) by b03ledav006.gho.boulder.ibm.com (Postfix) with SMTP id DF7E4C6042; Tue, 25 Oct 2016 02:26:47 -0600 (MDT) Received: from ka1.ozlabs.ibm.com (localhost.localdomain [127.0.0.1]) by birb.localdomain (Postfix) with ESMTP id 08E4E229DB26; Tue, 25 Oct 2016 19:26:44 +1100 (AEDT) From: Stewart Smith To: skiboot@lists.ozlabs.org Date: Tue, 25 Oct 2016 19:26:43 +1100 X-Mailer: git-send-email 2.1.4 In-Reply-To: <1477290509-31620-1-git-send-email-stewart@linux.vnet.ibm.com> References: <1477290509-31620-1-git-send-email-stewart@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16102508-0024-0000-0000-000014DB471D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005975; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000188; SDB=6.00772446; UDB=6.00370767; IPR=6.00549265; BA=6.00004831; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013098; XFM=3.00000011; UTC=2016-10-25 08:26:51 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16102508-0025-0000-0000-00004594397C Message-Id: <1477384003-9356-1-git-send-email-stewart@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-25_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610250142 Subject: [Skiboot] [PATCH v2] fast-reboot: disable on FSP code update or unrecoverable HMI X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 | 2 ++ include/skiboot.h | 1 + 4 files changed, 24 insertions(+) diff --git a/core/fast-reboot.c b/core/fast-reboot.c index 66b31824c9eb..12ebf5b65f0a 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 69403c6db350..6fe060dc7c56 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 2263bf36dcc8..ae1c4b6c5a42 100644 --- a/hw/fsp/fsp-codeupdate.c +++ b/hw/fsp/fsp-codeupdate.c @@ -1126,6 +1126,8 @@ static int64_t fsp_opal_update_flash(struct opal_sg_list *list) struct opal_sg_entry *entry; int length, num_entries, result = 0, rc = OPAL_PARAMETER; + disable_fast_reboot("FSP Code Update"); + /* Ensure that the sg list honors our alignment requirements */ rc = validate_sglist(list); if (rc) { diff --git a/include/skiboot.h b/include/skiboot.h index 75c5207f9c1f..97bdce784eaf 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);