From patchwork Sun Jun 16 17:10: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: 1116589 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 45Rgqp0WHtz9sBp for ; Mon, 17 Jun 2019 03:11:50 +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 45Rgql4fSzzDqbg for ; Mon, 17 Jun 2019 03:11:47 +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 45Rgpf402yzDqSH for ; Mon, 17 Jun 2019 03:10: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 x5GH7ROY181235 for ; Sun, 16 Jun 2019 13:10:46 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2t5eb6qat5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:10:46 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:10:44 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 16 Jun 2019 18:10:40 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHAdev38731844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:10:39 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C61EFA404D; Sun, 16 Jun 2019 17:10:39 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CD45A4051; Sun, 16 Jun 2019 17:10:37 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:10:37 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:01 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0008-0000-0000-000002F43AAA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0009-0000-0000-00002261497B Message-Id: <20190616171024.22799-2-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 01/24] 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 3a2fbb95b..17d14a966 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. @@ -390,6 +390,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 @@ -419,6 +420,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 Sun Jun 16 17:10: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: 1116588 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) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45RgqN1H8Mz9sNC for ; Mon, 17 Jun 2019 03:11:28 +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 45RgqK4gnDzDqcH for ; Mon, 17 Jun 2019 03:11:25 +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 45Rgpf2XvBzDqNW for ; Mon, 17 Jun 2019 03:10:49 +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 x5GH6tGw022144 for ; Sun, 16 Jun 2019 13:10:47 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5q66brc2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:10:47 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:10:45 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) 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) Sun, 16 Jun 2019 18:10:43 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHAgw056688686 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:10:42 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 82E14A4055; Sun, 16 Jun 2019 17:10:42 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 353F1A404D; Sun, 16 Jun 2019 17:10:40 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:10:39 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:02 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-4275-0000-0000-00000342CD3D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-4276-0000-0000-00003852EDFF Message-Id: <20190616171024.22799-3-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 02/24] 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" OPAL is using MDST ntuple in SPIRAH to pass list of memory region (mostly OPAL console and host dmesg) to be collected as part of SYSDUMP. OPAL calls attn instruction in assert path. FSP detects attention and creates SYSDUMP. Soon we are going to support OPAL MIPL feature (aka Memory Preserving IPL). Hence make below changes to reflect its usage: - fsp-mdst-table.c -> fsp-sysdump.c - fsp-mdst-table.h -> opal-dump.h (This will cater both SYSDUMP and MPIPL) - Rename structure name : 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 7a477db78..93239b7bb 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 = hw/fsp/built-in.a $(FSP): $(FSP_OBJS:%=hw/fsp/%) 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 Sun Jun 16 17:10:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116590 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 45RgrF58CCz9s5c for ; Mon, 17 Jun 2019 03:12:13 +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 45RgrF3JCrzDqc6 for ; Mon, 17 Jun 2019 03:12:13 +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 45Rgpj2P21zDqBj for ; Mon, 17 Jun 2019 03:10:53 +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 x5GH6u2X189660 for ; Sun, 16 Jun 2019 13:10:50 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2t5e1qfxgb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:10:50 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:10:48 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) 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) Sun, 16 Jun 2019 18:10:46 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHAb3233292660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:10:37 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5336BA404D; Sun, 16 Jun 2019 17:10:45 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EFB86A4040; Sun, 16 Jun 2019 17:10:42 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:10:42 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:03 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0020-0000-0000-0000034A9561 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0021-0000-0000-0000219DD731 Message-Id: <20190616171024.22799-4-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 03/24] hdata: Fix MDST 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" We have split the type field to accommodate below fields which are used by OPAL DUMP (memory preserving IPL). - data region : dump data regions (like DUMP_REGION_* ) - dump type : Reflects MDST entry usage (used by SYSDUMP -OR- FADUMP) This patch makes structure changes and necessary code adjustment. Note that these fields are not used by FSP to collect dump. They only care about address and size from MDST structure. Hence its safe to make this change. 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 Sun Jun 16 17:10:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116591 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 45Rgrc6wHZz9s00 for ; Mon, 17 Jun 2019 03:12:32 +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 45Rgrc5VzxzDq6Q for ; Mon, 17 Jun 2019 03:12: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 45Rgpk6plyzDqBj for ; Mon, 17 Jun 2019 03:10:54 +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 x5GH6sh6022072 for ; Sun, 16 Jun 2019 13:10:53 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5q66brdk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:10:52 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:10:51 +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) Sun, 16 Jun 2019 18:10:48 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHAmpP51380364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:10:48 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F0D47A4055; Sun, 16 Jun 2019 17:10:47 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B693DA404D; Sun, 16 Jun 2019 17:10:45 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:10:45 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:04 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0012-0000-0000-000003299B70 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0013-0000-0000-00002162B020 Message-Id: <20190616171024.22799-5-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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=891 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906160165 Subject: [Skiboot] [PATCH v8 04/24] 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 Sun Jun 16 17:10:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116592 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 45Rgrx5Lsdz9s00 for ; Mon, 17 Jun 2019 03:12:49 +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 45Rgrx3bHNzDqR7 for ; Mon, 17 Jun 2019 03:12:49 +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 45Rgpq6KrWzDqBj for ; Mon, 17 Jun 2019 03:10:59 +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 x5GH6upe025153 for ; Sun, 16 Jun 2019 13:10:56 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5e6wyraw-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:10:56 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:10:54 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Sun, 16 Jun 2019 18:10:51 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHAomk52035822 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:10:50 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B29B6A4055; Sun, 16 Jun 2019 17:10:50 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 64539A4040; Sun, 16 Jun 2019 17:10:48 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:10:48 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:05 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0008-0000-0000-000002F43AAC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0009-0000-0000-00002261497C Message-Id: <20190616171024.22799-6-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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=555 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906160165 Subject: [Skiboot] [PATCH v8 05/24] 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 Sun Jun 16 17:10:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116593 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 45RgsC2kxpz9sBp for ; Mon, 17 Jun 2019 03:13:03 +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 45RgsC1qBKzDqNK for ; Mon, 17 Jun 2019 03:13:03 +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 45Rgpv1DtrzDqbt for ; Mon, 17 Jun 2019 03:11:02 +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 x5GH6td7068763 for ; Sun, 16 Jun 2019 13:11:00 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5dn10g26-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:00 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:10:57 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) 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) Sun, 16 Jun 2019 18:10:54 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHArsm54395010 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:10:53 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B018A4055; Sun, 16 Jun 2019 17:10:53 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2A80AA4051; Sun, 16 Jun 2019 17:10:51 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:10:50 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:06 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-4275-0000-0000-00000342CD40 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-4276-0000-0000-00003852EE03 Message-Id: <20190616171024.22799-7-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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=683 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906160165 Subject: [Skiboot] [PATCH v8 06/24] 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 Sun Jun 16 17:10:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116594 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 45RgsT66zMz9s00 for ; Mon, 17 Jun 2019 03:13:17 +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 45RgsT4NM5zDqc6 for ; Mon, 17 Jun 2019 03:13: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 45Rgpy44rLzDqcH for ; Mon, 17 Jun 2019 03:11:06 +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 x5GH6uUq029082 for ; Sun, 16 Jun 2019 13:11:03 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5dsqgd3j-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:03 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:00 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) 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) Sun, 16 Jun 2019 18:10:57 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHAuWb58785982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:10:56 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 619F8A4040; Sun, 16 Jun 2019 17:10:56 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0A531A405D; Sun, 16 Jun 2019 17:10:54 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:10:53 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:07 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-4275-0000-0000-00000342CD42 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-4276-0000-0000-00003852EE05 Message-Id: <20190616171024.22799-8-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 07/24] 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 Sun Jun 16 17:10:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116595 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 45Rgsj4WqBz9s00 for ; Mon, 17 Jun 2019 03:13: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 45Rgsj3RdzzDqMv for ; Mon, 17 Jun 2019 03:13: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 45Rgpz61KMzDqbg for ; Mon, 17 Jun 2019 03:11:07 +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 x5GH70iY025729 for ; Sun, 16 Jun 2019 13:11:05 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5e6wyrdb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:05 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:03 +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) Sun, 16 Jun 2019 18:11:00 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHApTB37028164 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:10:51 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 23D71A4040; Sun, 16 Jun 2019 17:10:59 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C4DF4A4051; Sun, 16 Jun 2019 17:10:56 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:10:56 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:08 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0008-0000-0000-000002F43AAE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0009-0000-0000-00002261497E Message-Id: <20190616171024.22799-9-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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=516 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906160165 Subject: [Skiboot] [PATCH v8 08/24] 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 Sun Jun 16 17:10:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116596 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 45Rgsz0ZgWz9s00 for ; Mon, 17 Jun 2019 03:13: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 45Rgsy5vt7zDqSH for ; Mon, 17 Jun 2019 03:13: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.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 45Rgq26GWrzDqT4 for ; Mon, 17 Jun 2019 03:11:10 +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 x5GH6t0O053122 for ; Sun, 16 Jun 2019 13:11:08 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5ds8g90t-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:07 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:05 +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) Sun, 16 Jun 2019 18:11:02 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHB2O543188228 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:02 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E2CA6A4051; Sun, 16 Jun 2019 17:11:01 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8BDCBA4040; Sun, 16 Jun 2019 17:10:59 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:10:59 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:09 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0012-0000-0000-000003299B77 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0013-0000-0000-00002162B023 Message-Id: <20190616171024.22799-10-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 09/24] 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. We will pass this information to Linux. If Linux kernel is using these memory, it will make sure to create destination memory to preserve content during MPIPL. Signed-off-by: Vasant Hegde --- hdata/spira.c | 24 ++++++++++++++++++++++++ hdata/spira.h | 1 + 2 files changed, 25 insertions(+) diff --git a/hdata/spira.c b/hdata/spira.c index b5ec20db9..d2ad8e168 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -934,6 +934,26 @@ 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; + + if (proc_gen < proc_gen_p9) + return; + + 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 +1041,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 Sun Jun 16 17:10:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116597 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 45RgtB397qz9s00 for ; Mon, 17 Jun 2019 03:13: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 45RgtB23YczDqcS for ; Mon, 17 Jun 2019 03:13: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 45Rgq556r5zDqc2 for ; Mon, 17 Jun 2019 03:11:13 +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 x5GH6x6x092924 for ; Sun, 16 Jun 2019 13:11:11 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5e6c7qe2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:11 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:08 +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) Sun, 16 Jun 2019 18:11:05 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHB4sJ47448290 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:04 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 90F69A4040; Sun, 16 Jun 2019 17:11:04 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4909FA404D; Sun, 16 Jun 2019 17:11:02 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:02 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:10 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-4275-0000-0000-00000342CD45 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-4276-0000-0000-00003852EE07 Message-Id: <20190616171024.22799-11-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 10/24] 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 | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-dump.h | 4 ++ 4 files changed, 153 insertions(+), 2 deletions(-) create mode 100644 core/opal-dump.c diff --git a/core/Makefile.inc b/core/Makefile.inc index 21c12fb8d..c2c9731db 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 3db9df314..03776537e 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. @@ -55,6 +55,7 @@ #include #include #include +#include enum proc_gen proc_gen; unsigned int pcie_max_link_speed; @@ -1173,6 +1174,9 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt) if (platform.init) platform.init(); + /* init opal dump */ + opal_mpipl_init(); + /* Read in NVRAM and set it up */ nvram_init(); diff --git a/core/opal-dump.c b/core/opal-dump.c new file mode 100644 index 000000000..dc364fab1 --- /dev/null +++ b/core/opal-dump.c @@ -0,0 +1,143 @@ +/* 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); + + 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 Sun Jun 16 17:10:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116598 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 45RgtQ6ZHHz9s00 for ; Mon, 17 Jun 2019 03:14: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 45RgtQ5dqgzDqcM for ; Mon, 17 Jun 2019 03:14: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.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 45Rgq65yc2zDqcG for ; Mon, 17 Jun 2019 03:11:14 +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 x5GH6vkg110572 for ; Sun, 16 Jun 2019 13:11:12 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5drs8ab4-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:12 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11: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) Sun, 16 Jun 2019 18:11:08 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHB7eL60817620 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:07 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 06A07A4051; Sun, 16 Jun 2019 17:11:07 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EA9A5A4040; Sun, 16 Jun 2019 17:11:04 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:04 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:11 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0016-0000-0000-000002899084 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0017-0000-0000-000032E6D68A Message-Id: <20190616171024.22799-12-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 11/24] 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 | 8 ++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index dc364fab1..ea9d00ead 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; @@ -133,6 +135,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..0838ee124 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -121,6 +121,14 @@ 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; +} __packed; + /* init opal dump */ extern void opal_mpipl_init(void); From patchwork Sun Jun 16 17:10:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116599 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 45Rgtk06cNz9sN6 for ; Mon, 17 Jun 2019 03:14:22 +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 45Rgtj619fzDqQL for ; Mon, 17 Jun 2019 03:14:21 +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 45RgqD3Y1czDqcD for ; Mon, 17 Jun 2019 03:11:20 +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 x5GH70DC000690 for ; Sun, 16 Jun 2019 13:11:18 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5dru0eur-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:18 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:12 +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) Sun, 16 Jun 2019 18:11:10 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHB9Ls28442796 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:10 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DB3DCA404D; Sun, 16 Jun 2019 17:11:09 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D305A4040; Sun, 16 Jun 2019 17:11:07 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:07 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:12 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0020-0000-0000-0000034A9566 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0021-0000-0000-0000219DD736 Message-Id: <20190616171024.22799-13-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 12/24] MPIPL: Add OPAL API to register for 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 add new API to register for dump. u64 opal_mpipl_update(u8 ops, u64 src, u64 dest, u64 size) ops : OPAL_MPIPL_REGISTER_TAG Kernel metadata pointer. Kernel will send this to OPAL during MPIPL registration. Post MPIPL, kernel will request for this tag via mpipl_query_tag API. src = kernel metadata address dest = ignore size = ignore 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 | 185 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-api.h | 12 +++- include/opal-dump.h | 1 + 3 files changed, 197 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index ea9d00ead..bef54ebe1 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) { @@ -120,6 +216,92 @@ 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 mpipl_ops ops, + u64 src, u64 dest, u64 size) +{ + int rc; + + if (ops > OPAL_MPIPL_FREE_PRESERVED_MEMORY) { + prlog(PR_DEBUG, "Unsupported operation : 0x%x\n", ops); + return OPAL_PARAMETER; + } + + switch (ops) { + case OPAL_MPIPL_REGISTER_TAG: + mpipl_metadata->kernel_tag = src; + prlog(PR_NOTICE, "Payload sent metadata tag : 0x%llx\n", src); + rc = OPAL_SUCCESS; + break; + 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: + rc = OPAL_SUCCESS; + break; + default: + rc = OPAL_PARAMETER; + break; + } + + return rc; +} + void opal_mpipl_init(void) { void *mdst_base = (void *)MDST_TABLE_BASE; @@ -153,4 +335,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..bc6af2014 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,15 @@ enum { OPAL_PCI_P2P_TARGET = 1, }; +/* MPIPL update operations */ +enum mpipl_ops { + OPAL_MPIPL_REGISTER_TAG = 0, + OPAL_MPIPL_ADD_RANGE = 1, + OPAL_MPIPL_REMOVE_RANGE = 2, + OPAL_MPIPL_REMOVE_ALL = 3, + OPAL_MPIPL_FREE_PRESERVED_MEMORY= 4, +}; + #endif /* __ASSEMBLY__ */ #endif /* __OPAL_API_H */ diff --git a/include/opal-dump.h b/include/opal-dump.h index 0838ee124..9f5f102be 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 Sun Jun 16 17:10:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116600 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 45Rgty1t2Sz9s00 for ; Mon, 17 Jun 2019 03:14:34 +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 45Rgty0hKtzDqch for ; Mon, 17 Jun 2019 03:14:34 +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 45RgqD2qtzzDqc6 for ; Mon, 17 Jun 2019 03:11:20 +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 x5GH6v81025353 for ; Sun, 16 Jun 2019 13:11:18 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5e6wyrhf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:18 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:16 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.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) Sun, 16 Jun 2019 18:11:13 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBCWY35389854 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:12 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8D929A4051; Sun, 16 Jun 2019 17:11:12 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F1E6A404D; Sun, 16 Jun 2019 17:11:10 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:10 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:13 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-4275-0000-0000-00000342CD47 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-4276-0000-0000-00003852EE0A Message-Id: <20190616171024.22799-14-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 13/24] 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 bef54ebe1..5c1ce0c7b 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -336,6 +337,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); } 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 4b839d8ba..ac1ec219b 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 Sun Jun 16 17:10:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116601 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 45RgvC0GF0z9s00 for ; Mon, 17 Jun 2019 03:14:47 +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 45RgvB4yz1zDqdq for ; Mon, 17 Jun 2019 03:14:46 +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 45RgqH0jk1zDqc3 for ; Mon, 17 Jun 2019 03:11:22 +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 x5GH6sPL128419 for ; Sun, 16 Jun 2019 13:11:20 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2t5rbvt5f0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:19 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:18 +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) Sun, 16 Jun 2019 18:11:16 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBFtD46596208 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:15 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 17F6AA4040; Sun, 16 Jun 2019 17:11:15 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EC30EA404D; Sun, 16 Jun 2019 17:11:12 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:12 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:14 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0012-0000-0000-000003299B79 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0013-0000-0000-00002162B028 Message-Id: <20190616171024.22799-15-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 14/24] 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. 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 ac1ec219b..9ea7d294f 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 Sun Jun 16 17:10:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116602 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 45RgvQ3MJJz9s00 for ; Mon, 17 Jun 2019 03:14:58 +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 45RgvQ2JwCzDq9j for ; Mon, 17 Jun 2019 03:14: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 45RgqK6K8MzDqcM for ; Mon, 17 Jun 2019 03:11:25 +1000 (AEST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5GH7Ec9017837 for ; Sun, 16 Jun 2019 13:11:23 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5svxg2mp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:23 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:21 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) 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) Sun, 16 Jun 2019 18:11:18 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBHeQ29425814 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:17 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9845A404D; Sun, 16 Jun 2019 17:11:17 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 720E8A4040; Sun, 16 Jun 2019 17:11:15 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:15 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:15 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-4275-0000-0000-00000342CD49 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-4276-0000-0000-00003852EE0C Message-Id: <20190616171024.22799-16-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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=562 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906160165 Subject: [Skiboot] [PATCH v8 15/24] 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 5c1ce0c7b..7036a424a 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 @@ -303,6 +304,12 @@ static int64_t opal_mpipl_update(enum mpipl_ops ops, 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 9f5f102be..a7c825513 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -133,4 +133,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 Sun Jun 16 17:10:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116604 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 45Rgvh0tChz9s00 for ; Mon, 17 Jun 2019 03:15:12 +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 45Rgvg4NNYzDqcD for ; Mon, 17 Jun 2019 03:15:11 +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 45RgqP3nFSzDqKP for ; Mon, 17 Jun 2019 03:11:29 +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 x5GH6ud9189782 for ; Sun, 16 Jun 2019 13:11:27 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2t5e1qfxyf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:27 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:25 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 16 Jun 2019 18:11:21 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBLvX51183638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:21 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E902DA404D; Sun, 16 Jun 2019 17:11:20 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DEB4A4040; Sun, 16 Jun 2019 17:11:18 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:17 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:16 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0008-0000-0000-000002F43AB1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0009-0000-0000-000022614981 Message-Id: <20190616171024.22799-17-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 16/24] 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 Sun Jun 16 17:10:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116605 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 45Rgw02QHrz9s00 for ; Mon, 17 Jun 2019 03:15:28 +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 45Rgw01JPTzDqcW for ; Mon, 17 Jun 2019 03:15:28 +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 45RgqQ71fFzDqcM for ; Mon, 17 Jun 2019 03:11:30 +1000 (AEST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5GH7KUK018650 for ; Sun, 16 Jun 2019 13:11:29 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5svxg2q1-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:28 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:26 +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) Sun, 16 Jun 2019 18:11:24 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBNLQ53870640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:23 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 788F4A4053; Sun, 16 Jun 2019 17:11:23 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 58769A4040; Sun, 16 Jun 2019 17:11:21 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:21 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:17 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0012-0000-0000-000003299B7A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0013-0000-0000-00002162B02A Message-Id: <20190616171024.22799-18-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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=946 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906160165 Subject: [Skiboot] [PATCH v8 17/24] 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 afa00adf7..da3c8b175 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_OS_ERROR: + prlog(PR_NOTICE, "Reboot: OS reported error. Performing dump\n"); + console_complete_flush(); + _abort("Reboot: OS reported error. Performing dump\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..d56f515ee 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_OS_ERROR = 3 + Request for fadump reboot. Firmware will reboot the system and collect + dump. + + On platforms that don't support fadump, 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 bc6af2014..5747019f8 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1135,6 +1135,7 @@ enum { OPAL_REBOOT_NORMAL = 0, OPAL_REBOOT_PLATFORM_ERROR, OPAL_REBOOT_FULL_IPL, + OPAL_REBOOT_OS_ERROR, }; /* Argument to OPAL_PCI_TCE_KILL */ From patchwork Sun Jun 16 17:10:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116607 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 45Rgwb2SXhz9s00 for ; Mon, 17 Jun 2019 03:15: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 45RgwZ6ZMBzDqVP for ; Mon, 17 Jun 2019 03:15: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.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 45RgqZ1pdVzDqc4 for ; Mon, 17 Jun 2019 03:11:38 +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 x5GH6vAl012431 for ; Sun, 16 Jun 2019 13:11:35 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2t5e9tfh6j-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:35 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:33 +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) Sun, 16 Jun 2019 18:11:27 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBQFS39453014 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:26 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 304EFA4051; Sun, 16 Jun 2019 17:11:26 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D248AA404D; Sun, 16 Jun 2019 17:11:23 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:23 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:18 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0016-0000-0000-000002899089 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0017-0000-0000-000032E6D68E Message-Id: <20190616171024.22799-19-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 18/24] 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 d2ad8e168..3616922ee 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]; @@ -1097,6 +1137,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 Sun Jun 16 17:10:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116606 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 45RgwH4Dpyz9s00 for ; Mon, 17 Jun 2019 03:15: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 45RgwH2YpgzDqf9 for ; Mon, 17 Jun 2019 03:15: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.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 45RgqX4N63zDqW7 for ; Mon, 17 Jun 2019 03:11:36 +1000 (AEST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5GH7E7h017825 for ; Sun, 16 Jun 2019 13:11:34 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5svxg2rr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:34 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:32 +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) Sun, 16 Jun 2019 18:11:29 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBTkE46596240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:29 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EB139A404D; Sun, 16 Jun 2019 17:11:28 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 93EA9A4040; Sun, 16 Jun 2019 17:11:26 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:26 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:19 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0012-0000-0000-000003299B7C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0013-0000-0000-00002162B02B Message-Id: <20190616171024.22799-20-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 19/24] 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 | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-api.h | 26 +++++++++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/core/opal-dump.c b/core/opal-dump.c index 7036a424a..7b8823d84 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 mpipl_fadump *mpipl_opal_data; + + static int opal_mpipl_add_entry(u8 region, u64 src, u64 dest, u64 size) { int i, max_cnt; @@ -304,6 +308,56 @@ static int64_t opal_mpipl_update(enum mpipl_ops ops, 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 fadump_region *region; + + /* Count OPAL dump regions */ + for (i = 0; i < mdrt_cnt; i++) { + if (mdrt->data_region == DUMP_REGION_OPAL_MEMORY) + count++; + mdrt++; + } + + mpipl_opal_data = zalloc(sizeof(struct mpipl_fadump) + + count * sizeof(struct fadump_region)); + if (!mpipl_opal_data) { + prlog(PR_ERR, "Failed to allocate memory\n"); + return; + } + + /* Fill OPAL dump details */ + mpipl_opal_data->version = MPIPL_FADUMP_VERSION; + mpipl_opal_data->type = MPIPL_FADUMP_TYPE_OPAL; + mpipl_opal_data->crashing_pir = mpipl_metadata->crashing_pir; + mpipl_opal_data->fadump_region_cnt = count; + region = mpipl_opal_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; @@ -328,6 +382,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 5747019f8..5af1a6d0f 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1226,6 +1226,32 @@ enum mpipl_ops { OPAL_MPIPL_FREE_PRESERVED_MEMORY= 4, }; +/* Preserved memory details */ +struct fadump_region { + u64 src; + u64 dest; + u64 size; +}; + +/* Structure version */ +#define MPIPL_FADUMP_VERSION 0x01 + +/* Metadata type. Kernel will use this field to identify the type of data */ +#define MPIPL_FADUMP_TYPE_HOST_START 0x80 +#define MPIPL_FADUMP_TYPE_HOST_END 0xff +#define MPIPL_FADUMP_TYPE_CPU 0x00 +#define MPIPL_FADUMP_TYPE_OPAL 0x01 +struct mpipl_fadump { + u8 type; /* MPIPL_FADUMP_TYPE_* */ + u8 version; + u8 reserved[6]; + u32 crashing_pir; /* OPAL crashing CPU PIR */ + u32 cpu_data_version; + u32 cpu_data_size; + u32 fadump_region_cnt; + struct fadump_region region[]; +} __packed; + #endif /* __ASSEMBLY__ */ #endif /* __OPAL_API_H */ From patchwork Sun Jun 16 17:10:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116608 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 45Rgwq30Ndz9s00 for ; Mon, 17 Jun 2019 03:16:11 +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 45Rgwq1ylWzDqc5 for ; Mon, 17 Jun 2019 03:16:11 +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 45RgqZ54pfzDqcK for ; Mon, 17 Jun 2019 03:11:38 +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 x5GH71jg068931 for ; Sun, 16 Jun 2019 13:11:37 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5dn10gd8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:36 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:34 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) 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) Sun, 16 Jun 2019 18:11:32 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBVoE45809740 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:31 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B1F0CA4040; Sun, 16 Jun 2019 17:11:31 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5AA44A4053; Sun, 16 Jun 2019 17:11:29 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:29 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:20 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0020-0000-0000-0000034A9568 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0021-0000-0000-0000219DD738 Message-Id: <20190616171024.22799-21-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 20/24] 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(uint32_t idx, uint64_t *tag) idx : tag index (0..n) tag : OPAL will pass saved tag Kernel will make this call with increased `index` until OPAL returns OPAL_EMPTY. Return values: OPAL_SUCCESS : Operation success OPAL_PARAMETER : Invalid parameter OPAL_EMPTY : OPAL completed sending all tags to kernel Signed-off-by: Vasant Hegde --- core/opal-dump.c | 32 ++++++++++++++++++++++++++++++++ include/opal-api.h | 3 ++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index 7b8823d84..e53991784 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -44,6 +44,17 @@ static struct mpipl_metadata *mpipl_metadata; /* Dump metadata area */ static struct mpipl_fadump *mpipl_opal_data; +/* + * Number of tags passed by OPAL to kernel after MPIPL boot. + * Currently it supports below tags: + * - Kernel passed tag during MPIPL registration + * - OPAL metadata area address + * - CPU register data area + */ +#define MAX_MPIPL_TAGS 0x03 +static u64 mpipl_tags[MAX_MPIPL_TAGS]; +static int max_tags; + static int opal_mpipl_add_entry(u8 region, u64 src, u64 dest, u64 size) { @@ -308,6 +319,20 @@ static int64_t opal_mpipl_update(enum mpipl_ops ops, return rc; } +static uint64_t opal_mpipl_query_tag(uint32_t idx, uint64_t *tag) +{ + if (!opal_addr_valid(tag)) { + prlog(PR_DEBUG, "Invalid tag address\n"); + return OPAL_PARAMETER; + } + + if (idx >= max_tags) + return OPAL_EMPTY; + + *tag = mpipl_tags[idx]; + return OPAL_SUCCESS; +} + static void post_mpipl_get_opal_data(void) { struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE); @@ -356,6 +381,12 @@ static void post_mpipl_get_opal_data(void) if (j == count) break; } + + /* Update tags */ + if (mpipl_metadata->kernel_tag) + mpipl_tags[max_tags++] = mpipl_metadata->kernel_tag; + + mpipl_tags[max_tags++] = (u64)mpipl_opal_data; } void opal_mpipl_save_crashing_pir(void) @@ -406,4 +437,5 @@ void opal_mpipl_init(void) /* OPAL API for MPIPL update */ opal_register(OPAL_MPIPL_UPDATE, opal_mpipl_update, 4); + opal_register(OPAL_MPIPL_QUERY_TAG, opal_mpipl_query_tag, 2); } diff --git a/include/opal-api.h b/include/opal-api.h index 5af1a6d0f..6f6656557 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_QUERY_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 */ From patchwork Sun Jun 16 17:10:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116609 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 45Rgx54SkLz9s00 for ; Mon, 17 Jun 2019 03:16:25 +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 45Rgx53DPszDqc5 for ; Mon, 17 Jun 2019 03:16:25 +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 45Rgqf2m16zDqbg for ; Mon, 17 Jun 2019 03:11:42 +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 x5GH71AL000798 for ; Sun, 16 Jun 2019 13:11:39 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5dru0f4a-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:39 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:37 +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) Sun, 16 Jun 2019 18:11:35 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBQIp11534676 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:26 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 91B61A4053; Sun, 16 Jun 2019 17:11:34 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 20F94A4040; Sun, 16 Jun 2019 17:11:32 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:31 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:21 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0028-0000-0000-0000037AC6B7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0029-0000-0000-0000243AC80B Message-Id: <20190616171024.22799-22-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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=730 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906160165 Subject: [Skiboot] [PATCH v8 21/24] MPIPL: Invalidate 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" Post dump process, kernel sends FREE_PRESERVE_MEMEORY notification to OPAL. OPAL will clear metadata section and tags. Signed-off-by: Vasant Hegde --- core/opal-dump.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/opal-dump.c b/core/opal-dump.c index e53991784..555908114 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -309,6 +309,16 @@ static int64_t opal_mpipl_update(enum mpipl_ops ops, prlog(PR_NOTICE, "Payload unregistered for MPIPL\n"); break; case OPAL_MPIPL_FREE_PRESERVED_MEMORY: + /* Clear tags */ + memset(&mpipl_tags, 0, (sizeof(u64) * MAX_MPIPL_TAGS)); + max_tags = 0; + /* Release memory */ + free(mpipl_opal_data); + mpipl_opal_data = NULL; + /* 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; break; default: From patchwork Sun Jun 16 17:10:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116610 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 45RgxQ74jzz9s9y for ; Mon, 17 Jun 2019 03:16: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 45RgxQ5js3zDqfL for ; Mon, 17 Jun 2019 03:16: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.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 45Rgqj6gxMzDqc2 for ; Mon, 17 Jun 2019 03:11:45 +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 x5GH6vHq029117 for ; Sun, 16 Jun 2019 13:11:44 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5dsqgdh0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:43 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:41 +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) Sun, 16 Jun 2019 18:11:38 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBbZO57278484 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:37 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 58590A4040; Sun, 16 Jun 2019 17:11:37 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 007EFA4051; Sun, 16 Jun 2019 17:11:35 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:34 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:22 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0020-0000-0000-0000034A956A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0021-0000-0000-0000219DD73A Message-Id: <20190616171024.22799-23-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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=913 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906160165 Subject: [Skiboot] [PATCH v8 22/24] 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. This is sufficient for 2 socket system. In future, if we support bigger system then we have to adjust this size. - Add architected registers destination memory to reserve-memory DT node. Signed-off-by: Vasant Hegde --- core/opal-dump.c | 30 ++++++++++++++++++++++++++++++ hdata/spira.c | 7 +++++++ include/mem-map.h | 14 +++++++++++++- skiboot.lds.S | 5 +++++ 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index 555908114..88b18f857 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,18 @@ #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. This is sufficient + * for 2 socket system. In future, if we support bigger system then we + * have to adjust this size. + */ +#define ARCH_REGS_DATA_SIZE 0x100000 + /* 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; @@ -213,6 +223,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")) { @@ -229,6 +241,24 @@ static void opal_mpipl_register(void) opal_dest = SKIBOOT_BASE + opal_size; mem_reserve_fw("ibm,firmware-dump", opal_dest, opal_size); + /* Calculate memory to capture CPU register data */ + arch_regs_dest = opal_dest + opal_size; + arch_regs_size = ARCH_REGS_DATA_SIZE; + + if (nr_chips() > 2 ) { + prlog(PR_ERR, "NOT SUPPORTED ON > 2 SOCKET SYSTEM\n"); + prlog(PR_ERR, "INCREASE ARCHITECTED REGISTERS RESERVED MEMORY SIZE\n"); + assert(false); + } + + /* 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); + opal_mpipl_add_entry(DUMP_REGION_OPAL_MEMORY, SKIBOOT_BASE, opal_dest, opal_size); } diff --git a/hdata/spira.c b/hdata/spira.c index 3616922ee..42bb25f67 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 Sun Jun 16 17:10:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116611 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 45Rgxh0PR3z9s00 for ; Mon, 17 Jun 2019 03:16:56 +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 45Rgxg4mN3zDqfV for ; Mon, 17 Jun 2019 03:16: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 45Rgqm6XxZzDqBj for ; Mon, 17 Jun 2019 03:11:48 +1000 (AEST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x5GH7EKK017766 for ; Sun, 16 Jun 2019 13:11:46 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5svxg2wu-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:46 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:43 +0100 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.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) Sun, 16 Jun 2019 18:11:41 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBerp35258638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:40 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1E7B3A4040; Sun, 16 Jun 2019 17:11:40 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB072A4053; Sun, 16 Jun 2019 17:11:37 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:37 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:23 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0012-0000-0000-000003299B7E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0013-0000-0000-00002162B02F Message-Id: <20190616171024.22799-24-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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=942 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906160165 Subject: [Skiboot] [PATCH v8 23/24] 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 tags list. Signed-off-by: Vasant Hegde --- core/opal-dump.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index 88b18f857..f034ea0c0 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -53,6 +53,7 @@ static struct mpipl_metadata *mpipl_metadata; /* Dump metadata area */ static struct mpipl_fadump *mpipl_opal_data; +static struct mpipl_fadump *mpipl_cpu_data; /* * Number of tags passed by OPAL to kernel after MPIPL boot. @@ -373,6 +374,42 @@ static uint64_t opal_mpipl_query_tag(uint32_t idx, uint64_t *tag) return OPAL_SUCCESS; } +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; + } + + mpipl_cpu_data = zalloc(sizeof(struct mpipl_fadump) + + sizeof(struct fadump_region)); + if (!mpipl_cpu_data) { + prlog(PR_ERR, "Failed to allocate memory\n"); + return; + } + + /* Fill CPU register details */ + mpipl_cpu_data->type = MPIPL_FADUMP_TYPE_CPU; + mpipl_cpu_data->version = MPIPL_FADUMP_VERSION; + mpipl_cpu_data->cpu_data_version = proc_dump->version; + mpipl_cpu_data->cpu_data_size = proc_dump->thread_size; + mpipl_cpu_data->fadump_region_cnt = cpu_to_be32(1); + + mpipl_cpu_data->region[0].src = proc_dump->dest_addr & ~(HRMOR_BIT); + mpipl_cpu_data->region[0].dest = proc_dump->dest_addr & ~(HRMOR_BIT); + mpipl_cpu_data->region[0].size = proc_dump->act_size; + + /* Update tag */ + mpipl_tags[max_tags++] = (u64)mpipl_cpu_data; +} + static void post_mpipl_get_opal_data(void) { struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE); @@ -453,8 +490,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_opal_data(); + post_mpipl_arch_regs_data(); + } /* Clear OPAL metadata area */ if (sizeof(struct mpipl_metadata) > DUMP_METADATA_AREA_SIZE) { From patchwork Sun Jun 16 17:10:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1116612 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 45Rgxx04s4z9s00 for ; Mon, 17 Jun 2019 03:17:09 +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 45Rgxw5FFGzDqf0 for ; Mon, 17 Jun 2019 03:17:08 +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 45Rgqp5YJMzDqT4 for ; Mon, 17 Jun 2019 03:11:50 +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 x5GH70i9000701 for ; Sun, 16 Jun 2019 13:11:49 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2t5dru0f7j-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 16 Jun 2019 13:11:49 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 16 Jun 2019 18:11:46 +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) Sun, 16 Jun 2019 18:11:43 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x5GHBgCq57606274 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 16 Jun 2019 17:11:43 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9042A404D; Sun, 16 Jun 2019 17:11:42 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81A6BA4051; Sun, 16 Jun 2019 17:11:40 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.85.84.197]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Sun, 16 Jun 2019 17:11:40 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Sun, 16 Jun 2019 22:40:24 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> References: <20190616171024.22799-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19061617-0012-0000-0000-000003299B7F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19061617-0013-0000-0000-00002162B030 Message-Id: <20190616171024.22799-25-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-16_07:, , 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-1906160165 Subject: [Skiboot] [PATCH v8 24/24] 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 | 23 +++++++ doc/index.rst | 1 + doc/mpipl.rst | 46 +++++++++++++ doc/opal-api/index.rst | 4 ++ doc/opal-api/opal-cec-reboot-6-116.rst | 2 + doc/opal-api/opal-mpipl-173-174.rst | 119 +++++++++++++++++++++++++++++++++ 6 files changed, 195 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..b2484966a --- /dev/null +++ b/doc/device-tree/ibm,opal/dump.rst @@ -0,0 +1,23 @@ +.. _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 skiroot images */ + 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..b994ebf93 --- /dev/null +++ b/doc/mpipl.rst @@ -0,0 +1,46 @@ +.. _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 destination 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 an MPIPL boot, OPAL exports the results information to the host Linux kernel, +which 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..7fbbac001 100644 --- a/doc/opal-api/index.rst +++ b/doc/opal-api/index.rst @@ -384,6 +384,10 @@ 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_UPDATTE` | 173 | Future, likely 6.4 | POWER9 | | ++---------------------------------------------+--------------+------------------------+----------+-----------------+ +| :ref:`OPAL_MPIPL_QUERY_TAG` | 174 | 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 d56f515ee..10ac01ab5 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..2dc309e2a --- /dev/null +++ b/doc/opal-api/opal-mpipl-173-174.rst @@ -0,0 +1,119 @@ +.. _opal-api-mpipl: + +OPAL MPIPL APIs +=============== + +.. code-block:: c + + #define OPAL_MPIPL_UPDATE 173 + #define OPAL_MPIPL_QUERY_TAG 174 + +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_REGISTER_TAG = 0, + OPAL_MPIPL_ADD_RANGE = 1, + OPAL_MPIPL_REMOVE_RANGE = 2, + OPAL_MPIPL_REMOVE_ALL = 3, + OPAL_MPIPL_FREE_PRESERVED_MEMORY= 4, + }; + +ops : +----- + OPAL_MPIPL_REGISTER_TAG + Kernel metadata pointer. Kernel will send this to OPAL during MPIPL + registration. Post MPIPL, kernel will request for this tag via + opal_mpipl_query_tag API. + src = kernel metadata address + dest = ignore + size = ignore + + 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_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 174 + + uint64_t opal_mpipl_query_tag(uint32_t idx, uint64_t *tag) + + idx : tag index (0..n) + tag : OPAL will pass saved tag + + Kernel will make this call with increased `index` until OPAL returns OPAL_EMPTY. + +Return Values +------------- + +``OPAL_SUCCESS`` + Operation success + +``OPAL_PARAMETER`` + Invalid parameter + +``OPAL_EMPTY`` + OPAL completed sending all tags to kernel