From patchwork Thu Aug 16 08:57:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 958203 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 41rgNW11Wyz9s3C for ; Thu, 16 Aug 2018 19:03:23 +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 41rgNV6t9fzF0xR for ; Thu, 16 Aug 2018 19:03:22 +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.156.1; 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 (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 41rgHX6dXDzF162 for ; Thu, 16 Aug 2018 18:59:04 +1000 (AEST) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w7G8wvKl101791 for ; Thu, 16 Aug 2018 04:59:02 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kw1pu1t03-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Aug 2018 04:58:58 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 16 Aug 2018 09:58:30 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) 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) Thu, 16 Aug 2018 09:58:29 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w7G8wRp624314016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 16 Aug 2018 08:58:27 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C1FB4C04E; Thu, 16 Aug 2018 11:58:32 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5D1944C05A; Thu, 16 Aug 2018 11:58:31 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.112]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 16 Aug 2018 11:58:31 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Thu, 16 Aug 2018 14:27:18 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180816085721.11703-1-hegdevasant@linux.vnet.ibm.com> References: <20180816085721.11703-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18081608-0008-0000-0000-000002629886 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18081608-0009-0000-0000-000021CAC2C5 Message-Id: <20180816085721.11703-16-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-08-16_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 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-1807170000 definitions=main-1808160096 Subject: [Skiboot] [PATCH v5 15/18] fadump: Send OPAL relocated base address to SBE X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stewart@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" OPAL relocates itself during boot. During memory preserving IPL hostboot needs to access relocated OPAL to get MDST, MDDT tables. Hence send relocated base address to SBE via 'stash MPIPL config' chip-op. During next IPL SBE will send stashed data to hostboot... so that hostboot can access these data. Signed-off-by: Vasant Hegde --- core/opal-mpipl.c | 4 ++++ hw/sbe-p9.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ include/sbe-p9.h | 6 ++++++ 3 files changed, 57 insertions(+) diff --git a/core/opal-mpipl.c b/core/opal-mpipl.c index 1779bc56f..f9287c713 100644 --- a/core/opal-mpipl.c +++ b/core/opal-mpipl.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -350,6 +351,9 @@ void opal_fadump_init(void) adjust_opal_dump_size(dump_node); + /* Send OPAL relocated base address to SBE */ + p9_sbe_send_relocated_base(SKIBOOT_BASE); + /* OPAL interface */ opal_register(OPAL_FADUMP_MANAGE, opal_fadump_manage, 3); } diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index d52ada15a..c193ed075 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -861,6 +861,53 @@ bool p9_sbe_timer_ok(void) return sbe_has_timer; } +static void p9_sbe_stash_chipop_resp(struct p9_sbe_msg *msg) +{ + int rc = p9_sbe_get_primary_rc(msg->resp); + struct p9_sbe *sbe = (void *)msg->user_data; + + if (rc == SBE_STATUS_PRI_SUCCESS) { + prlog(PR_DEBUG, "Sent stash MPIPL config [chip id =0x%x]\n", + sbe->chip_id); + } else { + prlog(PR_ERR, "Failed to send stash MPIPL config " + "[chip id = 0x%x, rc = %d]\n", sbe->chip_id, rc); + } + + p9_sbe_freemsg(msg); +} + +static void __p9_sbe_send_relocated_base(struct p9_sbe *sbe, u64 reloc_base) +{ + u8 key = SBE_STASH_KEY_SKIBOOT_BASE; + u16 cmd = SBE_CMD_STASH_MPIPL_CONFIG; + u16 flag = SBE_CMD_CTRL_RESP_REQ; + struct p9_sbe_msg *msg; + + msg = p9_sbe_mkmsg(cmd, flag, key, reloc_base, 0); + if (!msg) { + prlog(PR_DEBUG, "Message allocation failed\n"); + return; + } + msg->user_data = (void *)sbe; + if (p9_sbe_queue_msg(sbe->chip_id, msg, p9_sbe_stash_chipop_resp)) { + prlog(PR_ERR, "Failed to queue stash MPIPL config message\n"); + } +} + +/* Send relocated skiboot base address to all SBE */ +void p9_sbe_send_relocated_base(uint64_t reloc_base) +{ + struct proc_chip *chip; + + for_each_chip(chip) { + if (chip->sbe == NULL) + continue; + + __p9_sbe_send_relocated_base(chip->sbe, reloc_base); + } +} + void p9_sbe_init(void) { struct dt_node *xn; diff --git a/include/sbe-p9.h b/include/sbe-p9.h index 4b839d8ba..5f36cb39e 100644 --- a/include/sbe-p9.h +++ b/include/sbe-p9.h @@ -159,6 +159,9 @@ #define CONTROL_TIMER_START 0x0001 #define CONTROL_TIMER_STOP 0x0002 +/* Stash MPIPL config */ +#define SBE_STASH_KEY_SKIBOOT_BASE 0x03 + /* SBE message state */ enum p9_sbe_msg_state { sbe_msg_unused = 0, /* Free */ @@ -237,4 +240,7 @@ extern bool p9_sbe_timer_ok(void); /* Update SBE timer expiry */ 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 reloc_base); + #endif /* __SBE_P9_H */