From patchwork Fri Jul 12 11:17:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131280 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVmj3yklz9sLt for ; Fri, 12 Jul 2019 21:19:01 +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 45lVmh1gTCzDqg7 for ; Fri, 12 Jul 2019 21:19:00 +1000 (AEST) 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 45lVlv1hM2zDqvT for ; Fri, 12 Jul 2019 21:18:18 +1000 (AEST) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBHaX5077412 for ; Fri, 12 Jul 2019 07:18:16 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tpqya3hvg-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:16 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:14 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:12 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIBNT30539946 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:11 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 42DA84C05E; Fri, 12 Jul 2019 11:18:11 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 030374C046; Fri, 12 Jul 2019 11:18:09 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:08 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:38 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0012-0000-0000-0000033213F9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0013-0000-0000-0000216B8402 Message-Id: <20190712111802.23560-2-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 01/25] OPAL: Add OPAL boot entry address to device tree X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Needed for creating OPAL core file. Sample output: -------------- sys/firmware/devicetree/base/ibm,opal # lsprop ... opal-boot-address 00000000 30002560 ... Signed-off-by: Vasant Hegde --- core/opal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/opal.c b/core/opal.c index 650811642..73b87caa6 100644 --- a/core/opal.c +++ b/core/opal.c @@ -1,4 +1,4 @@ -/* Copyright 2013-2014 IBM Corp. +/* Copyright 2013-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -384,6 +384,7 @@ void add_opal_node(void) { uint64_t base, entry, size; extern uint32_t opal_entry; + extern uint32_t boot_entry; struct dt_node *opal_event; /* XXX TODO: Reorg this. We should create the base OPAL @@ -413,6 +414,7 @@ void add_opal_node(void) dt_add_property_cells(opal_node, "opal-msg-size", OPAL_MSG_SIZE); dt_add_property_u64(opal_node, "opal-base-address", base); dt_add_property_u64(opal_node, "opal-entry-address", entry); + dt_add_property_u64(opal_node, "opal-boot-address", (uint64_t)&boot_entry); dt_add_property_u64(opal_node, "opal-runtime-size", size); /* Add irqchip interrupt controller */ From patchwork Fri Jul 12 11:17:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131286 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVnk6gQ5z9sBF for ; Fri, 12 Jul 2019 21:19:54 +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 45lVnk3ZPXzDqdl for ; Fri, 12 Jul 2019 21:19:54 +1000 (AEST) 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 45lVm11r0BzDqdl for ; Fri, 12 Jul 2019 21:18:25 +1000 (AEST) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGXXg040019 for ; Fri, 12 Jul 2019 07:18:21 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tps488a82-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:21 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:16 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:14 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIDJs54264028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:14 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D504B4C04A; Fri, 12 Jul 2019 11:18:13 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B0EFF4C05A; Fri, 12 Jul 2019 11:18:11 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:11 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:39 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0012-0000-0000-0000033213FC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0013-0000-0000-0000216B8404 Message-Id: <20190712111802.23560-3-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 02/25] FSP/MDST: Rename fsp-mdst-table.c -> fsp-sysdump.c X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" MDST is a ntuple inside SPIRAH. Its just a interface to pass memory ranges to be captured as part of dump to FSP/Hostboot. Today OPAL is using MDST ntuple to pass list of memory region (mostly OPAL console and host dmesg) to be collected as part of SYSDUMP. Soon we are going to support OPAL MPIPL feature (aka Memory Preserving IPL). Even MPIPL uses MDST/MDDT table. Hence rename files based on feature instead of some table name: - fsp-mdst-table.c -> fsp-sysdump.c - fsp-mdst-table.h -> opal-dump.h (This will cater both SYSDUMP and MPIPL) - Rename structure -> dump_mdst_table -> mdst_table This patch does renaming and header file adjustment. No functionality changes. Signed-off-by: Vasant Hegde --- hdata/spira.c | 6 +++--- hw/fsp/Makefile.inc | 2 +- hw/fsp/{fsp-mdst-table.c => fsp-sysdump.c} | 8 ++++---- include/{fsp-mdst-table.h => opal-dump.h} | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) rename hw/fsp/{fsp-mdst-table.c => fsp-sysdump.c} (98%) rename include/{fsp-mdst-table.h => opal-dump.h} (87%) diff --git a/hdata/spira.c b/hdata/spira.c index 6891a9c71..8986acc33 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 IBM Corp. +/* Copyright 2013-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -89,7 +89,7 @@ __section(".cpuctrl.data") struct cpu_ctl_init_data cpu_ctl_init_data = { * addresses, we set the top bit to 1 on physical addresses */ -__section(".mdst.data") struct dump_mdst_table init_mdst_table[2] = { +__section(".mdst.data") struct mdst_table init_mdst_table[2] = { { .addr = CPU_TO_BE64(INMEM_CON_START | HRMOR_BIT), .type = CPU_TO_BE32(DUMP_REGION_CONSOLE), diff --git a/hw/fsp/Makefile.inc b/hw/fsp/Makefile.inc index b078a4d76..21dc52a9f 100644 --- a/hw/fsp/Makefile.inc +++ b/hw/fsp/Makefile.inc @@ -4,7 +4,7 @@ FSP_OBJS = fsp.o fsp-console.o fsp-rtc.o fsp-nvram.o fsp-sysparam.o FSP_OBJS += fsp-surveillance.o fsp-codeupdate.o fsp-sensor.o FSP_OBJS += fsp-diag.o fsp-leds.o fsp-mem-err.o fsp-op-panel.o FSP_OBJS += fsp-elog-read.o fsp-elog-write.o fsp-epow.o fsp-dpo.o -FSP_OBJS += fsp-dump.o fsp-mdst-table.o fsp-chiptod.o fsp-ipmi.o +FSP_OBJS += fsp-dump.o fsp-sysdump.o fsp-chiptod.o fsp-ipmi.o FSP_OBJS += fsp-attn.o fsp-occ.o fsp-psi.o FSP = hw/fsp/built-in.a diff --git a/hw/fsp/fsp-mdst-table.c b/hw/fsp/fsp-sysdump.c similarity index 98% rename from hw/fsp/fsp-mdst-table.c rename to hw/fsp/fsp-sysdump.c index 0f145ba55..876c041ba 100644 --- a/hw/fsp/fsp-mdst-table.c +++ b/hw/fsp/fsp-sysdump.c @@ -1,4 +1,4 @@ -/* Copyright 2013-2014 IBM Corp. +/* Copyright 2013-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ #include #include #include -#include +#include /* * Sapphire dump size @@ -60,8 +60,8 @@ DEFINE_LOG_ENTRY(OPAL_RC_DUMP_MDST_REMOVE, OPAL_PLATFORM_ERR_EVT, OPAL_DUMP, OPAL_PLATFORM_FIRMWARE, OPAL_INFO, OPAL_NA); -static struct dump_mdst_table *mdst_table; -static struct dump_mdst_table *dump_mem_region; +static struct mdst_table *mdst_table; +static struct mdst_table *dump_mem_region; static int cur_mdst_entry; static int max_mdst_entry; diff --git a/include/fsp-mdst-table.h b/include/opal-dump.h similarity index 87% rename from include/fsp-mdst-table.h rename to include/opal-dump.h index 5989cdb73..b34ae77ab 100644 --- a/include/fsp-mdst-table.h +++ b/include/opal-dump.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2014 IBM Corp. +/* Copyright 2013-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,8 @@ */ -#ifndef __FSPMDST_H -#define __FSPMDST_H +#ifndef __OPAL_DUMP_H +#define __OPAL_DUMP_H /* * Dump region ids @@ -39,10 +39,10 @@ * Format of this table is same as Memory Dump Source Table (MDST) * defined in HDAT spec. */ -struct dump_mdst_table { +struct mdst_table { __be64 addr; - __be32 type; /* DUMP_SECTION_* */ + __be32 type; /* DUMP_REGION_* */ __be32 size; }; -#endif /* __FSPMDST_H */ +#endif /* __OPAL_DUMP_H */ From patchwork Fri Jul 12 11:17:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131285 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVnC2CDKz9sBF for ; Fri, 12 Jul 2019 21:19:27 +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 45lVnC0nnTzDqgZ for ; Fri, 12 Jul 2019 21:19:27 +1000 (AEST) 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 45lVm05360zDqdd for ; Fri, 12 Jul 2019 21:18:24 +1000 (AEST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGf91062646 for ; Fri, 12 Jul 2019 07:18:22 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tpr7pamwm-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:22 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:20 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:17 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBI3mO30671168 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:03 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5EC064C04A; Fri, 12 Jul 2019 11:18:16 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 39AFD4C04E; Fri, 12 Jul 2019 11:18:14 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:14 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:40 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-4275-0000-0000-0000034C742F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-4276-0000-0000-0000385C7E2F Message-Id: <20190712111802.23560-4-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 03/25] hdata: Split MDST 'type' field to accommodate MPIPL X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The MPIPL facility needs to store region and type information corresponding with each MDST entry. - data region : dump data regions (like DUMP_REGION_* ) - dump type : Reflects MDST entry usage (used by SYSDUMP -OR- FADUMP) The existing type field is currently not used by FSP and/or firmware, so it is safe to re-purpose it. Signed-off-by: Vasant Hegde --- hdata/spira.c | 6 ++++-- hw/fsp/fsp-sysdump.c | 8 ++++---- include/opal-dump.h | 18 +++++++++++++----- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/hdata/spira.c b/hdata/spira.c index 8986acc33..d903ac83b 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -92,12 +92,14 @@ __section(".cpuctrl.data") struct cpu_ctl_init_data cpu_ctl_init_data = { __section(".mdst.data") struct mdst_table init_mdst_table[2] = { { .addr = CPU_TO_BE64(INMEM_CON_START | HRMOR_BIT), - .type = CPU_TO_BE32(DUMP_REGION_CONSOLE), + .data_region = DUMP_REGION_CONSOLE, + .dump_type = DUMP_TYPE_SYSDUMP, .size = CPU_TO_BE32(INMEM_CON_LEN), }, { .addr = CPU_TO_BE64(HBRT_CON_START | HRMOR_BIT), - .type = CPU_TO_BE32(DUMP_REGION_HBRT_LOG), + .data_region = DUMP_REGION_HBRT_LOG, + .dump_type = DUMP_TYPE_SYSDUMP, .size = CPU_TO_BE32(HBRT_CON_LEN), }, }; diff --git a/hw/fsp/fsp-sysdump.c b/hw/fsp/fsp-sysdump.c index 876c041ba..395549acf 100644 --- a/hw/fsp/fsp-sysdump.c +++ b/hw/fsp/fsp-sysdump.c @@ -114,7 +114,7 @@ static int dump_region_tce_map(void) fsp_tce_map(PSI_DMA_HYP_DUMP + t_size, (void *)addr, size); /* Add entry to MDST table */ - mdst_table[i].type = dump_mem_region[i].type; + mdst_table[i].data_region = dump_mem_region[i].data_region; mdst_table[i].size = dump_mem_region[i].size; mdst_table[i].addr = cpu_to_be64(PSI_DMA_HYP_DUMP + t_size); @@ -194,7 +194,7 @@ static int dump_region_del_entry(uint32_t id) lock(&mdst_lock); for (i = 0; i < cur_mdst_entry; i++) { - if (be32_to_cpu(dump_mem_region[i].type) != id) + if (dump_mem_region[i].data_region != id) continue; found = true; @@ -214,7 +214,7 @@ static int dump_region_del_entry(uint32_t id) for ( ; i < cur_mdst_entry - 1; i++) dump_mem_region[i] = dump_mem_region[i + 1]; - dump_mem_region[i].type = 0; + dump_mem_region[i].data_region = 0; cur_mdst_entry--; del_out: @@ -251,7 +251,7 @@ static int __dump_region_add_entry(uint32_t id, uint64_t addr, uint32_t size) } /* Add entry to dump memory region table */ - dump_mem_region[cur_mdst_entry].type = cpu_to_be32(id); + dump_mem_region[cur_mdst_entry].data_region = (u8)cpu_to_be32(id); dump_mem_region[cur_mdst_entry].addr = cpu_to_be64(addr); dump_mem_region[cur_mdst_entry].size = cpu_to_be32(size); diff --git a/include/opal-dump.h b/include/opal-dump.h index b34ae77ab..b75e3a2cb 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -21,28 +21,36 @@ /* * Dump region ids * - * 0x01 - 0x7F : OPAL + * 0x01 - 0x3F : OPAL + * 0x40 - 0x7F : Reserved for future use * 0x80 - 0xFF : Kernel * */ #define DUMP_REGION_OPAL_START 0x01 -#define DUMP_REGION_OPAL_END 0x7F +#define DUMP_REGION_OPAL_END 0x3F #define DUMP_REGION_HOST_START OPAL_DUMP_REGION_HOST_START #define DUMP_REGION_HOST_END OPAL_DUMP_REGION_HOST_END #define DUMP_REGION_CONSOLE 0x01 #define DUMP_REGION_HBRT_LOG 0x02 +/* Mainstore memory to be captured by FSP SYSDUMP */ +#define DUMP_TYPE_SYSDUMP 0xF5 +/* Mainstore memory to preserve during IPL */ +#define DUMP_TYPE_MPIPL 0x00 + /* - * Sapphire Memory Dump Source Table + * Memory Dump Source Table * * Format of this table is same as Memory Dump Source Table (MDST) * defined in HDAT spec. */ struct mdst_table { __be64 addr; - __be32 type; /* DUMP_REGION_* */ + uint8_t data_region; /* DUMP_REGION_* */ + uint8_t dump_type; /* DUMP_TYPE_* */ + __be16 reserved; __be32 size; -}; +} __packed; #endif /* __OPAL_DUMP_H */ From patchwork Fri Jul 12 11:17:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131289 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVpB3Tytz9sBF for ; Fri, 12 Jul 2019 21:20: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 45lVpB12xpzDqfC for ; Fri, 12 Jul 2019 21:20:18 +1000 (AEST) 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 45lVm26pSVzDqdd for ; Fri, 12 Jul 2019 21:18:26 +1000 (AEST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBHf3q012819 for ; Fri, 12 Jul 2019 07:18:24 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tpp0b0h5t-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:24 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:22 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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) Fri, 12 Jul 2019 12:18:19 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIIUY40435940 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:18 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C35DF4C052; Fri, 12 Jul 2019 11:18:18 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AEBAA4C04E; Fri, 12 Jul 2019 11:18:16 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:16 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:41 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0008-0000-0000-000002FCB245 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0009-0000-0000-0000226A1DCF Message-Id: <20190712111802.23560-5-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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=900 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 04/25] hdata: Define various DUMP related structures X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" - MDDT is used by OPAL to pass destination memory details to hostboot. - MDRT is used by hostboot to pass post dump result table to OPAL. - Processor dump area is used to capture architected register data. Signed-off-by: Vasant Hegde --- hdata/spira.c | 1 + hdata/spira.h | 5 ++-- include/opal-dump.h | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/hdata/spira.c b/hdata/spira.c index d903ac83b..6fbe8cd05 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1571,6 +1571,7 @@ static void fixup_spira(void) spira.ntuples.mdump_src = spirah.ntuples.mdump_src; spira.ntuples.mdump_dst = spirah.ntuples.mdump_dst; spira.ntuples.mdump_res = spirah.ntuples.mdump_res; + spira.ntuples.proc_dump_area = spirah.ntuples.proc_dump_area; spira.ntuples.pcia = spiras->ntuples.pcia; spira.ntuples.proc_chip = spiras->ntuples.proc_chip; spira.ntuples.hs_data = spiras->ntuples.hs_data; diff --git a/hdata/spira.h b/hdata/spira.h index 09de4dadd..84bbcfee0 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2017 IBM Corp. +/* Copyright 2013-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,6 +76,7 @@ struct spira_ntuples { struct spira_ntuple hs_data; /* 0x320 */ struct spira_ntuple ipmi_sensor; /* 0x360 */ struct spira_ntuple node_stb_data; /* 0x380 */ + struct spira_ntuple proc_dump_area; /* 0x400 */ }; struct spira { @@ -89,7 +90,7 @@ struct spira { * * According to FSP engineers, this is an okay thing to do. */ - u8 reserved[0x80]; + u8 reserved[0x60]; } __packed __align(0x100); extern struct spira spira; diff --git a/include/opal-dump.h b/include/opal-dump.h index b75e3a2cb..ccf49f953 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -53,4 +53,71 @@ struct mdst_table { __be32 size; } __packed; +/* Memory dump destination table (MDDT) */ +struct mddt_table { + __be64 addr; + uint8_t data_region; + uint8_t dump_type; + __be16 reserved; + __be32 size; +} __packed; + +/* + * Memory dump result table (MDRT) + * + * List of the memory ranges that have been included in the dump. This table is + * filled by hostboot and passed to OPAL on second boot. OPAL/payload will use + * this table to extract the dump. + */ +struct mdrt_table { + __be64 src_addr; + __be64 dest_addr; + uint8_t data_region; + uint8_t dump_type; + __be16 reserved; + __be32 size; + __be64 padding; +} __packed; + +/* + * Processor Dump Area + * + * This contains the information needed for having processor + * state captured during a platform dump. + */ +struct proc_dump_area { + __be32 thread_size; /* Size of each thread register entry */ +#define PROC_DUMP_AREA_FORMAT_P9 0x1 /* P9 format */ + uint8_t version; /* P9 - 0x1 */ + uint8_t reserved[11]; + __be64 alloc_addr; /* Destination memory to place register data */ + __be32 reserved2; + __be32 alloc_size; /* Allocated size */ + __be64 dest_addr; /* Destination address */ + __be32 reserved3; + __be32 act_size; /* Actual data size */ +} __packed; + +struct proc_reg_data_hdr { + /* PIR value of the thread */ + __be32 pir; + /* 0x00 - 0x0F - The corresponding stop state of the core */ + uint8_t core_state; + uint8_t reserved[3]; + + uint32_t offset; /* Offset to Register Entries array */ + uint32_t ecnt; /* Number of entries */ + uint32_t esize; /* Alloc size of each array entry in bytes */ + uint32_t eactsz; /* Actual size of each array entry in bytes */ +} __packed; + +/* Architected register data content */ +#define ARCH_REG_TYPE_GPR 0x01 +#define ARCH_REG_TYPE_SPR 0x02 +struct proc_reg_data { + uint32_t reg_type; /* ARCH_REG_TYPE_* */ + uint32_t reg_num; + uint64_t reg_val; +} __packed; + #endif /* __OPAL_DUMP_H */ From patchwork Fri Jul 12 11:17:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131292 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVpX0ySrz9sBF for ; Fri, 12 Jul 2019 21:20:36 +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 45lVpW6PM2zDqdv for ; Fri, 12 Jul 2019 21:20:35 +1000 (AEST) 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 45lVm46hYtzDqdd for ; Fri, 12 Jul 2019 21:18:28 +1000 (AEST) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGViv039883 for ; Fri, 12 Jul 2019 07:18:26 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tps488af0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:26 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:24 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:22 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBILfP47055012 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:21 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3882C4C04A; Fri, 12 Jul 2019 11:18:21 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C03E4C04E; Fri, 12 Jul 2019 11:18:19 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:18 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:42 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0028-0000-0000-00000383B698 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0029-0000-0000-00002443CE0E Message-Id: <20190712111802.23560-6-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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=535 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 05/25] mem-map: Setup memory for MDDT table X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Each entry in MDST and MDDT takes 16 bytes. With 1K we can have upto 64 entries. This is sufficient to support OPAL MPIPL (memory preserving IPL). Presently OPAL reserves 2K memory for MDST table. Lets split this into two region of 1K for MDST and MDDT table. Signed-off-by: Vasant Hegde --- include/mem-map.h | 10 +++++++--- skiboot.lds.S | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/mem-map.h b/include/mem-map.h index fc535e587..d23953985 100644 --- a/include/mem-map.h +++ b/include/mem-map.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2014 IBM Corp. +/* Copyright 2013-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,12 +49,16 @@ */ #define PROCIN_OFF (SPIRA_OFF + 0x800) -/* Initial MDST table like PROCIN, we need fixed addresses, +/* Initial MDST and MDDT tables like PROCIN, we need fixed addresses, * we leave a 2k gap for PROCIN */ #define MDST_TABLE_OFF (SPIRA_OFF + 0x1000) +#define MDST_TABLE_SIZE 0x400 -/* Like MDST, we need fixed address for CPU control header. +#define MDDT_TABLE_OFF (SPIRA_OFF + 0x1400) +#define MDDT_TABLE_SIZE 0x400 + +/* Like MDST and MDDT, we need fixed address for CPU control header. * We leave a 2k gap for MDST. CPU_CTL table is of size ~4k */ #define CPU_CTL_OFF (SPIRA_OFF + 0x1800) diff --git a/skiboot.lds.S b/skiboot.lds.S index 4a7727dc9..5fb32c866 100644 --- a/skiboot.lds.S +++ b/skiboot.lds.S @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 IBM Corp. +/* Copyright 2013-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,6 +90,11 @@ SECTIONS KEEP(*(.mdst.data)) } + . = MDDT_TABLE_OFF; + .mddt : { + KEEP(*(.mddt.data)) + } + . = CPU_CTL_OFF; .cpuctrl : { KEEP(*(.cpuctrl.data)) From patchwork Fri Jul 12 11:17:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131293 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVpv1g8Nz9sBF for ; Fri, 12 Jul 2019 21:20:55 +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 45lVpv0n0SzDqwJ for ; Fri, 12 Jul 2019 21:20:55 +1000 (AEST) 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 45lVm84J16zDqdq for ; Fri, 12 Jul 2019 21:18:32 +1000 (AEST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBHiIC091308 for ; Fri, 12 Jul 2019 07:18:30 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tpry00rm8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:30 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:27 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:24 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIB1A40042836 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:11 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AF8EE4C04A; Fri, 12 Jul 2019 11:18:23 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9303E4C044; Fri, 12 Jul 2019 11:18:21 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:21 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:43 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0028-0000-0000-00000383B69C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0029-0000-0000-00002443CE12 Message-Id: <20190712111802.23560-7-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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=651 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 06/25] mem-map: Setup memory for MDRT table X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Hostboot fills MDRT table after moving memory content from source to destination memory. And OPAL relies on this table to extract the dump. We have to make sure this table is intact. Hence define memory relative to SKIBOOT_BASE so that our relocation doesn't overwrite this memory. Signed-off-by: Vasant Hegde --- include/mem-map.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/mem-map.h b/include/mem-map.h index d23953985..0e03932a1 100644 --- a/include/mem-map.h +++ b/include/mem-map.h @@ -102,11 +102,17 @@ #define PSI_TCE_TABLE_BASE (SKIBOOT_BASE + 0x01a00000) #define PSI_TCE_TABLE_SIZE_P8 0x00200000UL +/* This is our dump result table after MPIPL. Hostboot will write to this + * memory after moving memory content from source to destination memory. + */ +#define MDRT_TABLE_BASE (SKIBOOT_BASE + 0x01c00000) +#define MDRT_TABLE_SIZE 0x00010000 + /* Total size of the above area * * (Ensure this has at least a 64k alignment) */ -#define SKIBOOT_SIZE 0x01c00000 +#define SKIBOOT_SIZE 0x01c10000 /* We start laying out the CPU stacks from here, indexed by PIR * each stack is STACK_SIZE in size (naturally aligned power of From patchwork Fri Jul 12 11:17:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131294 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVqB4p42z9sBF for ; Fri, 12 Jul 2019 21:21:10 +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 45lVqB3RbYzDqdv for ; Fri, 12 Jul 2019 21:21:10 +1000 (AEST) 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 45lVm90dmyzDqfJ for ; Fri, 12 Jul 2019 21:18:32 +1000 (AEST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGfI3062578 for ; Fri, 12 Jul 2019 07:18:31 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tpr7pan45-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:30 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:29 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:27 +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 x6CBIQG752691186 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:26 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0896A4C04A; Fri, 12 Jul 2019 11:18:26 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0BE3C4C044; Fri, 12 Jul 2019 11:18:24 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:23 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:44 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0020-0000-0000-000003531013 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0021-0000-0000-000021A6CE87 Message-Id: <20190712111802.23560-8-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 07/25] hdata: Update spirah structure X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Update MDST, MDDT and MDRT ntuple inside SPIRAH. During MPIPL hostboot will use these details to preserve memory. Signed-off-by: Vasant Hegde --- hdata/spira.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/hdata/spira.c b/hdata/spira.c index 6fbe8cd05..328c3479b 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -187,10 +187,31 @@ __section(".spirah.data") struct spirah spirah = { #endif .mdump_src = { .addr = CPU_TO_BE64(MDST_TABLE_OFF), - .alloc_cnt = CPU_TO_BE16(ARRAY_SIZE(init_mdst_table)), + .alloc_cnt = CPU_TO_BE16(MDST_TABLE_SIZE / sizeof(struct mdst_table)), .act_cnt = CPU_TO_BE16(ARRAY_SIZE(init_mdst_table)), - .alloc_len = - CPU_TO_BE32(sizeof(init_mdst_table)), + .alloc_len = CPU_TO_BE32(sizeof(struct mdst_table)), + .act_len = CPU_TO_BE32(sizeof(struct mdst_table)), + }, + .mdump_dst = { + .addr = CPU_TO_BE64(MDDT_TABLE_OFF), + .alloc_cnt = CPU_TO_BE16(MDDT_TABLE_SIZE / sizeof(struct mddt_table)), + .act_cnt = CPU_TO_BE16(0), + .alloc_len = CPU_TO_BE32(sizeof(struct mddt_table)), + .act_len = CPU_TO_BE32(sizeof(struct mddt_table)), + }, + .mdump_res = { + .addr = CPU_TO_BE64(MDRT_TABLE_BASE), + .alloc_cnt = CPU_TO_BE16(MDRT_TABLE_SIZE / sizeof(struct mdrt_table)), + /* + * XXX: Ideally hostboot should use allocated count and + * length. But looks like hostboot uses actual count + * and length to get MDRT table size. And post dump + * hostboot will update act_cnt. Hence update both + * alloc_cnt and act_cnt. + */ + .act_cnt = CPU_TO_BE16(MDRT_TABLE_SIZE / sizeof(struct mdrt_table)), + .alloc_len = CPU_TO_BE32(sizeof(struct mdrt_table)), + .act_len = CPU_TO_BE32(sizeof(struct mdrt_table)), }, }, }; From patchwork Fri Jul 12 11:17:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131296 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVqd2DdXz9sBt for ; Fri, 12 Jul 2019 21:21:33 +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 45lVqd1DWwzDqgl for ; Fri, 12 Jul 2019 21:21:33 +1000 (AEST) 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 45lVmG5KzlzDqfb for ; Fri, 12 Jul 2019 21:18:38 +1000 (AEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBHRd0125840 for ; Fri, 12 Jul 2019 07:18:35 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tprnb9hju-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:34 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:32 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:29 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBISEE50331886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:28 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C5F354C046; Fri, 12 Jul 2019 11:18:28 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 718B84C044; Fri, 12 Jul 2019 11:18:26 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:26 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:45 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-4275-0000-0000-0000034C7437 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-4276-0000-0000-0000385C7E36 Message-Id: <20190712111802.23560-9-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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=509 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 08/25] hdata: Adjust various structure offset after relocation X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" ntuple addresses in SPIRAH are relative to payload base. Update various addresses after relocation so that hostboot can access new address to capture dump. Note that we update relocated SPIRAH. So future if we add early OPAL crash support, hostboot can still collect dump using origianl skiboot base. Signed-off-by: Vasant Hegde --- hdata/spira.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hdata/spira.c b/hdata/spira.c index 328c3479b..b5ec20db9 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1600,6 +1600,27 @@ static void fixup_spira(void) spira.ntuples.node_stb_data = spiras->ntuples.node_stb_data; } +/* + * All the data structure addresses are relative to payload base. Hence adjust + * structures that are needed to capture OPAL dump during MPIPL. + */ +static void update_spirah_addr(void) +{ +#if !defined(TEST) + extern uint32_t naca; + uint64_t *spirah_offset = (uint64_t *)&naca; + uint64_t *spira_offset = (uint64_t *)((u64)(&naca) + 0x30); + + if (proc_gen < proc_gen_p9) + return; + + *spirah_offset = SPIRAH_OFF; + *spira_offset = SPIRA_OFF; + spirah.ntuples.hs_data_area.addr = CPU_TO_BE64(SPIRA_HEAP_BASE - SKIBOOT_BASE); + spirah.ntuples.mdump_res.addr = CPU_TO_BE64(MDRT_TABLE_BASE - SKIBOOT_BASE); +#endif +} + int parse_hdat(bool is_opal) { cpu_type = PVR_TYPE(mfspr(SPR_PVR)); @@ -1608,6 +1629,8 @@ int parse_hdat(bool is_opal) fixup_spira(); + update_spirah_addr(); + /* * Basic DT root stuff */ From patchwork Fri Jul 12 11:17:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131297 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVr1172Xz9sBt for ; Fri, 12 Jul 2019 21:21:53 +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 45lVr06lm3zDqfK for ; Fri, 12 Jul 2019 21:21:52 +1000 (AEST) 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 45lVmJ389SzDqfP for ; Fri, 12 Jul 2019 21:18:40 +1000 (AEST) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGVag039856 for ; Fri, 12 Jul 2019 07:18:38 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tps488amr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:38 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:35 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:32 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIVoe63176820 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:31 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5968A4C040; Fri, 12 Jul 2019 11:18:31 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 420844C04A; Fri, 12 Jul 2019 11:18:29 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:28 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:46 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0016-0000-0000-0000029209AE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0017-0000-0000-000032EFCDC1 Message-Id: <20190712111802.23560-10-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 09/25] hdata: Create /ibm, opal/dump device tree node X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" We use MPIPL system parameter to detect whether MPIPL is supported or not. If its supported create new device tree node (/ibm,opal/dump) to pass all dump related information to kernel. This patch creates new node and populates below properties: - compatible - dump version (ibm,opal-dump) - fw-load-area - Memory used by OPAL to load kernel/initrd from PNOR (KERNEL_LOAD_BASE & INITRAMFS_LOAD_BASE). This is the temporary memory used by OPAL during boot. Later Linux kernel is free to use this memory. During MPIPL boot also OPAL will overwrite this memory. OPAL will advertise these memory details to kernel. If kernel is using these memory and needs these memory content for proper dump creation, then it has to reserve destination memory to preserve these memory ranges. Also kernel should pass this detail during registration. During MPIPL firmware will take care of preserving memory and post MPIPL kernel can create proper dump. Signed-off-by: Vasant Hegde --- hdata/spira.c | 21 +++++++++++++++++++++ hdata/spira.h | 1 + 2 files changed, 22 insertions(+) diff --git a/hdata/spira.c b/hdata/spira.c index b5ec20db9..58aee742f 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -934,6 +934,23 @@ static void dt_init_secureboot_node(const struct iplparams_sysparams *sysparams) dt_add_property_cells(node, "hw-key-hash-size", hw_key_hash_size); } +static void add_opal_dump_node(void) +{ + u64 fw_load_area[4]; + struct dt_node *node; + + opal_node = dt_new_check(dt_root, "ibm,opal"); + node = dt_new(opal_node, "dump"); + assert(node); + dt_add_property_string(node, "compatible", "ibm,opal-dump"); + + fw_load_area[0] = cpu_to_be64((u64)KERNEL_LOAD_BASE); + fw_load_area[1] = cpu_to_be64(KERNEL_LOAD_SIZE); + fw_load_area[2] = cpu_to_be64((u64)INITRAMFS_LOAD_BASE); + fw_load_area[3] = cpu_to_be64(INITRAMFS_LOAD_SIZE); + dt_add_property(node, "fw-load-area", fw_load_area, sizeof(fw_load_area)); +} + static void add_iplparams_sys_params(const void *iplp, struct dt_node *node) { const struct iplparams_sysparams *p; @@ -1021,6 +1038,10 @@ static void add_iplparams_sys_params(const void *iplp, struct dt_node *node) if (sys_attributes & SYS_ATTR_RISK_LEVEL) dt_add_property(node, "elevated-risk-level", NULL, 0); + /* Populate OPAL dump node */ + if (sys_attributes & SYS_ATTR_MPIPL_SUPPORTED) + add_opal_dump_node(); + if (version >= 0x60 && proc_gen >= proc_gen_p9) dt_init_secureboot_node(p); } diff --git a/hdata/spira.h b/hdata/spira.h index 84bbcfee0..d29632821 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -364,6 +364,7 @@ struct iplparams_sysparams { __be32 sys_eco_mode; #define SYS_ATTR_MULTIPLE_TPM PPC_BIT32(0) #define SYS_ATTR_RISK_LEVEL PPC_BIT32(3) +#define SYS_ATTR_MPIPL_SUPPORTED PPC_BIT32(4) __be32 sys_attributes; __be32 mem_scrubbing; __be16 cur_spl_value; From patchwork Fri Jul 12 11:17:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131299 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVrG3Jwyz9sBF for ; Fri, 12 Jul 2019 21:22:06 +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 45lVrG28c0zDqx0 for ; Fri, 12 Jul 2019 21:22:06 +1000 (AEST) 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 45lVmM3f11zDqg1 for ; Fri, 12 Jul 2019 21:18:43 +1000 (AEST) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGfNY073476 for ; Fri, 12 Jul 2019 07:18:41 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tprmp1knt-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:40 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:38 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:35 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIYkh34275364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:34 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2FC314C052; Fri, 12 Jul 2019 11:18:34 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F0D2D4C046; Fri, 12 Jul 2019 11:18:31 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:31 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:47 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0012-0000-0000-000003321408 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0013-0000-0000-0000216B8411 Message-Id: <20190712111802.23560-11-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 10/25] MPIPL: Register for OPAL dump X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This patch adds support to register for OPAL dump. - Calculate memory required to capture OPAL dump - Reserve OPAL dump destination memory - Add OPAL dump details to MDST and MDDT table Signed-off-by: Vasant Hegde --- core/Makefile.inc | 2 +- core/init.c | 6 ++- core/opal-dump.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-dump.h | 4 ++ 4 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 core/opal-dump.c diff --git a/core/Makefile.inc b/core/Makefile.inc index 64aa43ca2..3928f3219 100644 --- a/core/Makefile.inc +++ b/core/Makefile.inc @@ -10,7 +10,7 @@ CORE_OBJS += console-log.o ipmi.o time-utils.o pel.o pool.o errorlog.o CORE_OBJS += timer.o i2c.o rtc.o flash.o sensor.o ipmi-opal.o CORE_OBJS += flash-subpartition.o bitmap.o buddy.o pci-quirk.o powercap.o psr.o CORE_OBJS += pci-dt-slot.o direct-controls.o cpufeatures.o -CORE_OBJS += flash-firmware-versions.o +CORE_OBJS += flash-firmware-versions.o opal-dump.o ifeq ($(SKIBOOT_GCOV),1) CORE_OBJS += gcov-profiling.o diff --git a/core/init.c b/core/init.c index d0f28f26d..fb55d4a9d 100644 --- a/core/init.c +++ b/core/init.c @@ -1,4 +1,4 @@ -/* Copyright 2013-2016 IBM Corp. +/* Copyright 2013-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,6 +53,7 @@ #include #include #include +#include enum proc_gen proc_gen; unsigned int pcie_max_link_speed; @@ -1258,6 +1259,9 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt) /* Create the LPC bus interrupt-map on P9 */ lpc_finalize_interrupts(); + /* init opal dump */ + opal_mpipl_init(); + /* Add the list of interrupts going to OPAL */ add_opal_interrupts(); diff --git a/core/opal-dump.c b/core/opal-dump.c new file mode 100644 index 000000000..3d61f5092 --- /dev/null +++ b/core/opal-dump.c @@ -0,0 +1,144 @@ +/* Copyright 2019 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define pr_fmt(fmt) "DUMP: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "hdata/spira.h" + +/* Actual address of MDST and MDDT table */ +#define MDST_TABLE_BASE (SKIBOOT_BASE + MDST_TABLE_OFF) +#define MDDT_TABLE_BASE (SKIBOOT_BASE + MDDT_TABLE_OFF) + +static struct spira_ntuple *ntuple_mdst; +static struct spira_ntuple *ntuple_mddt; +static struct spira_ntuple *ntuple_mdrt; + +static int opal_mpipl_add_entry(u8 region, u64 src, u64 dest, u64 size) +{ + int i, max_cnt; + struct mdst_table *mdst; + struct mddt_table *mddt; + + max_cnt = MDST_TABLE_SIZE / sizeof(struct mdst_table); + if (ntuple_mdst->act_cnt >= max_cnt) { + prlog(PR_DEBUG, "MDST table is full\n"); + return OPAL_RESOURCE; + } + + max_cnt = MDDT_TABLE_SIZE / sizeof(struct mddt_table); + if (ntuple_mdst->act_cnt >= max_cnt) { + prlog(PR_DEBUG, "MDDT table is full\n"); + return OPAL_RESOURCE; + } + + /* Use relocated memory address */ + mdst = (void *)(MDST_TABLE_BASE); + mddt = (void *)(MDDT_TABLE_BASE); + + /* Check for duplicate entry */ + for (i = 0; i < ntuple_mdst->act_cnt; i++) { + if (mdst->addr == (src | HRMOR_BIT)) { + prlog(PR_DEBUG, + "Duplicate source address : 0x%llx", src); + return OPAL_PARAMETER; + } + mdst++; + } + for (i = 0; i < ntuple_mddt->act_cnt; i++) { + if (mddt->addr == (dest | HRMOR_BIT)) { + prlog(PR_DEBUG, + "Duplicate destination address : 0x%llx", dest); + return OPAL_PARAMETER; + } + mddt++; + } + + /* Add OPAL source address to MDST entry */ + mdst->addr = src | HRMOR_BIT; + mdst->data_region = region; + mdst->size = size; + ntuple_mdst->act_cnt++; + + /* Add OPAL destination address to MDDT entry */ + mddt->addr = dest | HRMOR_BIT; + mddt->data_region = region; + mddt->size = size; + ntuple_mddt->act_cnt++; + + prlog(PR_TRACE, "Added new entry. src : 0x%llx, dest : 0x%llx," + " size : 0x%llx\n", src, dest, size); + return OPAL_SUCCESS; +} + +/* Register for OPAL dump. */ +static void opal_mpipl_register(void) +{ + u64 opal_dest, opal_size; + + /* Get OPAL runtime size */ + if (!dt_find_property(opal_node, "opal-runtime-size")) { + prlog(PR_DEBUG, "Could not get OPAL runtime size\n"); + return; + } + opal_size = dt_prop_get_u64(opal_node, "opal-runtime-size"); + if (!opal_size) { + prlog(PR_DEBUG, "OPAL runtime size is zero\n"); + return; + } + + /* Calculate and reserve OPAL dump destination memory */ + opal_dest = SKIBOOT_BASE + opal_size; + mem_reserve_fw("ibm,firmware-dump", opal_dest, opal_size); + + /* Add OPAL reservation detail to MDST/MDDT table */ + opal_mpipl_add_entry(DUMP_REGION_OPAL_MEMORY, + SKIBOOT_BASE, opal_dest, opal_size); +} + +void opal_mpipl_init(void) +{ + void *mdst_base = (void *)MDST_TABLE_BASE; + void *mddt_base = (void *)MDDT_TABLE_BASE; + struct dt_node *dump_node; + + dump_node = dt_find_by_path(opal_node, "dump"); + if (!dump_node) + return; + + /* Get MDST and MDDT ntuple from SPIRAH */ + ntuple_mdst = &(spirah.ntuples.mdump_src); + ntuple_mddt = &(spirah.ntuples.mdump_dst); + ntuple_mdrt = &(spirah.ntuples.mdump_res); + + /* Clear MDST and MDDT table */ + memset(mdst_base, 0, MDST_TABLE_SIZE); + ntuple_mdst->act_cnt = 0; + memset(mddt_base, 0, MDDT_TABLE_SIZE); + ntuple_mddt->act_cnt = 0; + + opal_mpipl_register(); +} diff --git a/include/opal-dump.h b/include/opal-dump.h index ccf49f953..0a86dcb1b 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -33,6 +33,7 @@ #define DUMP_REGION_CONSOLE 0x01 #define DUMP_REGION_HBRT_LOG 0x02 +#define DUMP_REGION_OPAL_MEMORY 0x03 /* Mainstore memory to be captured by FSP SYSDUMP */ #define DUMP_TYPE_SYSDUMP 0xF5 @@ -120,4 +121,7 @@ struct proc_reg_data { uint64_t reg_val; } __packed; +/* init opal dump */ +extern void opal_mpipl_init(void); + #endif /* __OPAL_DUMP_H */ From patchwork Fri Jul 12 11:17:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVrV0rFWz9sBF for ; Fri, 12 Jul 2019 21:22: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 45lVrT6bqKzDqy6 for ; Fri, 12 Jul 2019 21:22:17 +1000 (AEST) 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 45lVmQ5xTXzDqgq for ; Fri, 12 Jul 2019 21:18:46 +1000 (AEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBHQKI125807 for ; Fri, 12 Jul 2019 07:18:43 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tprnb9hq9-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:43 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:41 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) 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) Fri, 12 Jul 2019 12:18:38 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIOIO38535528 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:24 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 26CBA4C044; Fri, 12 Jul 2019 11:18:37 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 925534C040; Fri, 12 Jul 2019 11:18:34 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:34 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:48 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0008-0000-0000-000002FCB24D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0009-0000-0000-0000226A1DD7 Message-Id: <20190712111802.23560-12-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 11/25] MPIPL: Define OPAL metadata area X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" We want to save some information (like crashing CPU PIR, kernel tags, etc) before triggering MPIPL. Post MPIPL we will use this information to retrieve dump metadata and create dump. MDRT table doesn't need 64K. Hence split MDRT table to accommodate metadata area. Finally define metadata structure. Signed-off-by: Vasant Hegde --- core/opal-dump.c | 13 +++++++++++++ include/mem-map.h | 8 +++++++- include/opal-dump.h | 10 ++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index 3d61f5092..56d6ba32e 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -37,6 +37,8 @@ static struct spira_ntuple *ntuple_mdst; static struct spira_ntuple *ntuple_mddt; static struct spira_ntuple *ntuple_mdrt; +static struct mpipl_metadata *mpipl_metadata; + static int opal_mpipl_add_entry(u8 region, u64 src, u64 dest, u64 size) { int i, max_cnt; @@ -134,6 +136,17 @@ void opal_mpipl_init(void) ntuple_mddt = &(spirah.ntuples.mdump_dst); ntuple_mdrt = &(spirah.ntuples.mdump_res); + /* Get metadata area pointer */ + mpipl_metadata = (void *)(DUMP_METADATA_AREA_BASE); + + /* Clear OPAL metadata area */ + if (sizeof(struct mpipl_metadata) > DUMP_METADATA_AREA_SIZE) { + prlog(PR_ERR, "INSUFFICIENT OPAL METADATA AREA\n"); + prlog(PR_ERR, "INCREASE OPAL MEDTADATA AREA SIZE\n"); + assert(false); + } + memset(mpipl_metadata, 0, sizeof(struct mpipl_metadata)); + /* Clear MDST and MDDT table */ memset(mdst_base, 0, MDST_TABLE_SIZE); ntuple_mdst->act_cnt = 0; diff --git a/include/mem-map.h b/include/mem-map.h index 0e03932a1..a29b8fb3e 100644 --- a/include/mem-map.h +++ b/include/mem-map.h @@ -106,7 +106,13 @@ * memory after moving memory content from source to destination memory. */ #define MDRT_TABLE_BASE (SKIBOOT_BASE + 0x01c00000) -#define MDRT_TABLE_SIZE 0x00010000 +#define MDRT_TABLE_SIZE 0x00008000 + +/* This is our dump metadata area. We will use this memory to save metadata + * (like crashing CPU details, payload tags) before triggering MPIPL. + */ +#define DUMP_METADATA_AREA_BASE (SKIBOOT_BASE + 0x01c08000) +#define DUMP_METADATA_AREA_SIZE 0x8000 /* Total size of the above area * diff --git a/include/opal-dump.h b/include/opal-dump.h index 0a86dcb1b..10a8df6ac 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -121,6 +121,16 @@ struct proc_reg_data { uint64_t reg_val; } __packed; +/* Metadata to capture before triggering MPIPL */ +struct mpipl_metadata { + /* Crashing PIR is required to create OPAL dump */ + uint32_t crashing_pir; + /* Kernel expects OPAL to presrve tag and pass it back via OPAL API */ + uint64_t kernel_tag; + /* Post MPIPL kernel boot memory size */ + uint64_t boot_mem_size; +} __packed; + /* init opal dump */ extern void opal_mpipl_init(void); From patchwork Fri Jul 12 11:17:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131302 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVrn0vBvz9sBF for ; Fri, 12 Jul 2019 21:22:33 +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 45lVrm6TgPzDqyx for ; Fri, 12 Jul 2019 21:22:32 +1000 (AEST) 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 45lVmR3yvmzDqvR for ; Fri, 12 Jul 2019 21:18:47 +1000 (AEST) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGiop048365 for ; Fri, 12 Jul 2019 07:18:45 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tpqga4cmb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:44 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:43 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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) Fri, 12 Jul 2019 12:18:40 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIdtB17432736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:39 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AFFA24C04A; Fri, 12 Jul 2019 11:18:39 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7587B4C040; Fri, 12 Jul 2019 11:18:37 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:37 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:49 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0008-0000-0000-000002FCB250 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0009-0000-0000-0000226A1DDB Message-Id: <20190712111802.23560-13-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 12/25] MPIPL: Add OPAL API to register for dump region X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This patch add new API to register for dump region. u64 opal_mpipl_update(u8 ops, u64 src, u64 dest, u64 size) ops : OPAL_MPIPL_ADD_RANGE Add new entry to MPIPL table. Kernel will send src, dest and size. During MPIPL content from source address is moved to destination address. src = Source start address dest = Destination start address size = size OPAL_MPIPL_REMOVE_RANGE Remove kernel requested entry from MPIPL table. src = Source start address dest = Destination start address size = ignore OPAL_MPIPL_REMOVE_ALL Remove all kernel passed entry from MPIPL table. src = ignore dest = ignore size = ignore OPAL_MPIPL_FREE_PRESERVED_MEMORY Post MPIPL, kernel will indicate OPAL that it has processed dump and it can clear/release metadata area. src = ignore dest = ignore size = ignore Return values: OPAL_SUCCESS : Operation success OPAL_PARAMETER : Payload passed invalid data OPAL_RESOURCE : Ran out of MDST or MDDT table size OPAL_HARDWARE : MPIPL not supported Signed-off-by: Vasant Hegde --- core/opal-dump.c | 181 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-api.h | 11 +++- include/opal-dump.h | 1 + 3 files changed, 192 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index 56d6ba32e..2db5775e9 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -96,6 +96,102 @@ static int opal_mpipl_add_entry(u8 region, u64 src, u64 dest, u64 size) return OPAL_SUCCESS; } +/* Remove entry from source (MDST) table */ +static int opal_mpipl_remove_entry_mdst(bool remove_all, u8 region, u64 src) +{ + bool found = false; + int i, j; + struct mdst_table *tmp_mdst; + struct mdst_table *mdst = (void *)(MDST_TABLE_BASE); + + for (i = 0; i < ntuple_mdst->act_cnt;) { + if (mdst->data_region != region) { + mdst++; + i++; + continue; + } + + if (remove_all != true && mdst->addr != (src | HRMOR_BIT)) { + mdst++; + i++; + continue; + } + + tmp_mdst = mdst; + memset(tmp_mdst, 0, sizeof(struct mdst_table)); + + for (j = i; j < ntuple_mdst->act_cnt - 1; j++) { + memcpy((void *)tmp_mdst, + (void *)(tmp_mdst + 1), sizeof(struct mdst_table)); + tmp_mdst++; + memset(tmp_mdst, 0, sizeof(struct mdst_table)); + } + + ntuple_mdst->act_cnt--; + + if (remove_all == false) { + found = true; + break; + } + } /* end - for loop */ + + if (remove_all == false && found == false) { + prlog(PR_DEBUG, + "Source address [0x%llx] not found in MDST table\n", src); + return OPAL_PARAMETER; + } + + return OPAL_SUCCESS; +} + +/* Remove entry from destination (MDDT) table */ +static int opal_mpipl_remove_entry_mddt(bool remove_all, u8 region, u64 dest) +{ + bool found = false; + int i, j; + struct mddt_table *tmp_mddt; + struct mddt_table *mddt = (void *)(MDDT_TABLE_BASE); + + for (i = 0; i < ntuple_mddt->act_cnt;) { + if (mddt->data_region != region) { + mddt++; + i++; + continue; + } + + if (remove_all != true && mddt->addr != (dest | HRMOR_BIT)) { + mddt++; + i++; + continue; + } + + tmp_mddt = mddt; + memset(tmp_mddt, 0, sizeof(struct mddt_table)); + + for (j = i; j < ntuple_mddt->act_cnt - 1; j++) { + memcpy((void *)tmp_mddt, + (void *)(tmp_mddt + 1), sizeof(struct mddt_table)); + tmp_mddt++; + memset(tmp_mddt, 0, sizeof(struct mddt_table)); + } + + ntuple_mddt->act_cnt--; + + if (remove_all == false) { + found = true; + break; + } + } /* end - for loop */ + + if (remove_all == false && found == false) { + prlog(PR_DEBUG, + "Dest address [0x%llx] not found in MDDT table\n", dest); + return OPAL_PARAMETER; + } + + return OPAL_SUCCESS; +} + /* Register for OPAL dump. */ static void opal_mpipl_register(void) { @@ -121,6 +217,88 @@ static void opal_mpipl_register(void) SKIBOOT_BASE, opal_dest, opal_size); } +static int payload_mpipl_register(u64 src, u64 dest, u64 size) +{ + if (!opal_addr_valid((void *)src)) { + prlog(PR_DEBUG, "Invalid source address [0x%llx]\n", src); + return OPAL_PARAMETER; + } + + if (!opal_addr_valid((void *)dest)) { + prlog(PR_DEBUG, "Invalid dest address [0x%llx]\n", dest); + return OPAL_PARAMETER; + } + + if (size <= 0) { + prlog(PR_DEBUG, "Invalid size [0x%llx]\n", size); + return OPAL_PARAMETER; + } + + return opal_mpipl_add_entry(DUMP_REGION_KERNEL, src, dest, size); +} + +static int payload_mpipl_unregister(u64 src, u64 dest) +{ + int rc; + + /* Remove src from MDST table */ + rc = opal_mpipl_remove_entry_mdst(false, DUMP_REGION_KERNEL, src); + if (rc) + return rc; + + /* Remove dest from MDDT table */ + rc = opal_mpipl_remove_entry_mddt(false, DUMP_REGION_KERNEL, dest); + return rc; +} + +static int payload_mpipl_unregister_all(void) +{ + opal_mpipl_remove_entry_mdst(true, DUMP_REGION_KERNEL, 0); + opal_mpipl_remove_entry_mddt(true, DUMP_REGION_KERNEL, 0); + + return OPAL_SUCCESS; +} + +static int64_t opal_mpipl_update(enum opal_mpipl_ops ops, + u64 src, u64 dest, u64 size) +{ + int rc; + + switch (ops) { + case OPAL_MPIPL_ADD_RANGE: + rc = payload_mpipl_register(src, dest, size); + if (!rc) + prlog(PR_NOTICE, "Payload registered for MPIPL\n"); + break; + case OPAL_MPIPL_REMOVE_RANGE: + rc = payload_mpipl_unregister(src, dest); + if (!rc) { + prlog(PR_NOTICE, "Payload removed entry from MPIPL." + "[src : 0x%llx, dest : 0x%llx]\n", src, dest); + } + break; + case OPAL_MPIPL_REMOVE_ALL: + rc = payload_mpipl_unregister_all(); + if (!rc) + prlog(PR_NOTICE, "Payload unregistered for MPIPL\n"); + break; + case OPAL_MPIPL_FREE_PRESERVED_MEMORY: + /* Clear MDRT table */ + memset((void *)MDRT_TABLE_BASE, 0, MDRT_TABLE_SIZE); + /* Set MDRT count to max allocated count */ + ntuple_mdrt->act_cnt = MDRT_TABLE_SIZE / sizeof(struct mdrt_table); + rc = OPAL_SUCCESS; + prlog(PR_NOTICE, "Payload Invalidated MPIPL\n"); + break; + default: + prlog(PR_DEBUG, "Unsupported MPIPL update operation : 0x%x\n", ops); + rc = OPAL_PARAMETER; + break; + } + + return rc; +} + void opal_mpipl_init(void) { void *mdst_base = (void *)MDST_TABLE_BASE; @@ -154,4 +332,7 @@ void opal_mpipl_init(void) ntuple_mddt->act_cnt = 0; opal_mpipl_register(); + + /* OPAL API for MPIPL update */ + opal_register(OPAL_MPIPL_UPDATE, opal_mpipl_update, 4); } diff --git a/include/opal-api.h b/include/opal-api.h index 0b0ae1969..20ce0a45e 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -232,7 +232,8 @@ #define OPAL_XIVE_GET_VP_STATE 170 /* Get NVT state */ #define OPAL_NPU_MEM_ALLOC 171 #define OPAL_NPU_MEM_RELEASE 172 -#define OPAL_LAST 172 +#define OPAL_MPIPL_UPDATE 173 +#define OPAL_LAST 173 #define QUIESCE_HOLD 1 /* Spin all calls at entry */ #define QUIESCE_REJECT 2 /* Fail all calls with OPAL_BUSY */ @@ -1215,6 +1216,14 @@ enum { OPAL_PCI_P2P_TARGET = 1, }; +/* MPIPL update operations */ +enum opal_mpipl_ops { + OPAL_MPIPL_ADD_RANGE = 0, + OPAL_MPIPL_REMOVE_RANGE = 1, + OPAL_MPIPL_REMOVE_ALL = 2, + OPAL_MPIPL_FREE_PRESERVED_MEMORY= 3, +}; + #endif /* __ASSEMBLY__ */ #endif /* __OPAL_API_H */ diff --git a/include/opal-dump.h b/include/opal-dump.h index 10a8df6ac..3699ddc32 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -34,6 +34,7 @@ #define DUMP_REGION_CONSOLE 0x01 #define DUMP_REGION_HBRT_LOG 0x02 #define DUMP_REGION_OPAL_MEMORY 0x03 +#define DUMP_REGION_KERNEL 0x80 /* Mainstore memory to be captured by FSP SYSDUMP */ #define DUMP_TYPE_SYSDUMP 0xF5 From patchwork Fri Jul 12 11:17:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131303 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVrz5H9Xz9sBF for ; Fri, 12 Jul 2019 21:22:43 +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 45lVrz4JlzzDr11 for ; Fri, 12 Jul 2019 21:22:43 +1000 (AEST) 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 45lVmV1lCjzDqg1 for ; Fri, 12 Jul 2019 21:18:50 +1000 (AEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGrGN158290 for ; Fri, 12 Jul 2019 07:18:47 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tprra9960-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:47 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:45 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:43 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIgr745023442 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:42 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 51C494C044; Fri, 12 Jul 2019 11:18:42 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1611A4C040; Fri, 12 Jul 2019 11:18:40 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:39 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:50 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-4275-0000-0000-0000034C743E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-4276-0000-0000-0000385C7E3E Message-Id: <20190712111802.23560-14-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 13/25] MPIPL: Add OPAL API to register tags X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This patch adds new API to register tags. opal_mpipl_register_tag(enum opal_mpipl_tags tag, uint64_t tag_val) tag: OPAL_MPIPL_TAG_KERNEL During first boot, kernel will setup its metadata area and asks OPAL to preserve metadata area pointer across MPIPL. Post MPIPL kernel requests OPAL to provide metadata pointer and it will use that pointer to retrieve metadata and create dump. OPAL_MPIPL_TAG_BOOT_MEM During MPIPL registration kernel will specify how much memory firmware can use for Post MPIPL load. Post MPIPL petitboot kernel will query for this tag to get boot memory size. Return values: OPAL_SUCCESS : Operation success OPAL_PARAMETER : Payload passed invalid tag Signed-off-by: Vasant Hegde --- core/opal-dump.c | 29 +++++++++++++++++++++++++++++ include/opal-api.h | 13 ++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index 2db5775e9..775ec8161 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -299,6 +299,34 @@ static int64_t opal_mpipl_update(enum opal_mpipl_ops ops, return rc; } +static int64_t opal_mpipl_register_tag(enum opal_mpipl_tags tag, + uint64_t tag_val) +{ + int rc = OPAL_SUCCESS; + + switch (tag) { + case OPAL_MPIPL_TAG_BOOT_MEM: + if (tag_val <= 0 || tag_val > top_of_ram) { + prlog(PR_DEBUG, "Payload sent invalid boot mem size" + " : 0x%llx\n", tag_val); + rc = OPAL_PARAMETER; + } else { + mpipl_metadata->boot_mem_size = tag_val; + prlog(PR_NOTICE, "Boot mem size : 0x%llx\n", tag_val); + } + break; + case OPAL_MPIPL_TAG_KERNEL: + mpipl_metadata->kernel_tag = tag_val; + prlog(PR_NOTICE, "Payload sent metadata tag : 0x%llx\n", tag_val); + break; + default: + prlog(PR_DEBUG, "Payload sent unsupported tag : 0x%x\n", tag); + rc = OPAL_PARAMETER; + break; + } + return rc; +} + void opal_mpipl_init(void) { void *mdst_base = (void *)MDST_TABLE_BASE; @@ -335,4 +363,5 @@ void opal_mpipl_init(void) /* OPAL API for MPIPL update */ opal_register(OPAL_MPIPL_UPDATE, opal_mpipl_update, 4); + opal_register(OPAL_MPIPL_REGISTER_TAG, opal_mpipl_register_tag, 2); } diff --git a/include/opal-api.h b/include/opal-api.h index 20ce0a45e..d88703556 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -233,7 +233,8 @@ #define OPAL_NPU_MEM_ALLOC 171 #define OPAL_NPU_MEM_RELEASE 172 #define OPAL_MPIPL_UPDATE 173 -#define OPAL_LAST 173 +#define OPAL_MPIPL_REGISTER_TAG 174 +#define OPAL_LAST 174 #define QUIESCE_HOLD 1 /* Spin all calls at entry */ #define QUIESCE_REJECT 2 /* Fail all calls with OPAL_BUSY */ @@ -1224,6 +1225,16 @@ enum opal_mpipl_ops { OPAL_MPIPL_FREE_PRESERVED_MEMORY= 3, }; +/* Tag will point to various metadata area. Kernel will + * use tag to get metadata value. + */ +enum opal_mpipl_tags { + OPAL_MPIPL_TAG_CPU = 0, + OPAL_MPIPL_TAG_OPAL = 1, + OPAL_MPIPL_TAG_KERNEL = 2, + OPAL_MPIPL_TAG_BOOT_MEM = 3, +}; + #endif /* __ASSEMBLY__ */ #endif /* __OPAL_API_H */ From patchwork Fri Jul 12 11:17:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131304 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVsL4jQjz9sBF for ; Fri, 12 Jul 2019 21:23:02 +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 45lVsL3wT9zDr1Q for ; Fri, 12 Jul 2019 21:23:02 +1000 (AEST) 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 45lVmZ2Q2vzDqwJ for ; Fri, 12 Jul 2019 21:18:53 +1000 (AEST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGbwO017532 for ; Fri, 12 Jul 2019 07:18:51 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tps3c8cnn-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:51 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:49 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:46 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIjUq46399582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:45 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E68804C046; Fri, 12 Jul 2019 11:18:44 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B604A4C044; Fri, 12 Jul 2019 11:18:42 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:42 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:51 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0012-0000-0000-00000332140A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0013-0000-0000-0000216B8413 Message-Id: <20190712111802.23560-15-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 14/25] SBE: Send OPAL relocated base address to SBE X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@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 base address 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-dump.c | 4 ++++ hw/sbe-p9.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ include/sbe-p9.h | 8 +++++++- 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index 775ec8161..9ca01e5e2 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -361,6 +362,9 @@ void opal_mpipl_init(void) opal_mpipl_register(); + /* Send OPAL relocated base address to SBE */ + p9_sbe_send_relocated_base(SKIBOOT_BASE); + /* OPAL API for MPIPL update */ opal_register(OPAL_MPIPL_UPDATE, opal_mpipl_update, 4); opal_register(OPAL_MPIPL_REGISTER_TAG, opal_mpipl_register_tag, 2); diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index c28dbb9d6..d3dd4bdb4 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -861,6 +861,54 @@ 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_single(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_ERR, "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_single(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 5ad0422ac..1191a94b4 100644 --- a/include/sbe-p9.h +++ b/include/sbe-p9.h @@ -1,4 +1,4 @@ -/* Copyright 2017-2018 IBM Corp. +/* Copyright 2017-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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 */ From patchwork Fri Jul 12 11:17:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131307 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVsb3tXNz9sBF for ; Fri, 12 Jul 2019 21:23:15 +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 45lVsb2xQBzDr2q for ; Fri, 12 Jul 2019 21:23:15 +1000 (AEST) 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 45lVmb600mzDqfC for ; Fri, 12 Jul 2019 21:18:55 +1000 (AEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGrGW158290 for ; Fri, 12 Jul 2019 07:18:53 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tprra999k-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:53 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:51 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:48 +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 x6CBIlGm55705700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:47 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7DE814C046; Fri, 12 Jul 2019 11:18:47 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 577A04C040; Fri, 12 Jul 2019 11:18:45 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:45 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:52 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-4275-0000-0000-0000034C7440 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-4276-0000-0000-0000385C7E40 Message-Id: <20190712111802.23560-16-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 15/25] MPIPL: Add support to trigger MPIPL on BMC system X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com 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 SBE S0 interrupt in assert path. Sequence : - S0 interrupt on secondary chip SBE - S0 interrupt on primary chip SBE Note that this is hooked to ipmi_terminate path. We have HDAT flag for MPIPL support. If MPIPL is not supported then we don't create 'ibm,opal/dump' node and we will fall back to existing termination flow. Finally we want to log error log to BMC before triggerring MPIPL. Hence this patch re-organizes ipmi_terminate() such that we call ipmi_log_terminate_event() before triggering MPIPL. Note: - 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 | 16 ++++++++++---- hw/sbe-p9.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/sbe-p9.h | 10 +++++++++ 3 files changed, 85 insertions(+), 4 deletions(-) diff --git a/hw/ipmi/ipmi-attn.c b/hw/ipmi/ipmi-attn.c index c6c1c59b5..13e3932a9 100644 --- a/hw/ipmi/ipmi-attn.c +++ b/hw/ipmi/ipmi-attn.c @@ -1,4 +1,4 @@ -/* Copyright 2015 IBM Corp. +/* Copyright 2015-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -65,6 +66,16 @@ static void ipmi_log_terminate_event(const char *msg) void __attribute__((noreturn)) ipmi_terminate(const char *msg) { + /* Log eSEL event */ + if (ipmi_present()) + ipmi_log_terminate_event(msg); + + /* + * If mpipl is supported then trigger SBE interrupt + * to initiate mpipl + */ + p9_sbe_terminate(); + /* Terminate called before initializing IPMI (early abort) */ if (!ipmi_present()) { if (platform.cec_reboot) @@ -72,9 +83,6 @@ void __attribute__((noreturn)) ipmi_terminate(const char *msg) goto out; } - /* Log eSEL event */ - ipmi_log_terminate_event(msg); - /* Reboot call */ if (platform.cec_reboot) platform.cec_reboot(); diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index d3dd4bdb4..58a296c00 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -948,3 +948,66 @@ void p9_sbe_init(void) /* Initiate SBE timeout poller */ opal_add_poller(p9_sbe_timeout_poll, NULL); } + +/* Terminate and initiate MPIPL */ +void p9_sbe_terminate(void) +{ + uint32_t primary_chip = -1; + int rc; + u64 wait_tb; + struct proc_chip *chip; + + /* Return if MPIPL is not supported */ + if (!dt_find_by_path(opal_node, "dump")) + return; + + /* + * Send S0 interrupt to all SBE. Sequence: + * - S0 interrupt on secondary chip SBE + * - S0 interrupt on Primary chip SBE + */ + for_each_chip(chip) { + if (dt_has_node_property(chip->devnode, "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); + return; + } + } + + /* Initiate normal reboot */ + if (primary_chip == -1) { + prlog(PR_ERR, "Primary chip ID not found.\n"); + return; + } + + rc = xscom_write(primary_chip, + SBE_CONTROL_REG_RW, SBE_CONTROL_REG_S0); + if (rc) { + prlog(PR_ERR, "Failed to write S0 interrupt [chip id = %x]\n", + primary_chip); + return; + } + + /* XXX We expect SBE to act on interrupt, quiesce the system and start + * MPIPL flow. Currently we do not have a way to detect SBE state. + * Hence wait for max time SBE takes to respond and then trigger + * normal reboot. + */ + prlog(PR_NOTICE, "Initiated MPIPL, waiting for SBE to respond...\n"); + wait_tb = mftb() + msecs_to_tb(SBE_CMD_TIMEOUT_MAX); + while (mftb() < wait_tb) { + cpu_relax(); + } + + prlog(PR_ERR, "SBE did not respond within timeout period (%d secs).\n", + SBE_CMD_TIMEOUT_MAX / 1000); + prlog(PR_ERR, "Falling back to normal reboot\n"); +} diff --git a/include/sbe-p9.h b/include/sbe-p9.h index 1191a94b4..32feb22fa 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 reloc_base); +/* Terminate and trigger MPIPL */ +extern void p9_sbe_terminate(void); + #endif /* __SBE_P9_H */ From patchwork Fri Jul 12 11:17:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131308 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVss4ns5z9sBF for ; Fri, 12 Jul 2019 21:23:29 +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 45lVss0YwJzDqfr for ; Fri, 12 Jul 2019 21:23:29 +1000 (AEST) 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 45lVmf3177zDqgZ for ; Fri, 12 Jul 2019 21:18:58 +1000 (AEST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGoch006293 for ; Fri, 12 Jul 2019 07:18:56 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tpps6eats-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:56 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:53 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.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) Fri, 12 Jul 2019 12:18:51 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIo3P39911768 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:50 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D7D74C040; Fri, 12 Jul 2019 11:18:50 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E0F874C044; Fri, 12 Jul 2019 11:18:47 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:47 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:53 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0008-0000-0000-000002FCB253 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0009-0000-0000-0000226A1DDF Message-Id: <20190712111802.23560-17-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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=533 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 16/25] MPIPL: Save crashing PIR X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Crashing CPU PIR is required to get proper backtrace from core file. Save crashing CPU PIR before triggering MPIPL. Post MPIPL OPAL will pass saved PIR to kernel and kernel will use that to create OPAL dump. Signed-off-by: Vasant Hegde --- core/opal-dump.c | 7 +++++++ hw/sbe-p9.c | 4 ++++ include/opal-dump.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/core/opal-dump.c b/core/opal-dump.c index 9ca01e5e2..bb90c45d0 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -16,6 +16,7 @@ #define pr_fmt(fmt) "DUMP: " fmt +#include #include #include #include @@ -328,6 +329,12 @@ static int64_t opal_mpipl_register_tag(enum opal_mpipl_tags tag, return rc; } +void opal_mpipl_save_crashing_pir(void) +{ + mpipl_metadata->crashing_pir = this_cpu()->pir; + prlog(PR_NOTICE, "Crashing PIR = 0x%x\n", this_cpu()->pir); +} + void opal_mpipl_init(void) { void *mdst_base = (void *)MDST_TABLE_BASE; diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index 58a296c00..01f41e8cb 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -961,6 +962,9 @@ void p9_sbe_terminate(void) if (!dt_find_by_path(opal_node, "dump")) return; + /* Save crashing CPU details */ + opal_mpipl_save_crashing_pir(); + /* * Send S0 interrupt to all SBE. Sequence: * - S0 interrupt on secondary chip SBE diff --git a/include/opal-dump.h b/include/opal-dump.h index 3699ddc32..813fbd761 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -135,4 +135,7 @@ struct mpipl_metadata { /* init opal dump */ extern void opal_mpipl_init(void); +/* Save metadata before triggering MPIPL */ +void opal_mpipl_save_crashing_pir(void); + #endif /* __OPAL_DUMP_H */ From patchwork Fri Jul 12 11:17:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131309 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVt71k5Lz9sBF for ; Fri, 12 Jul 2019 21:23:43 +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 45lVt70V45zDr4L for ; Fri, 12 Jul 2019 21:23:43 +1000 (AEST) 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 45lVmg64gqzDqdv for ; Fri, 12 Jul 2019 21:18:59 +1000 (AEST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGZNE017453 for ; Fri, 12 Jul 2019 07:18:58 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tps3c8csb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:18:57 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:18:55 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:54 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIrcP52822054 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:53 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48E664C046; Fri, 12 Jul 2019 11:18:53 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8D3A14C04E; Fri, 12 Jul 2019 11:18:50 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:50 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:54 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0016-0000-0000-0000029209B4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0017-0000-0000-000032EFCDC7 Message-Id: <20190712111802.23560-18-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=4 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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 17/25] HIOMAP: Reset bmc mbox in MPIPL path X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, Andrew Jeffery , hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" During boot SBE and early hostboot does not use HIOMAP protocol to get image from PNOR. Instead it expects PNOR TOC and Hostboot Boot Loader to be available at particular address in LPC bus. mbox daemon in BMC side takes care of this during normal boot. Once boot is complete mbox daemon switches to normal mode. During normal reboot, BMC side mbox daemon gets notification and takes care of loading PNOR TOC and HBBL to LPC bus again. In MPIPL path, OPAL calls SBE S0 interrupt to initiate MPIPL. BMC will not be aware of this. But SBE expects PNOR TOC and HBBL to be available in LPC bus at predefined address. Hence call HIOMAP Reset from OPAL in assert path. This needs working LPC and IPMI driver in OPAL. If we have issue in these drivers then we may not be able to reset BMC MBOX properly. Hence MPIPL may fail. We have to live with this until we find a way to intiate BMC on MPIPL. CC: Andrew Jeffery Signed-off-by: Vasant Hegde Reviewed-by: Andrew Jeffery --- core/flash.c | 14 +++- hw/sbe-p9.c | 6 ++ include/skiboot.h | 3 +- libflash/blocklevel.h | 1 + libflash/ipmi-hiomap.c | 32 +++++++- libflash/ipmi-hiomap.h | 2 +- libflash/mbox-flash.c | 29 ++++++- libflash/mbox-flash.h | 2 +- libflash/test/mbox-server.c | 1 + libflash/test/test-ipmi-hiomap.c | 169 +++++++++++++++++++++++++++++++++++++++ 10 files changed, 253 insertions(+), 6 deletions(-) diff --git a/core/flash.c b/core/flash.c index 3da6d4a42..fba59dc28 100644 --- a/core/flash.c +++ b/core/flash.c @@ -1,4 +1,4 @@ -/* Copyright 2013-2018 IBM Corp. +/* Copyright 2013-2019 IBM Corp. * Copyright 2018 Raptor Engineering, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -88,6 +89,17 @@ void flash_release(void) unlock(&flash_lock); } +bool flash_unregister(void) +{ + struct blocklevel_device *bl = system_flash->bl; + + if (bl->exit) + return bl->exit(bl); + + prlog(PR_NOTICE, "FLASH: Unregister flash device is not supported\n"); + return true; +} + static int flash_nvram_info(uint32_t *total_size) { int rc; diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index 01f41e8cb..6cc8bccd7 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -962,6 +962,12 @@ void p9_sbe_terminate(void) if (!dt_find_by_path(opal_node, "dump")) return; + /* Unregister flash. It will request BMC MBOX reset */ + if (!flash_unregister()) { + prlog(PR_DEBUG, "Failed to reset BMC MBOX\n"); + return; + } + /* Save crashing CPU details */ opal_mpipl_save_crashing_pir(); diff --git a/include/skiboot.h b/include/skiboot.h index 1b3bacbe7..4e5520782 100644 --- a/include/skiboot.h +++ b/include/skiboot.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2014 IBM Corp. +/* Copyright 2013-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -224,6 +224,7 @@ extern int flash_start_preload_resource(enum resource_id id, uint32_t subid, extern int flash_resource_loaded(enum resource_id id, uint32_t idx); extern bool flash_reserve(void); extern void flash_release(void); +extern bool flash_unregister(void); #define FLASH_SUBPART_ALIGNMENT 0x1000 #define FLASH_SUBPART_HEADER_SIZE FLASH_SUBPART_ALIGNMENT extern int flash_subpart_info(void *part_header, uint32_t header_len, diff --git a/libflash/blocklevel.h b/libflash/blocklevel.h index ba42c83d0..a9b94e085 100644 --- a/libflash/blocklevel.h +++ b/libflash/blocklevel.h @@ -47,6 +47,7 @@ struct blocklevel_device { int (*erase)(struct blocklevel_device *bl, uint64_t pos, uint64_t len); int (*get_info)(struct blocklevel_device *bl, const char **name, uint64_t *total_size, uint32_t *erase_granule); + bool (*exit)(struct blocklevel_device *bl); /* * Keep the erase mask so that blocklevel_erase() can do sanity checking diff --git a/libflash/ipmi-hiomap.c b/libflash/ipmi-hiomap.c index 9174eabd2..1bfa0d45d 100644 --- a/libflash/ipmi-hiomap.c +++ b/libflash/ipmi-hiomap.c @@ -223,6 +223,7 @@ static void ipmi_hiomap_cmd_cb(struct ipmi_msg *msg) case HIOMAP_C_FLUSH: case HIOMAP_C_ACK: case HIOMAP_C_ERASE: + case HIOMAP_C_RESET: if (msg->resp_size != 2) { prerror("%u: Unexpected response size: %u\n", msg->data[0], msg->resp_size); @@ -529,6 +530,29 @@ static int hiomap_erase(struct ipmi_hiomap *ctx, uint64_t offset, return 0; } +static bool hiomap_reset(struct ipmi_hiomap *ctx) +{ + RESULT_INIT(res, ctx); + unsigned char req[2]; + struct ipmi_msg *msg; + + prlog(PR_NOTICE, "Reset\n"); + + req[0] = HIOMAP_C_RESET; + req[1] = ++ctx->seq; + msg = ipmi_mkmsg(IPMI_DEFAULT_INTERFACE, + bmc_platform->sw->ipmi_oem_hiomap_cmd, + ipmi_hiomap_cmd_cb, &res, req, sizeof(req), 2); + ipmi_queue_msg_sync(msg); + + if (res.cc != IPMI_CC_NO_ERROR) { + prlog(PR_ERR, "%s failed: %d\n", __func__, res.cc); + return false; + } + + return true; +} + static void hiomap_event(uint8_t events, void *context) { struct ipmi_hiomap *ctx = context; @@ -919,6 +943,7 @@ int ipmi_hiomap_init(struct blocklevel_device **bl) ctx->bl.write = &ipmi_hiomap_write; ctx->bl.erase = &ipmi_hiomap_erase; ctx->bl.get_info = &ipmi_hiomap_get_flash_info; + ctx->bl.exit = &ipmi_hiomap_exit; hiomap_init(ctx); @@ -968,11 +993,16 @@ err: return rc; } -void ipmi_hiomap_exit(struct blocklevel_device *bl) +bool ipmi_hiomap_exit(struct blocklevel_device *bl) { + bool status = true; + struct ipmi_hiomap *ctx; if (bl) { ctx = container_of(bl, struct ipmi_hiomap, bl); + status = hiomap_reset(ctx); free(ctx); } + + return status; } diff --git a/libflash/ipmi-hiomap.h b/libflash/ipmi-hiomap.h index edd4ee0a3..d2ce54693 100644 --- a/libflash/ipmi-hiomap.h +++ b/libflash/ipmi-hiomap.h @@ -53,6 +53,6 @@ struct ipmi_hiomap { }; int ipmi_hiomap_init(struct blocklevel_device **bl); -void ipmi_hiomap_exit(struct blocklevel_device *bl); +bool ipmi_hiomap_exit(struct blocklevel_device *bl); #endif /* __LIBFLASH_IPMI_HIOMAP_H */ diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c index 11ec90523..34d1615be 100644 --- a/libflash/mbox-flash.c +++ b/libflash/mbox-flash.c @@ -816,6 +816,28 @@ static int mbox_flash_read(struct blocklevel_device *bl, uint64_t pos, return rc; } +static bool mbox_flash_reset(struct blocklevel_device *bl) +{ + int rc; + struct mbox_flash_data *mbox_flash; + struct bmc_mbox_msg msg = MSG_CREATE(MBOX_C_RESET_STATE); + + prlog(PR_NOTICE, "MBOX reset\n"); + mbox_flash = container_of(bl, struct mbox_flash_data, bl); + + rc = msg_send(mbox_flash, &msg, mbox_flash->timeout); + if (rc) { + prlog(PR_ERR, "Failed to enqueue/send BMC MBOX RESET msg\n"); + return false; + } + if (wait_for_bmc(mbox_flash, mbox_flash->timeout)) { + prlog(PR_ERR, "Error waiting for BMC\n"); + return false; + } + + return true; +} + static int mbox_flash_get_info(struct blocklevel_device *bl, const char **name, uint64_t *total_size, uint32_t *erase_granule) { @@ -1151,6 +1173,7 @@ int mbox_flash_init(struct blocklevel_device **bl) mbox_flash->bl.write = &mbox_flash_write; mbox_flash->bl.erase = &mbox_flash_erase_v2; mbox_flash->bl.get_info = &mbox_flash_get_info; + mbox_flash->bl.exit = &mbox_flash_exit; if (bmc_mbox_get_attn_reg() & MBOX_ATTN_BMC_REBOOT) rc = handle_reboot(mbox_flash); @@ -1167,11 +1190,15 @@ int mbox_flash_init(struct blocklevel_device **bl) return 0; } -void mbox_flash_exit(struct blocklevel_device *bl) +bool mbox_flash_exit(struct blocklevel_device *bl) { + bool status = true; struct mbox_flash_data *mbox_flash; if (bl) { + status = mbox_flash_reset(bl); mbox_flash = container_of(bl, struct mbox_flash_data, bl); free(mbox_flash); } + + return status; } diff --git a/libflash/mbox-flash.h b/libflash/mbox-flash.h index 34b4f651d..ba5dc769a 100644 --- a/libflash/mbox-flash.h +++ b/libflash/mbox-flash.h @@ -19,7 +19,7 @@ int mbox_flash_lock(struct blocklevel_device *bl, uint64_t pos, uint64_t len); int mbox_flash_init(struct blocklevel_device **bl); -void mbox_flash_exit(struct blocklevel_device *bl); +bool mbox_flash_exit(struct blocklevel_device *bl); #endif /* __LIBFLASH_MBOX_FLASH_H */ diff --git a/libflash/test/mbox-server.c b/libflash/test/mbox-server.c index e03578834..d0d0e0938 100644 --- a/libflash/test/mbox-server.c +++ b/libflash/test/mbox-server.c @@ -286,6 +286,7 @@ int bmc_mbox_enqueue(struct bmc_mbox_msg *msg, switch (msg->command) { case MBOX_C_RESET_STATE: prlog(PR_INFO, "RESET_STATE\n"); + server_state.win_type = WIN_CLOSED; rc = open_window(msg, false, 0, LPC_BLOCKS); memset(msg->args, 0, sizeof(msg->args)); break; diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c index e1bc5ef38..18da7346c 100644 --- a/libflash/test/test-ipmi-hiomap.c +++ b/libflash/test/test-ipmi-hiomap.c @@ -476,10 +476,101 @@ static const struct scenario_event hiomap_erase_qs0l1_call = { }, }; +static const struct scenario_event hiomap_reset_call_seq_4 = { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_RESET, + .seq = 4, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_RESET, + .seq = 4, + }, + }, +}; + +static const struct scenario_event hiomap_reset_call_seq_5 = { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_RESET, + .seq = 5, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_RESET, + .seq = 5, + }, + }, +}; + +static const struct scenario_event hiomap_reset_call_seq_6 = { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_RESET, + .seq = 6, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_RESET, + .seq = 6, + }, + }, +}; + +static const struct scenario_event hiomap_reset_call_seq_7 = { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_RESET, + .seq = 7, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_RESET, + .seq = 7, + }, + }, +}; + +static const struct scenario_event hiomap_reset_call_seq_9 = { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_RESET, + .seq = 9, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_RESET, + .seq = 9, + }, + }, +}; + +static const struct scenario_event hiomap_reset_call_seq_a = { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_RESET, + .seq = 0xa, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_RESET, + .seq = 0xa, + }, + }, +}; + static const struct scenario_event scenario_hiomap_init[] = { { .type = scenario_event_p, .p = &hiomap_ack_call, }, { .type = scenario_event_p, .p = &hiomap_get_info_call, }, { .type = scenario_event_p, .p = &hiomap_get_flash_info_call, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_4, }, SCENARIO_SENTINEL, }; @@ -498,6 +589,7 @@ static const struct scenario_event scenario_hiomap_event_daemon_ready[] = { { .type = scenario_event_p, .p = &hiomap_get_info_call, }, { .type = scenario_event_p, .p = &hiomap_get_flash_info_call, }, { .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_DAEMON_READY } }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_4, }, SCENARIO_SENTINEL, }; @@ -520,6 +612,7 @@ static const struct scenario_event scenario_hiomap_event_daemon_stopped[] = { { .type = scenario_event_p, .p = &hiomap_get_flash_info_call, }, { .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_DAEMON_READY } }, { .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_PROTOCOL_RESET } }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_4, }, SCENARIO_SENTINEL, }; @@ -543,6 +636,7 @@ static const struct scenario_event scenario_hiomap_event_daemon_restarted[] = { { .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_DAEMON_READY } }, { .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_PROTOCOL_RESET } }, { .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_DAEMON_READY } }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_4, }, SCENARIO_SENTINEL, }; @@ -572,6 +666,7 @@ scenario_hiomap_event_daemon_lost_flash_control[] = { | HIOMAP_E_FLASH_LOST), } }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -677,6 +772,7 @@ scenario_hiomap_event_daemon_regained_flash_control_dirty[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, }, SCENARIO_SENTINEL, }; @@ -819,6 +915,7 @@ static const struct scenario_event scenario_hiomap_protocol_reset_recovery[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_9, }, SCENARIO_SENTINEL, }; @@ -851,6 +948,7 @@ scenario_hiomap_protocol_read_one_block[] = { .type = scenario_event_p, .p = &hiomap_create_read_window_qs0l1_rs0l1_call, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -924,6 +1022,7 @@ scenario_hiomap_protocol_read_two_blocks[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, }, SCENARIO_SENTINEL, }; @@ -976,6 +1075,7 @@ scenario_hiomap_protocol_read_one_block_twice[] = { .type = scenario_event_p, .p = &hiomap_create_read_window_qs0l1_rs0l1_call, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -1011,6 +1111,7 @@ scenario_hiomap_protocol_event_before_action[] = { HIOMAP_E_FLASH_LOST, } }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -1044,6 +1145,7 @@ scenario_hiomap_protocol_event_during_read[] = { HIOMAP_E_FLASH_LOST, } }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -1079,6 +1181,7 @@ scenario_hiomap_protocol_write_one_block[] = { }, { .type = scenario_event_p, .p = &hiomap_mark_dirty_qs0l1_call, }, { .type = scenario_event_p, .p = &hiomap_flush_call, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, }, SCENARIO_SENTINEL, }; @@ -1163,6 +1266,7 @@ scenario_hiomap_protocol_write_two_blocks[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_a, }, SCENARIO_SENTINEL, }; @@ -1245,6 +1349,7 @@ scenario_hiomap_protocol_write_one_block_twice[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_9, }, SCENARIO_SENTINEL, }; @@ -1298,6 +1403,7 @@ scenario_hiomap_protocol_event_during_write[] = { HIOMAP_E_FLASH_LOST, } }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, }, SCENARIO_SENTINEL, }; @@ -1339,6 +1445,7 @@ scenario_hiomap_protocol_erase_one_block[] = { .type = scenario_event_p, .p = &hiomap_flush_call, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, }, SCENARIO_SENTINEL, }; @@ -1387,6 +1494,7 @@ scenario_hiomap_protocol_erase_two_blocks[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_a, }, SCENARIO_SENTINEL, }; @@ -1446,6 +1554,7 @@ scenario_hiomap_protocol_erase_one_block_twice[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_9, }, SCENARIO_SENTINEL, }; @@ -1513,6 +1622,7 @@ scenario_hiomap_protocol_event_during_erase[] = { HIOMAP_E_FLASH_LOST, } }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, }, SCENARIO_SENTINEL, }; @@ -1617,6 +1727,7 @@ scenario_hiomap_protocol_get_flash_info[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -1643,6 +1754,7 @@ scenario_hiomap_protocol_persistent_error[] = { { .type = scenario_event_p, .p = &hiomap_get_info_call, }, { .type = scenario_event_p, .p = &hiomap_get_flash_info_call, }, { .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_PROTOCOL_RESET } }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, }, SCENARIO_SENTINEL, }; @@ -1741,6 +1853,7 @@ scenario_hiomap_create_read_window_error[] = { .cc = IPMI_INVALID_COMMAND_ERR, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -1782,6 +1895,7 @@ scenario_hiomap_create_write_window_error[] = { .cc = IPMI_INVALID_COMMAND_ERR, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -1826,6 +1940,7 @@ static const struct scenario_event scenario_hiomap_mark_dirty_error[] = { .cc = IPMI_INVALID_COMMAND_ERR, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, }, SCENARIO_SENTINEL, }; @@ -1867,6 +1982,7 @@ static const struct scenario_event scenario_hiomap_flush_error[] = { .cc = IPMI_INVALID_COMMAND_ERR, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, }, SCENARIO_SENTINEL, }; @@ -1917,6 +2033,7 @@ static const struct scenario_event scenario_hiomap_erase_error[] = { .cc = IPMI_INVALID_COMMAND_ERR, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, }, SCENARIO_SENTINEL, }; @@ -2137,6 +2254,7 @@ scenario_hiomap_create_read_window_malformed_small[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -2184,6 +2302,7 @@ scenario_hiomap_create_read_window_malformed_large[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -2230,6 +2349,7 @@ scenario_hiomap_create_write_window_malformed_small[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -2277,6 +2397,7 @@ scenario_hiomap_create_write_window_malformed_large[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, }, SCENARIO_SENTINEL, }; @@ -2326,6 +2447,7 @@ scenario_hiomap_mark_dirty_malformed_small[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, }, SCENARIO_SENTINEL, }; @@ -2376,6 +2498,7 @@ scenario_hiomap_mark_dirty_malformed_large[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, }, SCENARIO_SENTINEL, }; @@ -2422,6 +2545,7 @@ scenario_hiomap_flush_malformed_small[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, }, SCENARIO_SENTINEL, }; @@ -2469,6 +2593,7 @@ scenario_hiomap_flush_malformed_large[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, }, SCENARIO_SENTINEL, }; @@ -2518,6 +2643,7 @@ scenario_hiomap_erase_malformed_small[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, }, SCENARIO_SENTINEL, }; @@ -2563,6 +2689,7 @@ scenario_hiomap_erase_malformed_large[] = { }, }, }, + { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, }, SCENARIO_SENTINEL, }; @@ -2768,6 +2895,20 @@ scenario_hiomap_protocol_recovery_failure_ack[] = { }, }, }, + { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_RESET, + .seq = 14, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_RESET, + .seq = 14, + }, + }, + }, SCENARIO_SENTINEL, }; @@ -2938,6 +3079,20 @@ scenario_hiomap_protocol_recovery_failure_get_info[] = { }, }, }, + { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_RESET, + .seq = 15, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_RESET, + .seq = 15, + }, + }, + }, SCENARIO_SENTINEL, }; @@ -3107,6 +3262,20 @@ scenario_hiomap_protocol_recovery_failure_get_flash_info[] = { }, }, }, + { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_RESET, + .seq = 16, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_RESET, + .seq = 16, + }, + }, + }, SCENARIO_SENTINEL, }; From patchwork Fri Jul 12 11:17:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131310 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVtM6KnMz9sBF for ; Fri, 12 Jul 2019 21:23:55 +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 45lVtM4wT8zDr4N for ; Fri, 12 Jul 2019 21:23:55 +1000 (AEST) 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 45lVmm4SyqzDqfP for ; Fri, 12 Jul 2019 21:19:04 +1000 (AEST) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGkWG075461 for ; Fri, 12 Jul 2019 07:19:02 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tppceyr5f-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:19:02 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:19:00 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:57 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIuRa48955596 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:56 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EC2C24C052; Fri, 12 Jul 2019 11:18:55 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ADEC84C046; Fri, 12 Jul 2019 11:18:53 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:53 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:55 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0012-0000-0000-00000332140C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0013-0000-0000-0000216B8415 Message-Id: <20190712111802.23560-19-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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=954 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 18/25] platform: Introduce new reboot type X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Enhance reboot2 call to support MPIPL. Payload will call this interface to initiate MPIPL. Signed-off-by: Vasant Hegde --- core/platform.c | 8 +++++++- doc/opal-api/opal-cec-reboot-6-116.rst | 7 +++++++ include/opal-api.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/platform.c b/core/platform.c index efcf63d77..fea00070e 100644 --- a/core/platform.c +++ b/core/platform.c @@ -1,4 +1,4 @@ -/* Copyright 2013-2016 IBM Corp. +/* Copyright 2013-2019 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ +#include #include #include #include @@ -110,6 +111,11 @@ static int64_t opal_cec_reboot2(uint32_t reboot_type, char *diag) case OPAL_REBOOT_FULL_IPL: disable_fast_reboot("full IPL reboot requested"); return opal_cec_reboot(); + case OPAL_REBOOT_MPIPL: + prlog(PR_NOTICE, "Reboot: OS reported error. Performing MPIPL\n"); + console_complete_flush(); + _abort("Reboot: OS reported error. Performing MPIPL\n"); + break; default: prlog(PR_NOTICE, "OPAL: Unsupported reboot request %d\n", reboot_type); return OPAL_UNSUPPORTED; diff --git a/doc/opal-api/opal-cec-reboot-6-116.rst b/doc/opal-api/opal-cec-reboot-6-116.rst index ba31e7a7a..9a5c79446 100644 --- a/doc/opal-api/opal-cec-reboot-6-116.rst +++ b/doc/opal-api/opal-cec-reboot-6-116.rst @@ -127,6 +127,13 @@ OPAL_REBOOT_FULL_IPL = 2 On platforms that don't support fast reboot, this is equivalent to a normal reboot. +OPAL_REBOOT_MPIPL = 3 + Request for MPIPL reboot. Firmware will reboot the system and collect + dump. + + On platforms that don't support MPIPL, this is equivalent to a + normal assert. + Unsupported Reboot type For unsupported reboot type, this function will return with OPAL_UNSUPPORTED and no reboot will be triggered. diff --git a/include/opal-api.h b/include/opal-api.h index d88703556..939b836ca 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1136,6 +1136,7 @@ enum { OPAL_REBOOT_NORMAL = 0, OPAL_REBOOT_PLATFORM_ERROR, OPAL_REBOOT_FULL_IPL, + OPAL_REBOOT_MPIPL, }; /* Argument to OPAL_PCI_TCE_KILL */ From patchwork Fri Jul 12 11:17:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131311 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVtf5H1Pz9sBt for ; Fri, 12 Jul 2019 21:24:10 +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 45lVtf4JLwzDqwn for ; Fri, 12 Jul 2019 21:24:10 +1000 (AEST) 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 45lVmq0mByzDqg7 for ; Fri, 12 Jul 2019 21:19:06 +1000 (AEST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBHh3p091254 for ; Fri, 12 Jul 2019 07:19:04 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tpry00s9h-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:19:03 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:19:01 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:18:59 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBIjSi33489164 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:18:45 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7F7FB4C046; Fri, 12 Jul 2019 11:18:58 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4EF3C4C044; Fri, 12 Jul 2019 11:18:56 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:56 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:56 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0016-0000-0000-0000029209B9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0017-0000-0000-000032EFCDCC Message-Id: <20190712111802.23560-20-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 19/25] hdata: Add "mpipl-boot" property to "dump" node X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" During MPIPL boot, hostboot updates HDAT to indicate its MPIPL boot. Lets add "mpipl-boot" property to device tree. So that kernel can detect its MPIPL boot and create dump. Device tree property: /ibm,opal/dump/mpipl-boot - Indicate kernel that its MPIPL boot Signed-off-by: Vasant Hegde --- hdata/spira.c | 43 +++++++++++++++++++++++++++++++++++++++++++ hdata/spira.h | 4 ++++ 2 files changed, 47 insertions(+) diff --git a/hdata/spira.c b/hdata/spira.c index 58aee742f..9d487b8b2 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -934,6 +934,46 @@ static void dt_init_secureboot_node(const struct iplparams_sysparams *sysparams) dt_add_property_cells(node, "hw-key-hash-size", hw_key_hash_size); } +static void opal_dump_add_mpipl_boot(const struct iplparams_iplparams *p) +{ + u32 mdrt_cnt = spira.ntuples.mdump_res.act_cnt; + u32 mdrt_max_cnt = MDRT_TABLE_SIZE / sizeof(struct mdrt_table); + struct dt_node *dump_node; + + dump_node = dt_find_by_path(opal_node, "dump"); + if (!dump_node) + return; + + /* Check boot params to detect MPIPL boot or not */ + if (p->cec_ipl_maj_type != IPLPARAMS_MAJ_TYPE_REIPL) + return; + + /* + * On FSP system we get minor type as post dump IPL and on BMC system + * we get platform reboot. Hence lets check for both values. + */ + if (p->cec_ipl_min_type != IPLPARAMS_MIN_TYPE_POST_DUMP && + p->cec_ipl_min_type != IPLPARAMS_MIN_TYPE_PLAT_REBOOT) { + prlog(PR_NOTICE, "DUMP: Non MPIPL reboot " + "[minor type = 0x%x]\n", p->cec_ipl_min_type); + return; + } + + if (p->cec_ipl_attrib != IPLPARAMS_ATTRIB_MEM_PRESERVE) { + prlog(PR_DEBUG, "DUMP: Memory not preserved\n"); + return; + } + + if (mdrt_cnt == 0 || mdrt_cnt >= mdrt_max_cnt) { + prlog(PR_DEBUG, "DUMP: Invalid MDRT count : %x\n", mdrt_cnt); + return; + } + + prlog(PR_NOTICE, "DUMP: Dump found, MDRT count = 0x%x\n", mdrt_cnt); + + dt_add_property(dump_node, "mpipl-boot", NULL, 0); +} + static void add_opal_dump_node(void) { u64 fw_load_area[4]; @@ -1094,6 +1134,9 @@ static void add_iplparams_ipl_params(const void *iplp, struct dt_node *node) else dt_add_property_strings(led_node, DT_PROPERTY_LED_MODE, LED_MODE_GUIDING_LIGHT); + + /* Populate opal dump result table */ + opal_dump_add_mpipl_boot(p); } static void add_iplparams_serials(const void *iplp, struct dt_node *node) diff --git a/hdata/spira.h b/hdata/spira.h index d29632821..3d8f46ff2 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -401,8 +401,12 @@ struct iplparams_iplparams { #define IPLPARAMS_FSP_FW_IPL_SIDE_TEMP 0x01 uint8_t ipl_speed; __be16 cec_ipl_attrib; +#define IPLPARAMS_ATTRIB_MEM_PRESERVE PPC_BIT16(2) uint8_t cec_ipl_maj_type; +#define IPLPARAMS_MAJ_TYPE_REIPL 0x1 uint8_t cec_ipl_min_type; +#define IPLPARAMS_MIN_TYPE_POST_DUMP 0xc +#define IPLPARAMS_MIN_TYPE_PLAT_REBOOT 0xd uint8_t os_ipl_mode; uint8_t keylock_pos; uint8_t lmb_size; From patchwork Fri Jul 12 11:17:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131312 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVty28Wxz9sBt for ; Fri, 12 Jul 2019 21:24:26 +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 45lVty0FmZzDqww for ; Fri, 12 Jul 2019 21:24:26 +1000 (AEST) 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 45lVms0gddzDqgW for ; Fri, 12 Jul 2019 21:19:08 +1000 (AEST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGeDj062537 for ; Fri, 12 Jul 2019 07:19:07 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tpr7panqj-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:19:06 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:19:05 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:19:02 +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 x6CBJ1rO52690958 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:19:01 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CFB24C04E; Fri, 12 Jul 2019 11:19:01 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9E024C046; Fri, 12 Jul 2019 11:18:58 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:18:58 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:57 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0012-0000-0000-00000332140F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0013-0000-0000-0000216B8417 Message-Id: <20190712111802.23560-21-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 20/25] MPIPL: Prepare OPAL data tag X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Post MPIPL kernel needs OPAL metadata to create opalcore. This patch sets up OPAL metadata tag. Next patch will add API to pass metadata pointer to kernel. Signed-off-by: Vasant Hegde --- core/opal-dump.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-api.h | 20 ++++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/core/opal-dump.c b/core/opal-dump.c index bb90c45d0..15f82146c 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -41,6 +41,10 @@ static struct spira_ntuple *ntuple_mdrt; static struct mpipl_metadata *mpipl_metadata; +/* Dump metadata area */ +static struct opal_mpipl_fadump *opal_mpipl_data; + + static int opal_mpipl_add_entry(u8 region, u64 src, u64 dest, u64 size) { int i, max_cnt; @@ -329,6 +333,60 @@ static int64_t opal_mpipl_register_tag(enum opal_mpipl_tags tag, return rc; } +static void post_mpipl_get_opal_data(void) +{ + struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE); + int i, j = 0, count = 0; + u32 mdrt_cnt = ntuple_mdrt->act_cnt; + struct opal_mpipl_region *region; + + /* Count OPAL dump regions */ + for (i = 0; i < mdrt_cnt; i++) { + if (mdrt->data_region == DUMP_REGION_OPAL_MEMORY) + count++; + mdrt++; + } + + if (count == 0) { + prlog(PR_INFO, "OPAL dump is not available\n"); + return; + } + + opal_mpipl_data = zalloc(sizeof(struct opal_mpipl_fadump) + + count * sizeof(struct opal_mpipl_region)); + if (!opal_mpipl_data) { + prlog(PR_ERR, "Failed to allocate memory\n"); + return; + } + + /* Fill OPAL dump details */ + opal_mpipl_data->version = OPAL_MPIPL_VERSION; + opal_mpipl_data->crashing_pir = mpipl_metadata->crashing_pir; + opal_mpipl_data->region_cnt = count; + region = opal_mpipl_data->region; + + mdrt = (void *)(MDRT_TABLE_BASE); + for (i = 0; i < mdrt_cnt; i++) { + if (mdrt->data_region != DUMP_REGION_OPAL_MEMORY) { + mdrt++; + continue; + } + + region[j].src = mdrt->src_addr & ~(HRMOR_BIT); + region[j].dest = mdrt->dest_addr & ~(HRMOR_BIT); + region[j].size = mdrt->size; + + prlog(PR_NOTICE, "OPAL reserved region %d - src : 0x%llx, " + "dest : 0x%llx, size : 0x%llx\n", j, region[j].src, + region[j].dest, region[j].size); + + mdrt++; + j++; + if (j == count) + break; + } +} + void opal_mpipl_save_crashing_pir(void) { mpipl_metadata->crashing_pir = this_cpu()->pir; @@ -353,6 +411,9 @@ void opal_mpipl_init(void) /* Get metadata area pointer */ mpipl_metadata = (void *)(DUMP_METADATA_AREA_BASE); + if (dt_find_property(dump_node, "mpipl-boot")) + post_mpipl_get_opal_data(); + /* Clear OPAL metadata area */ if (sizeof(struct mpipl_metadata) > DUMP_METADATA_AREA_SIZE) { prlog(PR_ERR, "INSUFFICIENT OPAL METADATA AREA\n"); diff --git a/include/opal-api.h b/include/opal-api.h index 939b836ca..25f4872e7 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1236,6 +1236,26 @@ enum opal_mpipl_tags { OPAL_MPIPL_TAG_BOOT_MEM = 3, }; +/* Preserved memory details */ +struct opal_mpipl_region { + u64 src; + u64 dest; + u64 size; +}; + +/* Structure version */ +#define OPAL_MPIPL_VERSION 0x01 + +struct opal_mpipl_fadump { + u8 version; + u8 reserved[7]; + u32 crashing_pir; /* OPAL crashing CPU PIR */ + u32 cpu_data_version; + u32 cpu_data_size; + u32 region_cnt; + struct opal_mpipl_region region[]; +} __packed; + #endif /* __ASSEMBLY__ */ #endif /* __OPAL_API_H */ From patchwork Fri Jul 12 11:17:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131314 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVvG3s37z9sBF for ; Fri, 12 Jul 2019 21:24:42 +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 45lVvG2YfxzDr0L for ; Fri, 12 Jul 2019 21:24:42 +1000 (AEST) 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 45lVmv39h4zDqfP for ; Fri, 12 Jul 2019 21:19:11 +1000 (AEST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGeRV059175 for ; Fri, 12 Jul 2019 07:19:08 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tpr9ht4wh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:19:08 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:19:06 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.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) Fri, 12 Jul 2019 12:19:04 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBJ4mR18219472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:19:04 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EAB8C4C044; Fri, 12 Jul 2019 11:19:03 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB6774C050; Fri, 12 Jul 2019 11:19:01 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:19:01 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:58 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0008-0000-0000-000002FCB259 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0009-0000-0000-0000226A1DE5 Message-Id: <20190712111802.23560-22-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 21/25] MPIPL: Add OPAL API to query saved tags X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Pre-MPIPL kernel saves various information required to create vmcore in metadata area and passes metadata area pointer to OPAL. OPAL will preserve this pointer across MPIPL. Post MPIPL kernel will request for saved tags via this API. Kernel also needs below tags: - Saved CPU registers data to access CPU registers - OPAL metadata area to create opalcore Format: opal_mpipl_query_tag(enum opal_mpipl_tags tag, uint64_t *tag_val) tag : OPAL_MPIPL_TAG_CPU Pointer to CPU register data content metadata area OPAL_MPIPL_TAG_OPAL Pointer to OPAL metadata area OPAL_MPIPL_TAG_KERNEL During first boot, kernel will setup its metadata area and asks OPAL to preserve metadata area pointer across MPIPL. Post MPIPL kernel calls this API to get metadata pointer and it will use that pointer to retrieve metadata and create dump. OPAL_MPIPL_TAG_BOOT_MEM During MPIPL registration kernel will specify how much memory firmware can use for Post MPIPL load. Post MPIPL petitboot kernel will query for this tag to get boot memory size. Return values: OPAL_SUCCESS : Operation success OPAL_PARAMETER : Invalid parameter Signed-off-by: Vasant Hegde --- core/opal-dump.c | 42 +++++++++++++++++++++++++++++++++++++++++- include/opal-api.h | 3 ++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index 15f82146c..2ff3a2f60 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -44,6 +44,18 @@ static struct mpipl_metadata *mpipl_metadata; /* Dump metadata area */ static struct opal_mpipl_fadump *opal_mpipl_data; +/* + * Number of tags passed by OPAL to kernel after MPIPL boot. + * Currently it supports below tags: + * - CPU register data area + * - OPAL metadata area address + * - Kernel passed tag during MPIPL registration + * - Post MPIPL boot memory size + */ +#define MAX_OPAL_MPIPL_TAGS 0x04 +static u64 opal_mpipl_tags[MAX_OPAL_MPIPL_TAGS]; +static int opal_mpipl_max_tags = MAX_OPAL_MPIPL_TAGS; + static int opal_mpipl_add_entry(u8 region, u64 src, u64 dest, u64 size) { @@ -333,6 +345,29 @@ static int64_t opal_mpipl_register_tag(enum opal_mpipl_tags tag, return rc; } +static uint64_t opal_mpipl_query_tag(enum opal_mpipl_tags tag, + uint64_t *tag_val) +{ + if (!opal_addr_valid(tag_val)) { + prlog(PR_DEBUG, "Invalid tag address\n"); + return OPAL_PARAMETER; + } + + if (tag >= opal_mpipl_max_tags) + return OPAL_PARAMETER; + + *tag_val = opal_mpipl_tags[tag]; + return OPAL_SUCCESS; +} + +static inline void post_mpipl_get_preserved_tags(void) +{ + if (mpipl_metadata->kernel_tag) + opal_mpipl_tags[OPAL_MPIPL_TAG_KERNEL] = mpipl_metadata->kernel_tag; + if (mpipl_metadata->boot_mem_size) + opal_mpipl_tags[OPAL_MPIPL_TAG_BOOT_MEM] = mpipl_metadata->boot_mem_size; +} + static void post_mpipl_get_opal_data(void) { struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE); @@ -385,6 +420,8 @@ static void post_mpipl_get_opal_data(void) if (j == count) break; } + + opal_mpipl_tags[OPAL_MPIPL_TAG_OPAL] = (u64)opal_mpipl_data; } void opal_mpipl_save_crashing_pir(void) @@ -411,8 +448,10 @@ void opal_mpipl_init(void) /* Get metadata area pointer */ mpipl_metadata = (void *)(DUMP_METADATA_AREA_BASE); - if (dt_find_property(dump_node, "mpipl-boot")) + if (dt_find_property(dump_node, "mpipl-boot")) { + post_mpipl_get_preserved_tags(); post_mpipl_get_opal_data(); + } /* Clear OPAL metadata area */ if (sizeof(struct mpipl_metadata) > DUMP_METADATA_AREA_SIZE) { @@ -436,4 +475,5 @@ void opal_mpipl_init(void) /* OPAL API for MPIPL update */ opal_register(OPAL_MPIPL_UPDATE, opal_mpipl_update, 4); opal_register(OPAL_MPIPL_REGISTER_TAG, opal_mpipl_register_tag, 2); + opal_register(OPAL_MPIPL_QUERY_TAG, opal_mpipl_query_tag, 2); } diff --git a/include/opal-api.h b/include/opal-api.h index 25f4872e7..20c105896 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -234,7 +234,8 @@ #define OPAL_NPU_MEM_RELEASE 172 #define OPAL_MPIPL_UPDATE 173 #define OPAL_MPIPL_REGISTER_TAG 174 -#define OPAL_LAST 174 +#define OPAL_MPIPL_QUERY_TAG 175 +#define OPAL_LAST 175 #define QUIESCE_HOLD 1 /* Spin all calls at entry */ #define QUIESCE_REJECT 2 /* Fail all calls with OPAL_BUSY */ From patchwork Fri Jul 12 11:17:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131316 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVvc40VDz9sBF for ; Fri, 12 Jul 2019 21:25:00 +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 45lVvc2stWzDr0v for ; Fri, 12 Jul 2019 21:25:00 +1000 (AEST) 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 45lVmz1nrNzDqdv for ; Fri, 12 Jul 2019 21:19:15 +1000 (AEST) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBHg0K012861 for ; Fri, 12 Jul 2019 07:19:13 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tpp0b0j1e-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:19:12 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:19:10 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:19:07 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBJ6xf63176886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:19:06 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 898B04C040; Fri, 12 Jul 2019 11:19:06 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 593E74C04A; Fri, 12 Jul 2019 11:19:04 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:19:04 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:47:59 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0016-0000-0000-0000029209BC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0017-0000-0000-000032EFCDCF Message-Id: <20190712111802.23560-23-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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=831 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 22/25] MPIPL: Clear tags and metadata X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Post dump process, kernel sends FREE_PRESERVE_MEMEORY notification to OPAL. OPAL will clear metadata section and tags. Subsequent opal_mpipl_query_tag() call will return OPAL_EMPTY. Signed-off-by: Vasant Hegde --- core/opal-dump.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/opal-dump.c b/core/opal-dump.c index 2ff3a2f60..6aefefdf7 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -301,6 +301,12 @@ static int64_t opal_mpipl_update(enum opal_mpipl_ops ops, prlog(PR_NOTICE, "Payload unregistered for MPIPL\n"); break; case OPAL_MPIPL_FREE_PRESERVED_MEMORY: + /* Clear tags */ + memset(&opal_mpipl_tags, 0, (sizeof(u64) * MAX_OPAL_MPIPL_TAGS)); + opal_mpipl_max_tags = 0; + /* Release memory */ + free(opal_mpipl_data); + opal_mpipl_data = NULL; /* Clear MDRT table */ memset((void *)MDRT_TABLE_BASE, 0, MDRT_TABLE_SIZE); /* Set MDRT count to max allocated count */ From patchwork Fri Jul 12 11:18:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131317 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVvz22Kbz9sBF for ; Fri, 12 Jul 2019 21:25:19 +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 45lVvz17cszDqmC for ; Fri, 12 Jul 2019 21:25:19 +1000 (AEST) 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 45lVmz6J77zDqdv for ; Fri, 12 Jul 2019 21:19:15 +1000 (AEST) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGhW8048297 for ; Fri, 12 Jul 2019 07:19:14 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2tpqga4d6u-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:19:13 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:19:12 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:19:10 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBJ9Ig55050370 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:19:09 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12DA54C04E; Fri, 12 Jul 2019 11:19:09 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E3D5B4C044; Fri, 12 Jul 2019 11:19:06 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:19:06 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:48:00 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0012-0000-0000-000003321410 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0013-0000-0000-0000216B8419 Message-Id: <20190712111802.23560-24-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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=875 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 23/25] MPIPL: Reserve memory to capture architected registers data X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" - Split SPIRAH memory to accommodate architected register ntuple. Today we have 1K memory for SPIRAH and it uses 288 bytes. Lets split this into two parts : SPIRAH (756 bytes) architected register memory (256 bytes) - Update SPIRAH architected register ntuple - Calculate memory required to capture architected registers data Ideally we should use HDAT provided data (proc_dump_area->thread_size). But we are not getting this data during boot. Hence lets reserve fixed memory for architected registers data collection. - Add architected registers destination memory to reserve-memory DT node. Signed-off-by: Vasant Hegde --- core/opal-dump.c | 28 ++++++++++++++++++++++++++++ hdata/spira.c | 7 +++++++ include/mem-map.h | 14 +++++++++++++- skiboot.lds.S | 5 +++++ 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index 6aefefdf7..fb8ff9fe8 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -16,6 +16,7 @@ #define pr_fmt(fmt) "DUMP: " fmt +#include #include #include #include @@ -31,9 +32,16 @@ #include "hdata/spira.h" +/* XXX Ideally we should use HDAT provided data (proc_dump_area->thread_size). + * But we are not getting this data durig boot. Hence lets reserve fixed + * memory for architected registers data collection. + */ +#define ARCH_REGS_DATA_SIZE_PER_CHIP (512 * 1024) + /* Actual address of MDST and MDDT table */ #define MDST_TABLE_BASE (SKIBOOT_BASE + MDST_TABLE_OFF) #define MDDT_TABLE_BASE (SKIBOOT_BASE + MDDT_TABLE_OFF) +#define PROC_DUMP_AREA_BASE (SKIBOOT_BASE + PROC_DUMP_AREA_OFF) static struct spira_ntuple *ntuple_mdst; static struct spira_ntuple *ntuple_mddt; @@ -214,6 +222,8 @@ static int opal_mpipl_remove_entry_mddt(bool remove_all, u8 region, u64 dest) static void opal_mpipl_register(void) { u64 opal_dest, opal_size; + u64 arch_regs_dest, arch_regs_size; + struct proc_dump_area *proc_dump = (void *)(PROC_DUMP_AREA_BASE); /* Get OPAL runtime size */ if (!dt_find_property(opal_node, "opal-runtime-size")) { @@ -233,6 +243,24 @@ static void opal_mpipl_register(void) /* Add OPAL reservation detail to MDST/MDDT table */ opal_mpipl_add_entry(DUMP_REGION_OPAL_MEMORY, SKIBOOT_BASE, opal_dest, opal_size); + + /* Thread size check */ + if (proc_dump->thread_size != 0) { + prlog(PR_INFO, "Thread register entry size is available, " + "but not supported.\n"); + } + + /* Calculate memory to capture CPU register data */ + arch_regs_dest = opal_dest + opal_size; + arch_regs_size = nr_chips() * ARCH_REGS_DATA_SIZE_PER_CHIP; + + /* Reserve memory used to capture architected register state */ + mem_reserve_fw("ibm,firmware-arch-registers", + arch_regs_dest, arch_regs_size); + proc_dump->alloc_addr = arch_regs_dest | HRMOR_BIT; + proc_dump->alloc_size = arch_regs_size; + prlog(PR_NOTICE, "Architected register dest addr : 0x%llx, " + "size : 0x%llx\n", arch_regs_dest, arch_regs_size); } static int payload_mpipl_register(u64 src, u64 dest, u64 size) diff --git a/hdata/spira.c b/hdata/spira.c index 9d487b8b2..76886b065 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -213,6 +213,13 @@ __section(".spirah.data") struct spirah spirah = { .alloc_len = CPU_TO_BE32(sizeof(struct mdrt_table)), .act_len = CPU_TO_BE32(sizeof(struct mdrt_table)), }, + .proc_dump_area = { + .addr = CPU_TO_BE64(PROC_DUMP_AREA_OFF), + .alloc_cnt = CPU_TO_BE16(1), + .act_cnt = CPU_TO_BE16(1), + .alloc_len = CPU_TO_BE32(sizeof(struct proc_dump_area)), + .act_len = CPU_TO_BE32(sizeof(struct proc_dump_area)), + }, }, }; diff --git a/include/mem-map.h b/include/mem-map.h index a29b8fb3e..859fef75c 100644 --- a/include/mem-map.h +++ b/include/mem-map.h @@ -38,10 +38,22 @@ * give it 64k before placing the SPIRA and related data. */ #define SPIRA_OFF 0x00010000 +#define SPIRA_SIZE 0x400 #define SPIRAH_OFF 0x00010400 +#define SPIRAH_SIZE 0x300 + +#define PROC_DUMP_AREA_OFF (SPIRAH_OFF + SPIRAH_SIZE) +#define PROC_DUMP_AREA_SIZE 0x100 /* Actual SPIRA size is lesser than 1K (presently 0x340 bytes). - * Use 1K for legacy SPIRA and 1K for SPIRA-H. + * Use 1K for legacy SPIRA. + * + * SPIRA-H is lesser than 768 bytes (presently we use 288 bytes) + * Use 768 bytes for SPIRAH. + * + * Use 256 bytes for processor dump area. (presently we use + * sizeof(proc_dump_area) = 0x30 bytes). + * * Then follow with for proc_init_data (aka PROCIN). * These need to be at fixed addresses in case we're ever little * endian: linker can't endian reverse a pointer for us. Text, data diff --git a/skiboot.lds.S b/skiboot.lds.S index 5fb32c866..81fa6eaa1 100644 --- a/skiboot.lds.S +++ b/skiboot.lds.S @@ -80,6 +80,11 @@ SECTIONS KEEP(*(.spirah.data)) } + . = PROC_DUMP_AREA_OFF; + .procdump : { + KEEP(*(.procdump.data)) + } + . = PROCIN_OFF; .procin.data : { KEEP(*(.procin.data)) From patchwork Fri Jul 12 11:18:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131318 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVwL40MJz9sBF for ; Fri, 12 Jul 2019 21:25:38 +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 45lVwL34w7zDr1r for ; Fri, 12 Jul 2019 21:25:38 +1000 (AEST) 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 45lVn21zddzDqfG for ; Fri, 12 Jul 2019 21:19:18 +1000 (AEST) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBGXVF039992 for ; Fri, 12 Jul 2019 07:19:16 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tps488bjq-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:19:16 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:19:13 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 12:19:12 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBJBWZ31588756 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:19:11 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 73D5B4C046; Fri, 12 Jul 2019 11:19:11 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 766D14C040; Fri, 12 Jul 2019 11:19:09 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:19:09 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:48:01 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0016-0000-0000-0000029209BD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0017-0000-0000-000032EFCDD1 Message-Id: <20190712111802.23560-25-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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=809 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 24/25] MPIPL: Prepare architected registers data tag X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Post MPIPL kernel needs saved CPU register details to create vmcore/opalcore. This patch prepares CPU register data tag and add it to tags list. Signed-off-by: Vasant Hegde --- core/opal-dump.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/core/opal-dump.c b/core/opal-dump.c index fb8ff9fe8..3bea1f105 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -51,6 +51,7 @@ static struct mpipl_metadata *mpipl_metadata; /* Dump metadata area */ static struct opal_mpipl_fadump *opal_mpipl_data; +static struct opal_mpipl_fadump *opal_mpipl_cpu_data; /* * Number of tags passed by OPAL to kernel after MPIPL boot. @@ -402,6 +403,41 @@ static inline void post_mpipl_get_preserved_tags(void) opal_mpipl_tags[OPAL_MPIPL_TAG_BOOT_MEM] = mpipl_metadata->boot_mem_size; } +static void post_mpipl_arch_regs_data(void) +{ + struct proc_dump_area *proc_dump = (void *)(PROC_DUMP_AREA_BASE); + + if (proc_dump->dest_addr == 0) { + prlog(PR_DEBUG, "Invalid CPU registers destination address\n"); + return; + } + + if (proc_dump->act_size == 0) { + prlog(PR_DEBUG, "Invalid CPU registers destination size\n"); + return; + } + + opal_mpipl_cpu_data = zalloc(sizeof(struct opal_mpipl_fadump) + + sizeof(struct opal_mpipl_region)); + if (!opal_mpipl_cpu_data) { + prlog(PR_ERR, "Failed to allocate memory\n"); + return; + } + + /* Fill CPU register details */ + opal_mpipl_cpu_data->version = OPAL_MPIPL_VERSION; + opal_mpipl_cpu_data->cpu_data_version = proc_dump->version; + opal_mpipl_cpu_data->cpu_data_size = proc_dump->thread_size; + opal_mpipl_cpu_data->region_cnt = cpu_to_be32(1); + + opal_mpipl_cpu_data->region[0].src = proc_dump->dest_addr & ~(HRMOR_BIT); + opal_mpipl_cpu_data->region[0].dest = proc_dump->dest_addr & ~(HRMOR_BIT); + opal_mpipl_cpu_data->region[0].size = proc_dump->act_size; + + /* Update tag */ + opal_mpipl_tags[OPAL_MPIPL_TAG_CPU] = (u64)opal_mpipl_cpu_data; +} + static void post_mpipl_get_opal_data(void) { struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE); @@ -485,6 +521,7 @@ void opal_mpipl_init(void) if (dt_find_property(dump_node, "mpipl-boot")) { post_mpipl_get_preserved_tags(); post_mpipl_get_opal_data(); + post_mpipl_arch_regs_data(); } /* Clear OPAL metadata area */ From patchwork Fri Jul 12 11:18:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1131320 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lVwl0y5Wz9sBF for ; Fri, 12 Jul 2019 21:25:59 +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 45lVwk72FDzDqxB for ; Fri, 12 Jul 2019 21:25:58 +1000 (AEST) 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 45lVn65r3szDqgl for ; Fri, 12 Jul 2019 21:19:22 +1000 (AEST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CBHgVD091223 for ; Fri, 12 Jul 2019 07:19:21 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tpry00skc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 07:19:20 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 12:19:18 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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) Fri, 12 Jul 2019 12:19:15 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CBJEs612058742 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 11:19:14 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 145484C04A; Fri, 12 Jul 2019 11:19:14 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C5FFC4C044; Fri, 12 Jul 2019 11:19:11 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.57]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 11:19:11 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 12 Jul 2019 16:48:02 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> References: <20190712111802.23560-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19071211-0008-0000-0000-000002FCB25B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071211-0009-0000-0000-0000226A1DE7 Message-Id: <20190712111802.23560-26-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_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-1810050000 definitions=main-1907120122 Subject: [Skiboot] [PATCH v9 25/25] MPIPL: Add documentation X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 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, mikey@neuling.org, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Document MPIPL device tree and OPAL APIs. Signed-off-by: Vasant Hegde Signed-off-by: Ananth N Mavinakayanahalli --- doc/device-tree/ibm,opal/dump.rst | 37 ++++++++ doc/index.rst | 1 + doc/mpipl.rst | 48 ++++++++++ doc/opal-api/index.rst | 6 ++ doc/opal-api/opal-cec-reboot-6-116.rst | 2 + doc/opal-api/opal-mpipl-173-174.rst | 156 +++++++++++++++++++++++++++++++++ 6 files changed, 250 insertions(+) create mode 100644 doc/device-tree/ibm,opal/dump.rst create mode 100644 doc/mpipl.rst create mode 100644 doc/opal-api/opal-mpipl-173-174.rst diff --git a/doc/device-tree/ibm,opal/dump.rst b/doc/device-tree/ibm,opal/dump.rst new file mode 100644 index 000000000..81a09ce26 --- /dev/null +++ b/doc/device-tree/ibm,opal/dump.rst @@ -0,0 +1,37 @@ +.. _device-tree/ibm,opal/dump: + +Dump (MPIPL) Device Tree Binding +================================= + +See :ref:`mpipl` for general MPIPL information. + +dump node +--------- +.. code-block:: dts + + dump { + /* + * Memory used by OPAL to load kernel/initrd from PNOR + * (KERNEL_LOAD_BASE & INITRAMFS_LOAD_BASE). This is the + * temporary memory used by OPAL during boot. Later Linux + * kernel is free to use this memory. During MPIPL boot + * also OPAL will overwrite this memory. + * + * OPAL will advertise these memory details to kernel. + * If kernel is using these memory and needs these memory + * content for proper dump creation, then it has to reserve + * destination memory to preserve these memory ranges. + * Also kernel should pass this detail during registration. + * During MPIPL firmware will take care of preserving memory + * and post MPIPL kernel can create proper dump. + */ + fw-load-area = <0x0 0x20000000 0x0 0x8000000 0x0 0x28000000 0x0 0x8000000>; + /* Compatible property */ + compatible = "ibm,opal-dump"; + phandle = <0x98>; + /* + * This property indicates that its MPIPL boot. Kernel will use OPAL API + * to retrieve metadata tags and use metadata to create dump. + */ + mpipl-boot + }; diff --git a/doc/index.rst b/doc/index.rst index 79a5accf2..f21a658f9 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -47,6 +47,7 @@ Developer Guide and Internals xive imc power-management + mpipl OPAL ABI diff --git a/doc/mpipl.rst b/doc/mpipl.rst new file mode 100644 index 000000000..b00d336a0 --- /dev/null +++ b/doc/mpipl.rst @@ -0,0 +1,48 @@ +.. _mpipl: + +MPIPL (aka FADUMP) Overview +=========================== + +Memory Preserving Initial Program Load (MPIPL) is a Power feature where the +contents of memory are preserved while the system reboots after a failure. +This is accomplished by the firmware/OS publishing ranges of memory to be +preserved across boots. + +Registration +------------ +In the OPAL context, OPAL and host Linux communicate the memory ranges to be +preserved via source descriptor tables in the HDAT (MDST and MDDT table inside +SPIRAH). Host Linux can register/unregister using OPAL_MPIPL_UPDATE API (see +:ref:`opal-api-mpipl`). + +Initiating dump +--------------- +Whenever Linux crashes, it makes reboot2 OPAL call with type as MPIPL. (see +:ref:`opal-api-cec-reboot`). Depending on sevice processor type OPAL makes +appropriate call to initiate MPIPL. On FSP system we call `attn` instruction +(see ``__trigger_attn()``) and on BMC system we call SBE `S0 interrupt` +(see ``p9_sbe_terminate()``). + +Dump collection +--------------- +Hostboot then re-IPLs the machine taking care to copy over contents of the +source memory to a alternate memory locations as specified in descriptor table. +Hostboot publishes this information in the result descriptor tables (MDRT table +inside SPIRAH structure). The success/failure of the copy is indicated by a +results table. + +SBE/Hostboot also does the requisite procedures to gather hardware register +states for all active threads at the time of the crash. + +MPIPL boot +---------- +On MPIPL boot, OPAL adds device tree entry (``/ibm,opal/dump/mpipl-boot``) +to indicate its MPIPL boot. Kernel will use OPAL_MPIPL_QUERY_TAG API +(:ref:`opal-api-mpipl`) to retrieve metadata tag. Kernel then uses its +existing logic (kdump/fadump) to write out a core dump of OPAL and Linux +kernel in a format that GDB and crash can understand. + +Device tree +----------- +We create new device tree node (``/ibm,opal/dump``) to pass dump details to Linux +kernel from OPAL (see :ref:`device-tree/ibm,opal/dump`). diff --git a/doc/opal-api/index.rst b/doc/opal-api/index.rst index b2fe942c7..96ce62a28 100644 --- a/doc/opal-api/index.rst +++ b/doc/opal-api/index.rst @@ -384,6 +384,12 @@ The OPAL API is the interface between an Operating System and OPAL. +---------------------------------------------+--------------+------------------------+----------+-----------------+ | :ref:`OPAL_NPU_MEM_RELEASE` | 172 | Future, likely 6.4 | | | +---------------------------------------------+--------------+------------------------+----------+-----------------+ +| :ref:`OPAL_MPIPL_UPDATE` | 173 | Future, likely 6.4 | POWER9 | | ++---------------------------------------------+--------------+------------------------+----------+-----------------+ +| :ref:`OPAL_MPIPL_REGISTER_TAG` | 174 | Future, likely 6.4 | POWER9 | | ++---------------------------------------------+--------------+------------------------+----------+-----------------+ +| :ref:`OPAL_MPIPL_QUERY_TAG` | 175 | Future, likely 6.4 | POWER9 | | ++---------------------------------------------+--------------+------------------------+----------+-----------------+ .. toctree:: :maxdepth: 1 diff --git a/doc/opal-api/opal-cec-reboot-6-116.rst b/doc/opal-api/opal-cec-reboot-6-116.rst index 9a5c79446..431098f3b 100644 --- a/doc/opal-api/opal-cec-reboot-6-116.rst +++ b/doc/opal-api/opal-cec-reboot-6-116.rst @@ -1,3 +1,5 @@ +.. _opal-api-cec-reboot: + OPAL_CEC_REBOOT and OPAL_CEC_REBOOT2 ==================================== diff --git a/doc/opal-api/opal-mpipl-173-174.rst b/doc/opal-api/opal-mpipl-173-174.rst new file mode 100644 index 000000000..fa275693f --- /dev/null +++ b/doc/opal-api/opal-mpipl-173-174.rst @@ -0,0 +1,156 @@ +.. _opal-api-mpipl: + +OPAL MPIPL APIs +=============== + +.. code-block:: c + + #define OPAL_MPIPL_UPDATE 173 + #define OPAL_MPIPL_REGISTER_TAG 174 + #define OPAL_MPIPL_QUERY_TAG 175 + +These calls are used for MPIPL (Memory Preserving Initial Program Load). + +It is an OPTIONAL part of the OPAL spec. + +If a platform supports MPIPL, then we will have "/ibm,opal/dump" node in +device tree (see :ref:`device-tree/ibm,opal/dump`). + +.. _OPAL_MPIPL_UPDATE: + +OPAL_MPIPL_UPDATE +================== +Linux kernel will use this call to register/unregister MPIPL. + +.. code-block:: c + + #define OPAL_MPIPL_UPDATE 173 + + int64_t opal_mpipl_update(enum mpipl_ops ops, u64 src, u64 dest, u64 size) + + /* MPIPL update operations */ + enum mpipl_ops { + OPAL_MPIPL_ADD_RANGE = 0, + OPAL_MPIPL_REMOVE_RANGE = 1, + OPAL_MPIPL_REMOVE_ALL = 2, + OPAL_MPIPL_FREE_PRESERVED_MEMORY= 3, + }; + +ops : +----- + OPAL_MPIPL_ADD_RANGE + Add new entry to MPIPL table. Kernel will send src, dest and size. + During MPIPL content from source address is moved to destination address. + src = Source start address + dest = Destination start address + size = size + + OPAL_MPIPL_REMOVE_RANGE + Remove kernel requested entry from MPIPL table. + src = Source start address + dest = Destination start address + size = ignore + + OPAL_MPIPL_REMOVE_ALL + Remove all kernel passed entry from MPIPL table. + src = ignore + dest = ignore + size = ignore + + OPAL_MPIPL_FREE_PRESERVED_MEMORY + Post MPIPL, kernel will indicate OPAL that it has processed dump and + it can clear/release metadata area. + src = ignore + dest = ignore + size = ignore + +Return Values +------------- + +``OPAL_SUCCESS`` + Operation success + +``OPAL_PARAMETER`` + Invalid parameter + +``OPAL_RESOURCE`` + Ran out of space in MDST/MDDT table to add new entry + +``OPAL_HARDWARE`` + Platform does not support fadump + + +.. _OPAL_MPIPL_REGISTER_TAG: + +OPAL_MPIPL_REGISTER_TAG +======================= +Kernel will use this API to register tags during MPIPL registration. +It expects OPAL to preserve these tags across MPIPL. Post MPIPL Linux +kernel will use `opal_mpipl_query_tag` call to retrieve these tags. + +.. code-block:: c + opal_mpipl_register_tag(enum opal_mpipl_tags tag, uint64_t tag_val) + + tag: + OPAL_MPIPL_TAG_KERNEL + During first boot, kernel will setup its metadata area and asks + OPAL to preserve metadata area pointer across MPIPL. Post MPIPL + kernel requests OPAL to provide metadata pointer and it will use + that pointer to retrieve metadata and create dump. + + OPAL_MPIPL_TAG_BOOT_MEM + During MPIPL registration kernel will specify how much memory + firmware can use for Post MPIPL load. Post MPIPL petitboot kernel + will query for this tag to get boot memory size. + +Return Values +------------- +``OPAL_SUCCESS`` + Operation success + +``OPAL_PARAMETER`` + Invalid parameter + +.. _OPAL_MPIPL_QUERY_TAG: + +OPAL_MPIPL_QUERY_TAG +==================== +Post MPIPL linux kernel will call this API to get metadata tag. And use this +tag to retrieve metadata information and generate dump. + +.. code-block:: c + + #define OPAL_MPIPL_QUERY_TAG 175 + + uint64_t opal_mpipl_query_tag(enum opal_mpipl_tags tag, uint64_t *tag_val) + + enum opal_mpipl_tags { + OPAL_MPIPL_TAG_CPU = 0, + OPAL_MPIPL_TAG_OPAL = 1, + OPAL_MPIPL_TAG_KERNEL = 2, + OPAL_MPIPL_TAG_BOOT_MEM = 3, + }; + + tag : + OPAL_MPIPL_TAG_CPU + Pointer to CPU register data content metadata area + OPAL_MPIPL_TAG_OPAL + Pointer to OPAL metadata area + OPAL_MPIPL_TAG_KERNEL + During first boot, kernel will setup its metadata area and asks + OPAL to preserve metadata area pointer across MPIPL. Post MPIPL + kernel calls this API to get metadata pointer and it will use + that pointer to retrieve metadata and create dump. + OPAL_MPIPL_TAG_BOOT_MEM + During MPIPL registration kernel will specify how much memory + firmware can use for Post MPIPL load. Post MPIPL petitboot kernel + will query for this tag to get boot memory size. + +Return Values +------------- + +``OPAL_SUCCESS`` + Operation success + +``OPAL_PARAMETER`` + Invalid parameter