From patchwork Wed Jun 6 05:35:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 925740 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 ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 410yDy3zR8z9s0W for ; Wed, 6 Jun 2018 15:40:18 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 410yDy2bdVzF2ZL for ; Wed, 6 Jun 2018 15:40:18 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 410y8Z2gz8zF30l for ; Wed, 6 Jun 2018 15:36:30 +1000 (AEST) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w565YIov071063 for ; Wed, 6 Jun 2018 01:36:28 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2je96hgvjc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 06 Jun 2018 01:36:28 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 6 Jun 2018 06:36:26 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 6 Jun 2018 06:36:24 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w565aNCV19202232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 6 Jun 2018 05:36:23 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9BE542049; Wed, 6 Jun 2018 06:26:44 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 93A444203F; Wed, 6 Jun 2018 06:26:43 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.210]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 6 Jun 2018 06:26:43 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 6 Jun 2018 11:05:33 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180606053535.8855-1-hegdevasant@linux.vnet.ibm.com> References: <20180606053535.8855-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060605-0008-0000-0000-000002449B61 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060605-0009-0000-0000-000021AAA3C7 Message-Id: <20180606053535.8855-17-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-06_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806060064 Subject: [Skiboot] [PATCH v3 16/18] fadump: Add support to trigger memory preserving IPL on BMC system X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 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" On FSP based system we call 'attn' instruction. FSP detects attention and initiates memory preserving IPL. On BMC system we have to call SBE s0 interrupt to initiate memory preserving IPL. This patch adds support to call s0 interrupt. Sequence : - s0 interrupt on slave chip SBE - s0 interrupt on master chip SBE Note: - This patch enables MPIPL support on witherspoon only. We will enable on other BMC systems later. - It uses xscom node to detect master and slave chip. So that we can trigger early MPIPL (even before initializing SBE driver). - At present we do not have a proper way to detect SBE is alive or not. So we wait for predefined time and then call normal reboot. Signed-off-by: Vasant Hegde --- hw/ipmi/ipmi-attn.c | 1 + hw/sbe-p9.c | 54 ++++++++++++++++++++++++++++++++++++++++++ include/sbe-p9.h | 10 ++++++++ platforms/astbmc/witherspoon.c | 3 ++- 4 files changed, 67 insertions(+), 1 deletion(-) diff --git a/hw/ipmi/ipmi-attn.c b/hw/ipmi/ipmi-attn.c index 8ff872c62..ed52e45ca 100644 --- a/hw/ipmi/ipmi-attn.c +++ b/hw/ipmi/ipmi-attn.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index 12d9e97ff..627ef428a 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -931,3 +932,56 @@ void p9_sbe_init(void) /* Initiate SBE timeout poller */ opal_add_poller(p9_sbe_timeout_poll, NULL); } + +/* Terminate and initiate MPIPL */ +void __attribute__((noreturn)) p9_sbe_terminate(const char *msg) +{ + uint32_t chip_id; + uint32_t primary_chip = -1; + int rc, waited = 0; + struct dt_node *xn; + + dt_for_each_compatible(dt_root, xn, "ibm,xscom") { + chip_id = dt_get_chip_id(xn); + + if (dt_has_node_property(xn, "primary", NULL)) { + primary_chip = chip_id; + continue;; + } + + rc = xscom_write(chip_id, + SBE_CONTROL_REG_RW, SBE_CONTROL_REG_S0); + /* Initiate normal reboot */ + if (rc) { + prlog(PR_ERR, "Failed to write S0 interrupt [chip id = %x]\n", + chip_id); + goto out_reboot; + } + } + + if (primary_chip == -1) { + prlog(PR_ERR, "Master chip ID not found.\n"); + goto out_reboot; + } + + /* Write S0 interrupt on master SBE */ + rc = xscom_write(primary_chip, + SBE_CONTROL_REG_RW, SBE_CONTROL_REG_S0); + /* Initiate normal reboot */ + if (rc) { + prlog(PR_ERR, "Failed to write S0 interrupt [chip id = %x]\n", + primary_chip); + goto out_reboot; + } + + /* XXX We do not have a way to detect SBE state. Hence wait for max + * time SBE takes to respond and then trigger normal reboot. + */ + while (waited <= SBE_CMD_TIMEOUT_MAX) { + time_wait_ms(100); + waited += 100; + } + +out_reboot: + ipmi_terminate(msg); +} diff --git a/include/sbe-p9.h b/include/sbe-p9.h index 7101dc700..14d7a3af4 100644 --- a/include/sbe-p9.h +++ b/include/sbe-p9.h @@ -103,6 +103,13 @@ #define SBE_HOST_TIMER_EXPIRY PPC_BIT(14) #define SBE_HOST_RESPONSE_MASK (PPC_BITMASK(0, 4) | SBE_HOST_TIMER_EXPIRY) +/* SBE Control Register */ +#define SBE_CONTROL_REG_RW 0x00050008 + +/* SBE interrupt s0/s1 bits */ +#define SBE_CONTROL_REG_S0 PPC_BIT(14) +#define SBE_CONTROL_REG_S1 PPC_BIT(15) + /* SBE Target Type */ #define SBE_TARGET_TYPE_PROC 0x00 #define SBE_TARGET_TYPE_EX 0x01 @@ -243,4 +250,7 @@ extern void p9_sbe_update_timer_expiry(uint64_t new_target); /* Send skiboot relocated base address to SBE */ extern void p9_sbe_send_relocated_base(uint64_t val); +/* Terminate and trigger MPIPL */ +extern void __attribute__((noreturn)) p9_sbe_terminate(const char *msg); + #endif /* __SBE_P9_H */ diff --git a/platforms/astbmc/witherspoon.c b/platforms/astbmc/witherspoon.c index cb09eefe0..30ec73157 100644 --- a/platforms/astbmc/witherspoon.c +++ b/platforms/astbmc/witherspoon.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "astbmc.h" @@ -166,7 +167,7 @@ DECLARE_PLATFORM(witherspoon) = { .cec_reboot = astbmc_ipmi_reboot, .elog_commit = ipmi_elog_commit, .exit = ipmi_wdt_final_reset, - .terminate = ipmi_terminate, + .terminate = p9_sbe_terminate, .pci_get_slot_info = dt_slot_get_slot_info, };