From patchwork Wed Nov 28 11:02:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004419 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434d6q1C9kz9ryk for ; Wed, 28 Nov 2018 22:03:15 +1100 (AEDT) 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 434d6p56jWzDqgL for ; Wed, 28 Nov 2018 22:03:14 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d6h1B0nzDqfY for ; Wed, 28 Nov 2018 22:03:07 +1100 (AEDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxM3U088360 for ; Wed, 28 Nov 2018 06:03:06 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1nvwhnkn-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:06 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:04 -0000 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) Wed, 28 Nov 2018 11:03:01 -0000 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 wASB306D54001796 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:00 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5194BA4053; Wed, 28 Nov 2018 11:03:00 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1460FA4059; Wed, 28 Nov 2018 11:02:59 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:02:58 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:23 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0012-0000-0000-000002D16D68 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0013-0000-0000-00002106B1E3 Message-Id: <20181128110244.17664-2-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 01/22] 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, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Add OPAL boot entry address to device tree. 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/opal.c b/core/opal.c index 63a08510f..c1c5f20b9 100644 --- a/core/opal.c +++ b/core/opal.c @@ -379,6 +379,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 @@ -408,6 +409,7 @@ void add_opal_node(void) dt_add_property_cells(opal_node, "opal-msg-size", sizeof(struct opal_msg)); 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 Wed Nov 28 11:02:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004422 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434d7s3HZnz9ryk for ; Wed, 28 Nov 2018 22:04:09 +1100 (AEDT) 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 434d7s1rhmzDqgX for ; Wed, 28 Nov 2018 22:04:09 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d6l11KZzDqfY for ; Wed, 28 Nov 2018 22:03:10 +1100 (AEDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxQvm033269 for ; Wed, 28 Nov 2018 06:03:09 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1spggbww-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:08 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:06 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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) Wed, 28 Nov 2018 11:03:04 -0000 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 wASB32UU9437530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:02 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B1B63A4040; Wed, 28 Nov 2018 11:03:02 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9FD19A4053; Wed, 28 Nov 2018 11:03:01 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:01 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:24 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-4275-0000-0000-000002E7F09D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-4276-0000-0000-000037F53090 Message-Id: <20181128110244.17664-3-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 02/22] 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, 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 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 memory preserving IPL). - 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 | 4 ++-- 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, 13 insertions(+), 13 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 562187092..e09fe9e34 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -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..f3339c708 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-2018 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..903c44fbf 100644 --- a/include/fsp-mdst-table.h +++ b/include/opal-dump.h @@ -1,4 +1,4 @@ -/* Copyright 2013-2014 IBM Corp. +/* Copyright 2013-2018 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 Wed Nov 28 11:02:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004423 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434d8K1lpKz9s55 for ; Wed, 28 Nov 2018 22:04:33 +1100 (AEDT) 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 434d8J5dKfzDqgX for ; Wed, 28 Nov 2018 22:04:32 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d6n2LNmzDqfY for ; Wed, 28 Nov 2018 22:03:13 +1100 (AEDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxMfw004316 for ; Wed, 28 Nov 2018 06:03:11 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1p3p9ahj-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:10 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:08 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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) Wed, 28 Nov 2018 11:03:06 -0000 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 wASB35au4784488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:05 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0C86EA4053; Wed, 28 Nov 2018 11:03:05 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02D1EA4055; Wed, 28 Nov 2018 11:03:04 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:03 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:25 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0020-0000-0000-000002EEF226 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0021-0000-0000-0000213E4B51 Message-Id: <20181128110244.17664-4-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 03/22] 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, 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 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 | 10 ++++++---- include/opal-dump.h | 20 +++++++++++++++----- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/hdata/spira.c b/hdata/spira.c index e09fe9e34..c5c54d0ab 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 f3339c708..4b701e0ed 100644 --- a/hw/fsp/fsp-sysdump.c +++ b/hw/fsp/fsp-sysdump.c @@ -114,7 +114,8 @@ 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].dump_type = DUMP_TYPE_SYSDUMP; mdst_table[i].size = dump_mem_region[i].size; mdst_table[i].addr = cpu_to_be64(PSI_DMA_HYP_DUMP + t_size); @@ -194,7 +195,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 +215,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 +252,8 @@ 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].dump_type = DUMP_TYPE_SYSDUMP; 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 903c44fbf..a777fcb78 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -21,28 +21,38 @@ /* * Dump region ids * - * 0x01 - 0x7F : OPAL + * 0x00 - 0x00 : CPU data + * 0x01 - 0x3F : OPAL + * 0x40 - 0x7F : Reserved for future use * 0x80 - 0xFF : Kernel * */ +#define DUMP_REGION_CPU_DATA 0x00 #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_FADUMP 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 Wed Nov 28 11:02:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004424 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434d8f0mktz9s55 for ; Wed, 28 Nov 2018 22:04:50 +1100 (AEDT) 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 434d8d6ZthzDqgS for ; Wed, 28 Nov 2018 22:04:49 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d6q2TjvzDqgb for ; Wed, 28 Nov 2018 22:03:15 +1100 (AEDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxMVZ004350 for ; Wed, 28 Nov 2018 06:03:13 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1p3p9ake-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:13 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:10 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 28 Nov 2018 11:03:08 -0000 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 wASB374R59179084 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:07 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6A53BA405E; Wed, 28 Nov 2018 11:03:07 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5941BA405B; Wed, 28 Nov 2018 11:03:06 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:06 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:26 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-4275-0000-0000-000002E7F0A3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-4276-0000-0000-000037F53097 Message-Id: <20181128110244.17664-5-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 04/22] hdata: Define various MPIPL related tables 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, 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 | 3 ++- include/opal-dump.h | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/hdata/spira.c b/hdata/spira.c index c5c54d0ab..00cedd5e5 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1662,6 +1662,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 41159d2ba..8aa688b62 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -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 a777fcb78..99cc6db7c 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -55,4 +55,71 @@ struct mdst_table { __be32 size; } __packed; +/* Memory dump destination table (MDDT) */ +struct mddt_table { + __be64 addr; + uint8_t data_region; /* Same as mdst_table->data_region */ + uint8_t dump_type; /* Same as mdst_table->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; /* Same as mdst_table->data_region */ + uint8_t dump_type; /* Same as mdst_table->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 Wed Nov 28 11:02:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004425 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434d9100dbz9ryk for ; Wed, 28 Nov 2018 22:05:09 +1100 (AEDT) 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 434d905HH9zDqfp for ; Wed, 28 Nov 2018 22:05:08 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d6s2GKNzDqfZ for ; Wed, 28 Nov 2018 22:03:17 +1100 (AEDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASB0bbT097919 for ; Wed, 28 Nov 2018 06:03:15 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1ps2qh2m-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:14 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:12 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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) Wed, 28 Nov 2018 11:03:10 -0000 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 wASB39Cv64618614 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:09 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9320A4055; Wed, 28 Nov 2018 11:03:09 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AF36FA4053; Wed, 28 Nov 2018 11:03:08 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:08 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:27 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-4275-0000-0000-000002E7F0A5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-4276-0000-0000-000037F53099 Message-Id: <20181128110244.17664-6-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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=488 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280100 Subject: [Skiboot] [PATCH v6 05/22] hdata: 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, 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 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 | 8 ++++++-- skiboot.lds.S | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/mem-map.h b/include/mem-map.h index 3e30d9b76..98f781cc5 100644 --- a/include/mem-map.h +++ b/include/mem-map.h @@ -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 8d09b40e6..31cc5faa2 100644 --- a/skiboot.lds.S +++ b/skiboot.lds.S @@ -47,6 +47,11 @@ SECTIONS KEEP(*(.mdst.data)) } + . = MDDT_TABLE_OFF; + .mddt : { + KEEP(*(.mddt.data)) + } + . = CPU_CTL_OFF; .cpuctrl : { KEEP(*(.cpuctrl.data)) From patchwork Wed Nov 28 11:02:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004426 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434d9M35pHz9s55 for ; Wed, 28 Nov 2018 22:05:27 +1100 (AEDT) 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 434d9M1K4bzDqgD for ; Wed, 28 Nov 2018 22:05:27 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d6v1bggzDqgS for ; Wed, 28 Nov 2018 22:03:19 +1100 (AEDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxLiw004258 for ; Wed, 28 Nov 2018 06:03:17 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1p3p9aqf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:17 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:15 -0000 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) Wed, 28 Nov 2018 11:03:13 -0000 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 wASB3CZm3670316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:12 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 26427A404D; Wed, 28 Nov 2018 11:03:12 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0AE77A4053; Wed, 28 Nov 2018 11:03:11 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:10 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:28 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0012-0000-0000-000002D16D6B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0013-0000-0000-00002106B1E7 Message-Id: <20181128110244.17664-7-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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=648 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280100 Subject: [Skiboot] [PATCH v6 06/22] hdata: 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, 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 98f781cc5..f15cffcf8 100644 --- a/include/mem-map.h +++ b/include/mem-map.h @@ -103,11 +103,17 @@ #define PSI_TCE_TABLE_SIZE_P7 0x00020000UL #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 Wed Nov 28 11:02:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004427 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434d9t42Z9z9ryk for ; Wed, 28 Nov 2018 22:05:54 +1100 (AEDT) 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 434d9t2jwzzDqhH for ; Wed, 28 Nov 2018 22:05:54 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d6x429MzDqfZ for ; Wed, 28 Nov 2018 22:03:20 +1100 (AEDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxQFE093986 for ; Wed, 28 Nov 2018 06:03:18 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1qjv5y0g-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:18 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:16 -0000 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) Wed, 28 Nov 2018 11:03:15 -0000 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 wASB3EgK7799134 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:14 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6EE0AA4040; Wed, 28 Nov 2018 11:03:14 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6B08AA4059; Wed, 28 Nov 2018 11:03:13 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:13 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:29 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0020-0000-0000-000002EEF22A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0021-0000-0000-0000213E4B55 Message-Id: <20181128110244.17664-8-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 07/22] fadump: Define destination memory for OPAL boot crash 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, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" We will hardcode OPAL dump source/destination memory region in SPIRAH so that we can capture early OPAL dump. OPAL stack size depends on PIR and OPAL calculates runtime size (including stack) during OPAL init. Hence use MAX possible PIR to calculate destination memory for OPAL dump. Signed-off-by: Vasant Hegde --- include/mem-map.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/mem-map.h b/include/mem-map.h index f15cffcf8..00d045fc5 100644 --- a/include/mem-map.h +++ b/include/mem-map.h @@ -127,6 +127,24 @@ */ #define CPU_STACKS_BASE (SKIBOOT_BASE + SKIBOOT_SIZE) +/* Destination memory to capture OPAL dump. We use max possible PIR to + * calculate destination memory start address and size. + * + * XXX: Use continuguous memory for OPAL destination memory so that we can + * create single reserve node entry in device tree for OPAL destination + * memory. + */ +#define FADUMP_DEST_CON_LOG (CPU_STACKS_BASE + \ + ((SPR_PIR_P9_MASK + 1) * STACK_SIZE)) +#define FADUMP_DEST_CON_SIZE (INMEM_CON_LEN) + +#define FADUMP_DEST_HBRT_LOG (FADUMP_DEST_CON_LOG + FADUMP_DEST_CON_SIZE) +#define FADUMP_DEST_HBRT_SIZE (HBRT_CON_LEN) + +#define FADUMP_DEST_SKIBOOT_BASE (FADUMP_DEST_HBRT_LOG + FADUMP_DEST_HBRT_SIZE) +/* Collect OPAL core including max possible CPU stack data */ +#define FADUMP_DEST_SKIBOOT_SIZE (FADUMP_DEST_CON_LOG - SKIBOOT_BASE) + /* * Address at which we load the kernel LID. This is also where * we expect a passed-in kernel if booting without FSP and From patchwork Wed Nov 28 11:02:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004428 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dBJ16rPz9ryk for ; Wed, 28 Nov 2018 22:06:15 +1100 (AEDT) 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 434dBG4g7xzDqfd for ; Wed, 28 Nov 2018 22:06:14 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d6z3P17zDqhH for ; Wed, 28 Nov 2018 22:03:23 +1100 (AEDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASB158l074110 for ; Wed, 28 Nov 2018 06:03:21 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1qv752w8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:20 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:19 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 28 Nov 2018 11:03:18 -0000 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 wASB3Gnj2752884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:17 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CAE13A406B; Wed, 28 Nov 2018 11:03:16 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BFB17A4051; Wed, 28 Nov 2018 11:03:15 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:15 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:30 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0012-0000-0000-000002D16D70 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0013-0000-0000-00002106B1EC Message-Id: <20181128110244.17664-9-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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=1011 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-1811280100 Subject: [Skiboot] [PATCH v6 08/22] hdata: Add support for early OPAL crash 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, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Lets hardcode few entries in MDST and MDDT table.. so that we can capture early OPAL crash. Note that we will have 1 to 1 mapping between MDST and MDDT table entry. Signed-off-by: Vasant Hegde --- hdata/spira.c | 54 ++++++++++++++++++++++++++++++++++++++++++++---- hdata/test/hdata_to_dt.c | 1 + include/opal-dump.h | 1 + 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/hdata/spira.c b/hdata/spira.c index 00cedd5e5..7fba16bd8 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -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 mdst_table init_mdst_table[2] = { +__section(".mdst.data") struct mdst_table init_mdst_table[3] = { { .addr = CPU_TO_BE64(INMEM_CON_START | HRMOR_BIT), .data_region = DUMP_REGION_CONSOLE, @@ -102,6 +102,30 @@ __section(".mdst.data") struct mdst_table init_mdst_table[2] = { .dump_type = DUMP_TYPE_SYSDUMP, .size = CPU_TO_BE32(HBRT_CON_LEN), }, + { + .addr = CPU_TO_BE64(SKIBOOT_BASE | HRMOR_BIT), + .data_region = DUMP_REGION_OPAL_MEMORY, + .dump_type = DUMP_TYPE_FADUMP, + .size = CPU_TO_BE32(FADUMP_DEST_SKIBOOT_SIZE), + }, +}; + +__section(".mddt.data") struct mddt_table init_mddt_table[3] = { + { + .addr = CPU_TO_BE64(FADUMP_DEST_CON_LOG | HRMOR_BIT), + .data_region = DUMP_REGION_CONSOLE, + .size = CPU_TO_BE32(FADUMP_DEST_CON_SIZE), + }, + { + .addr = CPU_TO_BE64(FADUMP_DEST_HBRT_LOG | HRMOR_BIT), + .data_region = DUMP_REGION_HBRT_LOG, + .size = CPU_TO_BE32(FADUMP_DEST_HBRT_SIZE), + }, + { + .addr = CPU_TO_BE64(FADUMP_DEST_SKIBOOT_BASE | HRMOR_BIT), + .data_region = DUMP_REGION_OPAL_MEMORY, + .size = CPU_TO_BE32(FADUMP_DEST_SKIBOOT_SIZE), + }, }; /* SP Interface Root Array, aka SPIRA */ @@ -187,10 +211,32 @@ __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(ARRAY_SIZE(init_mddt_table)), + .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. + */ + .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)), }, }, }; diff --git a/hdata/test/hdata_to_dt.c b/hdata/test/hdata_to_dt.c index c75a4adc4..fc8e43b2b 100644 --- a/hdata/test/hdata_to_dt.c +++ b/hdata/test/hdata_to_dt.c @@ -77,6 +77,7 @@ unsigned long tb_hz = 512000000; #define PVR_P9 0x004e0200 #define SPR_PVR 0x11f /* RO: Processor version register */ +#define SPR_PIR_P9_MASK 0x7fff /* Mask of implemented bits */ #define __CPU_H struct cpu_thread { diff --git a/include/opal-dump.h b/include/opal-dump.h index 99cc6db7c..331815729 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -35,6 +35,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 From patchwork Wed Nov 28 11:02:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004429 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dBg34Ljz9ryk for ; Wed, 28 Nov 2018 22:06:35 +1100 (AEDT) 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 434dBg1lNBzDqgk for ; Wed, 28 Nov 2018 22:06:35 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d734gBZzDqfd for ; Wed, 28 Nov 2018 22:03:27 +1100 (AEDT) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxLn1098479 for ; Wed, 28 Nov 2018 06:03:25 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1s9vsffp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:24 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:22 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Wed, 28 Nov 2018 11:03:20 -0000 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 wASB3JDP51052648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:19 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 32131A405D; Wed, 28 Nov 2018 11:03:19 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 27EA7A4040; Wed, 28 Nov 2018 11:03:18 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:17 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:31 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0016-0000-0000-0000022DE7E3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0017-0000-0000-0000328644E4 Message-Id: <20181128110244.17664-10-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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=638 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280100 Subject: [Skiboot] [PATCH v6 09/22] 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, 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 if we crash before sending relocated skiboot base to SBE, hostboot can still collect early crash using original skiboot base. Signed-off-by: Vasant Hegde --- hdata/spira.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hdata/spira.c b/hdata/spira.c index 7fba16bd8..b0e91803f 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "hdata.h" #include "hostservices.h" @@ -1716,6 +1717,28 @@ 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 memory preserving IPL. + */ +static void update_spirah_addr(void) +{ +#if !defined(TEST) + /* NACA starts at 0x4000 (see asm/head.S) */ + uint64_t *spirah_offset = (uint64_t *)((u64)SKIBOOT_BASE + 0x4000); + /* Legacy SPIRA */ + uint64_t *spira_offset = (uint64_t *)((u64)SKIBOOT_BASE + 0x4000 + 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)); @@ -1724,6 +1747,8 @@ int parse_hdat(bool is_opal) fixup_spira(); + update_spirah_addr(); + /* * Basic DT root stuff */ From patchwork Wed Nov 28 11:02:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004430 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dC234BMz9ryk for ; Wed, 28 Nov 2018 22:06:54 +1100 (AEDT) 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 434dC21WwWzDqfK for ; Wed, 28 Nov 2018 22:06:54 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d761p1czDqfK for ; Wed, 28 Nov 2018 22:03:29 +1100 (AEDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxKqg078355 for ; Wed, 28 Nov 2018 06:03:28 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1qjwnn4f-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:27 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:25 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) 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) Wed, 28 Nov 2018 11:03:22 -0000 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 wASB3LeA7668030 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:21 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 83E6BA4059; Wed, 28 Nov 2018 11:03:21 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79F10A4051; Wed, 28 Nov 2018 11:03:20 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:20 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:32 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0016-0000-0000-0000022DE7E4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0017-0000-0000-0000328644E5 Message-Id: <20181128110244.17664-11-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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=903 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280100 Subject: [Skiboot] [PATCH v6 10/22] fadump: Define FADUMP 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, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This structure is shared between OPAL and payload. During fadump registration payload will use this structure to pass kernel memory reservation details to OPAL. OPAL will use this structure to fill MDST, MDDT table. After fadump, OPAL uses MDRT table to fill this structure and passes this to payload via device tree. Signed-off-by: Vasant Hegde --- include/opal-api.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/include/opal-api.h b/include/opal-api.h index 5f397c8e6..9cb952e43 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1314,6 +1314,37 @@ enum { OPAL_PCI_P2P_TARGET = 1, }; +/* + * FADUMP memory region ID usable by kernel + * 0x80 - 0xff -> Payload + */ +#define FADUMP_REGION_HOST_START 0x80 +#define FADUMP_REGION_HOST_END 0xff + +/* + * fadump section details. This structure is shared between OPAL and payload. + * During fadump registration payload will use this structure to pass kernel + * memory reservation details to OPAL. OPAL will use this structure to fill + * MDST, MDDT table. After fadump, OPAL uses MDRT table to fill this structure. + * And passes this to payload via device tree. + */ +struct fadump_section { + u8 source_type; /* FADUMP_REGION_* */ + u8 reserved[7]; + u64 source_addr; + u64 source_size; + u64 dest_addr; + u64 dest_size; +} __packed; + +struct fadump { + u16 fadump_section_size; /* sizeof(struct fadump_section) */ + u16 section_count; + u32 crashing_cpu; + u64 reserved; + struct fadump_section section[]; +}; + #endif /* __ASSEMBLY__ */ #endif /* __OPAL_API_H */ From patchwork Wed Nov 28 11:02:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004431 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dCL3F5Qz9ryk for ; Wed, 28 Nov 2018 22:07:10 +1100 (AEDT) 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 434dCL1ztxzDqgk for ; Wed, 28 Nov 2018 22:07:10 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d770cZtzDqgD for ; Wed, 28 Nov 2018 22:03:30 +1100 (AEDT) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASB1TUm116657 for ; Wed, 28 Nov 2018 06:03:28 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2p1ssd03x0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:27 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:26 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 28 Nov 2018 11:03:25 -0000 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 wASB3NsH6554020 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:24 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D34D0A4051; Wed, 28 Nov 2018 11:03:23 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C98CBA404D; Wed, 28 Nov 2018 11:03:22 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:22 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:33 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0012-0000-0000-000002D16D74 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0013-0000-0000-00002106B1F0 Message-Id: <20181128110244.17664-12-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 11/22] hdata: Create dump DT node under /ibm, opal DT 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, 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 b0e91803f..d1748511c 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1033,6 +1033,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 fadump_add_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] = (u64)KERNEL_LOAD_BASE; + fw_load_area[1] = KERNEL_LOAD_SIZE; + fw_load_area[2] = (u64)INITRAMFS_LOAD_BASE; + fw_load_area[3] = 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; @@ -1120,6 +1140,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 fadump node */ + if (sys_attributes & SYS_ATTR_MPIPL_SUPPORTED) + fadump_add_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 8aa688b62..5c030692e 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 Wed Nov 28 11:02:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004433 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dD621MPz9ryk for ; Wed, 28 Nov 2018 22:07:50 +1100 (AEDT) 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 434dD572ZdzDqTs for ; Wed, 28 Nov 2018 22:07:49 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d7D0PnGzDqgD for ; Wed, 28 Nov 2018 22:03:35 +1100 (AEDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxKci078338 for ; Wed, 28 Nov 2018 06:03:34 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1qjwnn93-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:33 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:30 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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) Wed, 28 Nov 2018 11:03:27 -0000 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 wASB3QID9044346 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:26 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30E19A405D; Wed, 28 Nov 2018 11:03:26 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 26774A4059; Wed, 28 Nov 2018 11:03:25 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:24 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:34 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-4275-0000-0000-000002E7F0B0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-4276-0000-0000-000037F530A4 Message-Id: <20181128110244.17664-13-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 12/22] hdata: Add result table 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, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" During MPIPL hostboot updates MDRT table with details of memory movement (source, destination address, size, etc). Convert these details to fadump structure format and pass it to kernel via 'result-table' property. Device tree property: /ibm,opal/dump/result-table - follows fadump structure format Signed-off-by: Vasant Hegde --- hdata/spira.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ hdata/spira.h | 4 +++ 2 files changed, 95 insertions(+) diff --git a/hdata/spira.c b/hdata/spira.c index d1748511c..d52df3f05 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "hdata.h" #include "hostservices.h" @@ -1033,6 +1035,92 @@ 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 fadump_add_result_table(const struct iplparams_iplparams *p) +{ + int i, j = 0; + u32 mdrt_cnt = spira.ntuples.mdump_res.act_cnt; + u32 mdrt_max_cnt = MDRT_TABLE_SIZE / sizeof(struct mdrt_table); + size_t prop_size; + struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE); + struct fadump_section *fadump_section; + struct fadump *result_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_DEBUG, "FADUMP: 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, "FADUMP: Memory not preserved \n"); + return; + } + + if (mdrt_cnt == 0 || mdrt_cnt >= mdrt_max_cnt) { + prlog(PR_ERR, "FADUMP: Invalid MDRT count : %x\n", mdrt_cnt); + return; + } + + prlog(PR_DEBUG, "FADUMP: Dump found, MDRT count = 0x%x\n", mdrt_cnt); + + /* Calculcate property size */ + prop_size = sizeof(struct fadump) + + (mdrt_cnt * sizeof(struct fadump_section)); + result_table = zalloc(prop_size); + if (!result_table) { + prlog(PR_ERR, "FADUMP: Failed to allocate memory\n"); + return; + } + + /* Copy MDRT entries to result-table */ + result_table->fadump_section_size = sizeof(struct fadump_section); + for (i = 0; i < mdrt_cnt; i++) { + /* Skip garbage entry */ + if ((mdrt->dest_addr == 0) || (mdrt->size == 0)) { + mdrt++; + continue; + } + + if (mdrt->dump_type != DUMP_TYPE_FADUMP) { + mdrt++; + continue; + } + + fadump_section = &(result_table->section[j++]); + fadump_section->source_type = mdrt->data_region; + /* Clear top bit */ + fadump_section->source_addr = mdrt->src_addr & ~(HRMOR_BIT); + fadump_section->dest_addr = mdrt->dest_addr & ~(HRMOR_BIT); + fadump_section->source_size = mdrt->size; + fadump_section->dest_size = mdrt->size; + mdrt++; + } + + if (j == 0) { + prlog(PR_DEBUG, "FADUMP: MDRT table is empty\n"); + free(result_table); + return; + } + + result_table->section_count = j; + /* Actual property size */ + prop_size = sizeof(struct fadump) + (j * sizeof(struct fadump_section)); + dt_add_property(dump_node, "result-table", result_table, prop_size); + free(result_table); +} + static void fadump_add_node(void) { u64 fw_load_area[4]; @@ -1196,6 +1284,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 fadump result table */ + fadump_add_result_table(p); } static void add_iplparams_serials(const void *iplp, struct dt_node *node) diff --git a/hdata/spira.h b/hdata/spira.h index 5c030692e..ed759d50f 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 Wed Nov 28 11:02:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004432 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dCk192Kz9ryk for ; Wed, 28 Nov 2018 22:07:30 +1100 (AEDT) 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 434dCj6dVjzDqh2 for ; Wed, 28 Nov 2018 22:07:29 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d7D0JSfzDqfd for ; Wed, 28 Nov 2018 22:03:35 +1100 (AEDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxTMN094166 for ; Wed, 28 Nov 2018 06:03:33 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1qjv5yew-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:33 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:31 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 28 Nov 2018 11:03:29 -0000 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 wASB3S1s64290886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:28 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D161A405B; Wed, 28 Nov 2018 11:03:28 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 76C86A406B; Wed, 28 Nov 2018 11:03:27 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:27 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:35 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0008-0000-0000-00000299BC69 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0009-0000-0000-0000220403B6 Message-Id: <20181128110244.17664-14-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 13/22] fadump: Add fw-source-table to ibm, 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, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Add 'fw-source-table' property to ibm,dump node. Payload will make use of this property to create ELF notes. This patch also adjusts MDST and MDDT entry for OPAL dump. Now OPAL dump size reflects runtime size of OPAL. Finally add reserve node for opal dump destination memory. If dump is available then reserve node size is max of current dump destination size and memory reserved for next dump. Signed-off-by: Vasant Hegde --- core/Makefile.inc | 2 +- core/init.c | 4 ++ core/opal-mpipl.c | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-dump.h | 4 ++ 4 files changed, 181 insertions(+), 1 deletion(-) create mode 100644 core/opal-mpipl.c diff --git a/core/Makefile.inc b/core/Makefile.inc index 3bdfd09da..0ed015842 100644 --- a/core/Makefile.inc +++ b/core/Makefile.inc @@ -9,7 +9,7 @@ CORE_OBJS += vpd.o hostservices.o platform.o nvram.o nvram-format.o hmi.o 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 += pci-dt-slot.o direct-controls.o cpufeatures.o opal-mpipl.o ifeq ($(SKIBOOT_GCOV),1) CORE_OBJS += gcov-profiling.o diff --git a/core/init.c b/core/init.c index 262ac5fb3..1cb38de94 100644 --- a/core/init.c +++ b/core/init.c @@ -54,6 +54,7 @@ #include #include #include +#include enum proc_gen proc_gen; unsigned int pcie_max_link_speed; @@ -1087,6 +1088,9 @@ void __noreturn __nomcount main_cpu_entry(const void *fdt) */ p9_sbe_init(); + /* init opal dump */ + opal_fadump_init(); + /* Initialize i2c */ p8_i2c_init(); diff --git a/core/opal-mpipl.c b/core/opal-mpipl.c new file mode 100644 index 000000000..2a4d13a52 --- /dev/null +++ b/core/opal-mpipl.c @@ -0,0 +1,172 @@ +/* Copyright 2018 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) "FADUMP: " 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; + + +/* Reserve OPAL dump destination memory */ +static void add_fadump_reserve_node(struct dt_node *dump_node) +{ + int i; + u64 cur_size = 0, new_size = 0; + /* Use relocated memory address */ + struct mddt_table *mddt = (void *)(MDDT_TABLE_BASE); + struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE); + + /* If dump exists, get current opal dump size */ + if (dt_find_property(dump_node, "result-table")) { + for (i = 0; i < ntuple_mdrt->act_cnt; i++) { + if (mdrt->data_region >= DUMP_REGION_OPAL_START && + mdrt->data_region < DUMP_REGION_OPAL_END) + cur_size += be32_to_cpu(mdrt->size); + + mdrt++; + } + } + + /* Get new OPAL dump reservation size */ + for (i = 0; i < ntuple_mddt->act_cnt; i++) { + if (mddt->data_region >= DUMP_REGION_OPAL_START && + mddt->data_region < DUMP_REGION_OPAL_END) + new_size += be32_to_cpu(mddt->size); + + mddt++; + } + + mem_reserve_fw("ibm,firmware-dump", (u64)FADUMP_DEST_CON_LOG, + new_size > cur_size ? new_size : cur_size); +} + +/* Pass OPAL dump reservation details to payload via device tree. */ +static void dt_add_fadump_source_table(struct dt_node *dump_node, + struct mdst_table *mdst, + struct mddt_table *mddt) +{ + size_t prop_size; + struct fadump *source_table; + + if (mdst->data_region != DUMP_REGION_OPAL_MEMORY || + mddt->data_region != DUMP_REGION_OPAL_MEMORY) { + prlog(PR_DEBUG, + "OPAL memory entry is missing in MDST/MDDT table\n"); + return; + } + + prop_size = sizeof(struct fadump) + sizeof(struct fadump_section); + source_table = zalloc(prop_size); + if (!source_table) { + prlog(PR_ERR, "Failed to allocate memory\n"); + return; + } + + source_table->fadump_section_size = sizeof(struct fadump_section); + source_table->section_count = 1; + source_table->section[0].source_type = mdst->data_region; + source_table->section[0].source_addr = mdst->addr & ~(HRMOR_BIT); + source_table->section[0].source_size = mdst->size; + source_table->section[0].dest_addr = mddt->addr & ~(HRMOR_BIT); + source_table->section[0].dest_size = mddt->size; + + dt_add_property(dump_node, "fw-source-table", source_table, prop_size); + free(source_table); +} + +/* + * OPAL adjusts runtime OPAL size based on number of CPUs and PIR value. + * Hardcoded dump entry in MDST and MDDT table contains maximum size required + * to capture OPAL dump (so that we can capture early OPAL dump). Adjust + * OPAL dump entry in MDST and MDDT to reflect OPAL runtime size. + */ +static void adjust_opal_dump_size(struct dt_node *dump_node) +{ + int i; + u64 opal_size; + /* Use relocated memory address */ + struct mdst_table *mdst = (void *)(MDST_TABLE_BASE); + struct mddt_table *mddt = (void *)(MDDT_TABLE_BASE); + + /* Get OPAL runtime size */ + if (!dt_find_property(opal_node, "opal-runtime-size")) + return; + opal_size = dt_prop_get_u64(opal_node, "opal-runtime-size"); + + /* Safe to assume MDST, MDDT table contains entry for OPAL dump + * (see hdata/spira.c) + */ + for (i = 0; i < ntuple_mdst->act_cnt; i++) { + if (mdst->data_region != DUMP_REGION_OPAL_MEMORY) { + mdst++; + continue; + } + mdst->size = opal_size; + break; + } + + for (i = 0; i < ntuple_mddt->act_cnt; i++) { + if (mddt->data_region != DUMP_REGION_OPAL_MEMORY) { + mddt++; + continue; + } + mddt->size = opal_size; + break; + } + + /* Add OPAL dump reservation details to DT */ + dt_add_fadump_source_table(dump_node, mdst, mddt); + /* Make sure OPAL dump destination memory is reserved */ + add_fadump_reserve_node(dump_node); +} + +void opal_fadump_init(void) +{ + struct dt_node *dump_node; + + if (proc_gen < proc_gen_p9) + return; + + /* fadump needs HDAT support */ + 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); + + adjust_opal_dump_size(dump_node); +} diff --git a/include/opal-dump.h b/include/opal-dump.h index 331815729..a45f34fa2 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -123,4 +123,8 @@ struct proc_reg_data { uint64_t reg_val; } __packed; + +/* init opal dump */ +extern void opal_fadump_init(void); + #endif /* __OPAL_DUMP_H */ From patchwork Wed Nov 28 11:02:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004434 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dDX03NRz9ryk for ; Wed, 28 Nov 2018 22:08:12 +1100 (AEDT) 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 434dDW5WlQzDqhs for ; Wed, 28 Nov 2018 22:08:11 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d7J0KY2zDqgL for ; Wed, 28 Nov 2018 22:03:39 +1100 (AEDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASB0d0l098033 for ; Wed, 28 Nov 2018 06:03:38 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1ps2qhqk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:38 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:35 -0000 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) Wed, 28 Nov 2018 11:03:32 -0000 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 wASB3VYX51118180 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:31 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9ACF0A404D; Wed, 28 Nov 2018 11:03:31 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12C9AA4040; Wed, 28 Nov 2018 11:03:30 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:29 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:36 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0012-0000-0000-000002D16D76 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0013-0000-0000-00002106B1F2 Message-Id: <20181128110244.17664-15-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 14/22] fadump: Add OPAL API to register for fadump 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, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This patch adds new API for fadump. int64_t opal_fadump_manage(uint64_t cmd, void *data, uint64_t dsize) cmd : 0x01 -> Register for fadump 0x02 -> Unregister fadump 0x03 -> Invalidate existing dump data : For cmd = 0x01, data contains payload section reservation details (uses fadump structure format to send data). For other cmd values, data will be NULL. dsize: Size of data Return values: OPAL_SUCCESS : Operation success OPAL_PARAMETER : Payload passed invalid data OPAL_RESOURCE : Ran out of MDST, MDDT table size OPAL_PERMISSION: Already registered OPAL_HARDWARE : Fadump not supported Signed-off-by: Vasant Hegde --- core/opal-mpipl.c | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-api.h | 13 +++- 2 files changed, 195 insertions(+), 1 deletion(-) diff --git a/core/opal-mpipl.c b/core/opal-mpipl.c index 2a4d13a52..1779bc56f 100644 --- a/core/opal-mpipl.c +++ b/core/opal-mpipl.c @@ -37,6 +37,186 @@ static struct spira_ntuple *ntuple_mdst; static struct spira_ntuple *ntuple_mddt; static struct spira_ntuple *ntuple_mdrt; +/* Clear MDRT memory */ +static inline void opal_fadump_invalidate(void) +{ + struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE); + + memset(mdrt, 0, MDRT_TABLE_SIZE); + /* Reset MDRT count */ + ntuple_mdrt->act_cnt = + cpu_to_be16(MDRT_TABLE_SIZE / sizeof(struct mdrt_table)); + ntuple_mdrt->alloc_cnt = + cpu_to_be16(MDRT_TABLE_SIZE / sizeof(struct mdrt_table)); +} + +static void opal_fadump_unregister(void) +{ + int i, j; + struct mdst_table *mdst, *tmp_mdst; + struct mddt_table *mddt, *tmp_mddt; + + mdst = (void *)(MDST_TABLE_BASE); + for (i = 0; i < ntuple_mdst->act_cnt; ) { + if (mdst->dump_type != DUMP_TYPE_FADUMP || + mdst->data_region < FADUMP_REGION_HOST_START) { + 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--; + } + + mddt = (void *)(MDDT_TABLE_BASE); + for (i = 0; i < ntuple_mddt->act_cnt; ) { + if (mddt->data_region < FADUMP_REGION_HOST_START) { + 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--; + } +} + +static int opal_fadump_register(void *data, uint64_t dsize) +{ + int i, sec_cnt, max_mdst_entry, max_mddt_entry; + struct fadump_section *section; + struct fadump *fadump = (void *)data; + struct mdst_table *mdst = (void *)(MDST_TABLE_BASE); + struct mddt_table *mddt = (void *)(MDDT_TABLE_BASE); + + if (dsize < sizeof(struct fadump)) { + prlog(PR_DEBUG, "data size is less than minimum size " + "[dsize = 0x%llx]\n", dsize); + return OPAL_PARAMETER; + } + + sec_cnt = be16_to_cpu(fadump->section_count); + if (sec_cnt <= 0) { + prlog(PR_DEBUG, "Invalid section count = 0x%x\n", sec_cnt); + return OPAL_PARAMETER; + } + + max_mdst_entry = MDST_TABLE_SIZE / sizeof(struct mdst_table); + if (ntuple_mdst->act_cnt >= (max_mdst_entry + sec_cnt)) { + prlog(PR_DEBUG, "MDST table is full\n"); + return OPAL_RESOURCE; + } + + max_mddt_entry = MDDT_TABLE_SIZE / sizeof(struct mddt_table); + if (ntuple_mddt->act_cnt >= (max_mddt_entry + sec_cnt)) { + prlog(PR_DEBUG, "MDDT table is full\n"); + return OPAL_RESOURCE; + } + + /* Already registered ? */ + for (i = 0; i < ntuple_mdst->act_cnt; i++) { + if (mdst->dump_type == DUMP_TYPE_FADUMP && + mdst->data_region >= FADUMP_REGION_HOST_START) { + prlog(PR_DEBUG, "Already registered\n"); + return OPAL_PERMISSION; + } + + mdst++; + } + + mdst = (struct mdst_table *)(MDST_TABLE_BASE + + ntuple_mdst->act_cnt * sizeof(struct mdst_table)); + mddt = (struct mddt_table *)(MDDT_TABLE_BASE + + ntuple_mddt->act_cnt * sizeof(struct mddt_table)); + for (i = 0; i < sec_cnt; i++) { + section = &(fadump->section[i]); + + if (section->source_type < FADUMP_REGION_HOST_START) { + prlog(PR_DEBUG, "Invalid source type : 0x%x\n", + section->source_type); + goto clr_entry; + } + + if (!opal_addr_valid((void *)section->source_addr)) { + prlog(PR_DEBUG, "Invalid source address " + "[addr = 0x%llx]\n", section->source_addr); + goto clr_entry; + } + + mdst->dump_type = DUMP_TYPE_FADUMP; + mdst->data_region = section->source_type; + mdst->addr = section->source_addr | HRMOR_BIT; + mdst->size = section->source_size; + mdst++; + ntuple_mdst->act_cnt++; + + if (!opal_addr_valid((void *)section->dest_addr)) { + prlog(PR_DEBUG, "Invalid destination address " + "[addr = 0x%llx]\n", section->dest_addr); + goto clr_entry; + } + + mddt->data_region = section->source_type; + mddt->addr = section->dest_addr | HRMOR_BIT; + mddt->size = section->dest_size; + mddt++; + ntuple_mddt->act_cnt++; + + prlog(PR_NOTICE, "Registered new entry : src - 0x%llx, " + "dst - 0x%llx, size - 0x%llx\n", section->source_addr, + section->dest_addr, section->source_size); + } + + return OPAL_SUCCESS; + +clr_entry: + opal_fadump_unregister(); + return OPAL_PARAMETER; +} + +static int64_t opal_fadump_manage(uint64_t cmd, void *data, uint64_t dsize) +{ + int rc = OPAL_SUCCESS; + + prlog(PR_TRACE, "opal_fadump_manage : cmd - 0x%llx\n", cmd); + + switch (cmd) { + case OPAL_FADUMP_REGISTER: + rc = opal_fadump_register(data, dsize); + if (rc == OPAL_SUCCESS) + prlog(PR_NOTICE, "Payload registered for MPIPL\n"); + break; + case OPAL_FADUMP_UNREGISTER: + opal_fadump_unregister(); + prlog(PR_NOTICE, "Payload unregistered for MPIPL\n"); + break; + case OPAL_FADUMP_INVALIDATE: + opal_fadump_invalidate(); + prlog(PR_NOTICE, "Payload invalidated dump\n"); + break; + default: + prlog(PR_DEBUG, "Unsupported command : 0x%llx\n", cmd); + rc = OPAL_PARAMETER; + break; + } + + return rc; +} /* Reserve OPAL dump destination memory */ static void add_fadump_reserve_node(struct dt_node *dump_node) @@ -169,4 +349,7 @@ void opal_fadump_init(void) ntuple_mdrt = &(spirah.ntuples.mdump_res); adjust_opal_dump_size(dump_node); + + /* OPAL interface */ + opal_register(OPAL_FADUMP_MANAGE, opal_fadump_manage, 3); } diff --git a/include/opal-api.h b/include/opal-api.h index 9cb952e43..d66295304 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -226,7 +226,8 @@ #define OPAL_NX_COPROC_INIT 167 #define OPAL_NPU_SET_RELAXED_ORDER 168 #define OPAL_NPU_GET_RELAXED_ORDER 169 -#define OPAL_LAST 169 +#define OPAL_FADUMP_MANAGE 170 +#define OPAL_LAST 170 #define QUIESCE_HOLD 1 /* Spin all calls at entry */ #define QUIESCE_REJECT 2 /* Fail all calls with OPAL_BUSY */ @@ -1345,6 +1346,16 @@ struct fadump { struct fadump_section section[]; }; +/* + * Command option argument for fadump manage API (OPAL_FADUMP_MANAGE) + * - for registration payload should pass memory reservation details + * - Unregister option removes all entries from payload + * - Invalidate option invalidatates existing fadump + * */ +#define OPAL_FADUMP_REGISTER 0x01 +#define OPAL_FADUMP_UNREGISTER 0x02 +#define OPAL_FADUMP_INVALIDATE 0x03 + #endif /* __ASSEMBLY__ */ #endif /* __OPAL_API_H */ From patchwork Wed Nov 28 11:02:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004435 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dDt5PVXz9ryk for ; Wed, 28 Nov 2018 22:08:30 +1100 (AEDT) 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 434dDt3wWhzDqTg for ; Wed, 28 Nov 2018 22:08:30 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d7J3FHbzDqgX for ; Wed, 28 Nov 2018 22:03:40 +1100 (AEDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxOUm032869 for ; Wed, 28 Nov 2018 06:03:39 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1spggcxq-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:38 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:36 -0000 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) Wed, 28 Nov 2018 11:03:35 -0000 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 wASB3YeK6095308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:34 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79E87A4051; Wed, 28 Nov 2018 11:03:34 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 33DFCA4040; Wed, 28 Nov 2018 11:03:33 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:32 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:37 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0020-0000-0000-000002EEF232 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0021-0000-0000-0000213E4B5D Message-Id: <20181128110244.17664-16-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 15/22] fadump: 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, 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 FADUMP. Payload will call this interface to initiate fadump. Signed-off-by: Vasant Hegde --- core/platform.c | 5 +++++ doc/opal-api/opal-cec-reboot-6-116.rst | 7 +++++++ include/opal-api.h | 1 + 3 files changed, 13 insertions(+) diff --git a/core/platform.c b/core/platform.c index 570a4309a..66a5a52ed 100644 --- a/core/platform.c +++ b/core/platform.c @@ -103,6 +103,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_ERR, "Kernel requested for fadump\n"); + console_complete_flush(); + assert(false); + 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 516d4fc01..9ac7f9f69 100644 --- a/doc/opal-api/opal-cec-reboot-6-116.rst +++ b/doc/opal-api/opal-cec-reboot-6-116.rst @@ -63,6 +63,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 d66295304..a5cc32624 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1235,6 +1235,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 Wed Nov 28 11:02:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004436 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dFD0Qmpz9ryk for ; Wed, 28 Nov 2018 22:08:48 +1100 (AEDT) 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 434dFC6GctzDqfK for ; Wed, 28 Nov 2018 22:08:47 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d7M4DT2zDqgD for ; Wed, 28 Nov 2018 22:03:43 +1100 (AEDT) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxKlW009849 for ; Wed, 28 Nov 2018 06:03:41 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2p1nc0u8m9-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:40 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:39 -0000 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) Wed, 28 Nov 2018 11:03:37 -0000 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 wASB3aXI62259210 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:37 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C76DAA4055; Wed, 28 Nov 2018 11:03:36 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C00AEA4051; Wed, 28 Nov 2018 11:03:35 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:35 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:38 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0012-0000-0000-000002D16D7A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0013-0000-0000-00002106B1F6 Message-Id: <20181128110244.17664-17-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 16/22] fadump: 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, 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-mpipl.c | 4 ++++ hw/sbe-p9.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ include/sbe-p9.h | 6 ++++++ 3 files changed, 57 insertions(+) diff --git a/core/opal-mpipl.c b/core/opal-mpipl.c index 1779bc56f..f9287c713 100644 --- a/core/opal-mpipl.c +++ b/core/opal-mpipl.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -350,6 +351,9 @@ void opal_fadump_init(void) adjust_opal_dump_size(dump_node); + /* Send OPAL relocated base address to SBE */ + p9_sbe_send_relocated_base(SKIBOOT_BASE); + /* OPAL interface */ opal_register(OPAL_FADUMP_MANAGE, opal_fadump_manage, 3); } diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index d52ada15a..c193ed075 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -861,6 +861,53 @@ bool p9_sbe_timer_ok(void) return sbe_has_timer; } +static void p9_sbe_stash_chipop_resp(struct p9_sbe_msg *msg) +{ + int rc = p9_sbe_get_primary_rc(msg->resp); + struct p9_sbe *sbe = (void *)msg->user_data; + + if (rc == SBE_STATUS_PRI_SUCCESS) { + prlog(PR_DEBUG, "Sent stash MPIPL config [chip id =0x%x]\n", + sbe->chip_id); + } else { + prlog(PR_ERR, "Failed to send stash MPIPL config " + "[chip id = 0x%x, rc = %d]\n", sbe->chip_id, rc); + } + + p9_sbe_freemsg(msg); +} + +static void __p9_sbe_send_relocated_base(struct p9_sbe *sbe, u64 reloc_base) +{ + u8 key = SBE_STASH_KEY_SKIBOOT_BASE; + u16 cmd = SBE_CMD_STASH_MPIPL_CONFIG; + u16 flag = SBE_CMD_CTRL_RESP_REQ; + struct p9_sbe_msg *msg; + + msg = p9_sbe_mkmsg(cmd, flag, key, reloc_base, 0); + if (!msg) { + prlog(PR_DEBUG, "Message allocation failed\n"); + return; + } + msg->user_data = (void *)sbe; + if (p9_sbe_queue_msg(sbe->chip_id, msg, p9_sbe_stash_chipop_resp)) { + prlog(PR_ERR, "Failed to queue stash MPIPL config message\n"); + } +} + +/* Send relocated skiboot base address to all SBE */ +void p9_sbe_send_relocated_base(uint64_t reloc_base) +{ + struct proc_chip *chip; + + for_each_chip(chip) { + if (chip->sbe == NULL) + continue; + + __p9_sbe_send_relocated_base(chip->sbe, reloc_base); + } +} + void p9_sbe_init(void) { struct dt_node *xn; diff --git a/include/sbe-p9.h b/include/sbe-p9.h index 4b839d8ba..5f36cb39e 100644 --- a/include/sbe-p9.h +++ b/include/sbe-p9.h @@ -159,6 +159,9 @@ #define CONTROL_TIMER_START 0x0001 #define CONTROL_TIMER_STOP 0x0002 +/* Stash MPIPL config */ +#define SBE_STASH_KEY_SKIBOOT_BASE 0x03 + /* SBE message state */ enum p9_sbe_msg_state { sbe_msg_unused = 0, /* Free */ @@ -237,4 +240,7 @@ extern bool p9_sbe_timer_ok(void); /* Update SBE timer expiry */ extern void p9_sbe_update_timer_expiry(uint64_t new_target); +/* Send skiboot relocated base address to SBE */ +extern void p9_sbe_send_relocated_base(uint64_t reloc_base); + #endif /* __SBE_P9_H */ From patchwork Wed Nov 28 11:02:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004437 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dFZ0TSZz9ryk for ; Wed, 28 Nov 2018 22:09:06 +1100 (AEDT) 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 434dFY68rwzDqfZ for ; Wed, 28 Nov 2018 22:09:05 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d7Q3zLrzDqfK for ; Wed, 28 Nov 2018 22:03:46 +1100 (AEDT) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxKs1009773 for ; Wed, 28 Nov 2018 06:03:44 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2p1nc0u8pk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:44 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:42 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 28 Nov 2018 11:03:40 -0000 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 wASB3d7w58982498 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:39 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 30915A405F; Wed, 28 Nov 2018 11:03:39 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25794A4053; Wed, 28 Nov 2018 11:03:38 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:37 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:39 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-4275-0000-0000-000002E7F0B3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-4276-0000-0000-000037F530A7 Message-Id: <20181128110244.17664-18-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 17/22] fadump: Add support to trigger memory preserving IPL 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, 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 slave chip SBE - S0 interrupt on master 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: - It uses xscom node to detect master and slave chip. So that we can trigger early MPIPL (even before initializing SBE driver). - At present we do not have a proper way to detect SBE is alive or not. So we wait for predefined time and then call normal reboot. Signed-off-by: Vasant Hegde --- hw/ipmi/ipmi-attn.c | 4 ++++ hw/sbe-p9.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/sbe-p9.h | 10 +++++++++ 3 files changed, 76 insertions(+) diff --git a/hw/ipmi/ipmi-attn.c b/hw/ipmi/ipmi-attn.c index 8ff872c62..cf605feaf 100644 --- a/hw/ipmi/ipmi-attn.c +++ b/hw/ipmi/ipmi-attn.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -65,6 +66,9 @@ static void ipmi_log_terminate_event(const char *msg) void __attribute__((noreturn)) ipmi_terminate(const char *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) diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index c193ed075..924f73761 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -947,3 +947,65 @@ 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 chip_id; + uint32_t primary_chip = -1; + int rc; + u64 wait_tb; + struct dt_node *xn; + + if (proc_gen < proc_gen_p9) + return; + + /* Return if MPIPL is not supported */ + if (!dt_find_by_path(opal_node, "dump")) + return; + + dt_for_each_compatible(dt_root, xn, "ibm,xscom") { + chip_id = dt_get_chip_id(xn); + + if (dt_has_node_property(xn, "primary", NULL)) { + primary_chip = chip_id; + continue; + } + + rc = xscom_write(chip_id, + SBE_CONTROL_REG_RW, SBE_CONTROL_REG_S0); + /* Initiate normal reboot */ + if (rc) { + prlog(PR_ERR, "Failed to write S0 interrupt [chip id = %x]\n", + chip_id); + return; + } + } + + if (primary_chip == -1) { + prlog(PR_ERR, "Master chip ID not found.\n"); + return; + } + + /* Write S0 interrupt on master SBE */ + rc = xscom_write(primary_chip, + SBE_CONTROL_REG_RW, SBE_CONTROL_REG_S0); + /* Initiate normal reboot */ + if (rc) { + prlog(PR_ERR, "Failed to write S0 interrupt [chip id = %x]\n", + primary_chip); + return; + } + + /* XXX We do not have a way to detect SBE state. Hence wait for max + * time SBE takes to respond and then trigger normal reboot. + */ + prlog(PR_DEBUG, "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 5f36cb39e..6a852edc2 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 Wed Nov 28 11:02:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004438 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dFv0XZQz9s55 for ; Wed, 28 Nov 2018 22:09:23 +1100 (AEDT) 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 434dFt5tyjzDqhn for ; Wed, 28 Nov 2018 22:09:22 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d7T3cXDzDqgS for ; Wed, 28 Nov 2018 22:03:49 +1100 (AEDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASB0djc098040 for ; Wed, 28 Nov 2018 06:03:47 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1ps2qhyf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:47 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:44 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) 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) Wed, 28 Nov 2018 11:03:43 -0000 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 wASB3fbS60227702 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:41 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B2A78A4057; Wed, 28 Nov 2018 11:03:41 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 768E4A4055; Wed, 28 Nov 2018 11:03:40 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:40 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:40 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0020-0000-0000-000002EEF239 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0021-0000-0000-0000213E4B64 Message-Id: <20181128110244.17664-19-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 18/22] fadump: 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, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Document fadump device tree and OPAL APIs. Signed-off-by: Vasant Hegde Signed-off-by: Ananth N Mavinakayanahalli --- doc/device-tree/ibm,opal/dump.rst | 33 +++++++++++++++ doc/fadump.rst | 51 +++++++++++++++++++++++ doc/index.rst | 1 + doc/opal-api/opal-cec-reboot-6-116.rst | 2 + doc/opal-api/opal-fadump-manage-167.rst | 73 +++++++++++++++++++++++++++++++++ 5 files changed, 160 insertions(+) create mode 100644 doc/device-tree/ibm,opal/dump.rst create mode 100644 doc/fadump.rst create mode 100644 doc/opal-api/opal-fadump-manage-167.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..a5145cf73 --- /dev/null +++ b/doc/device-tree/ibm,opal/dump.rst @@ -0,0 +1,33 @@ +.. _device-tree/ibm,opal/dump: + +Fadump Device Tree Binding +========================== + +See :ref:`fadump` for general fadump information. + +dump node +--------- +.. code-block:: dts + + dump { + /* Architected register data format version */ + cpu-data-version = <0x1>; + /* + * This property tells memory reserved by OPAL for OPAL dump. + * We use `fadump` structure to pass reservation details to + * Linux kernel. + */ + fw-source-table = <0x280001 0x0 0x3000000 0x0 0x0 0x30000000 0x0 0x5f10000 0x0 0x71e10000 0x0 0x5f10000>; + /* 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 contains captured dump details. This property + * exists only when we have dump. + */ + result-table = <0x280002 0x0 0x3000000 0x0 0x0 0x30000000 0x0 0x5f10000 0x0 0x71e10000 0x0 0x5f10000 0x0 0x0 0x0 0x3165a558 0x0 0x34800 0x0 0x3165a558 0x0 0x34800>; + /* Each thread architected register data size */ + cpu-data-size = <0x600>; + }; diff --git a/doc/fadump.rst b/doc/fadump.rst new file mode 100644 index 000000000..a704c72cd --- /dev/null +++ b/doc/fadump.rst @@ -0,0 +1,51 @@ +.. _fadump: + +FADUMP (aka MPIPL) 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_FADUMP_MANAGE API (see +:ref:`opal-api-fadump-manage`). + +Early OPAL crash +---------------- +We hardcode OPAL memory ranges and destination memory in the HDAT. So that we +can capture early OPAL crash dump. + +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/index.rst b/doc/index.rst index b7a868c96..9f154a275 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -46,6 +46,7 @@ Developer Guide and Internals xscom-node-bindings xive imc + fadump OPAL ABI diff --git a/doc/opal-api/opal-cec-reboot-6-116.rst b/doc/opal-api/opal-cec-reboot-6-116.rst index 9ac7f9f69..8b332c880 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-fadump-manage-167.rst b/doc/opal-api/opal-fadump-manage-167.rst new file mode 100644 index 000000000..06e05861d --- /dev/null +++ b/doc/opal-api/opal-fadump-manage-167.rst @@ -0,0 +1,73 @@ +.. _opal-api-fadump-manage: + +OPAL fadump manage call +======================= +:: + + #define OPAL_FADUMP_MANAGE 170 + +This call is used to manage FADUMP (aka MPIPL) on OPAL platform. +Linux kernel will use this call to register/unregister FADUMP. + +Parameters +---------- +:: + + uint64_t command + void *data + uint64_t dsize + +``command`` + ``command`` parameter supports below values: + +:: + + 0x01 - Register for fadump + 0x02 - Unregister fadump + 0x03 - Invalidate existing fadump + +``data`` + ``data`` is valid when ``command`` is 0x01 (registration). + We use fadump structure (see below) to pass Linux kernel + memory reservation details. + +:: + + + struct fadump_section { + u8 source_type; + u8 reserved[7]; + u64 source_addr; + u64 source_size; + u64 dest_addr; + u64 dest_size; + } __packed; + + struct fadump { + u16 fadump_section_size; + u16 section_count; + u32 crashing_cpu; + u64 reserved; + struct fadump_section section[]; + }; + +``dsize`` + Size of the data + +Return Values +------------- + +``OPAL_SUCCESS`` + Operation success + +``OPAL_PARAMETER`` + Invalid ``command`` or ``data`` or ``dsize`` + +``OPAL_RESOURCE`` + Ran out of space in MDST/MDDT table to add new entry + +``OPAL_PERMISSION`` + Already registered + +``OPAL_HARDWARE`` + Platform does not support fadump From patchwork Wed Nov 28 11:02:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004439 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dGF74qtz9s55 for ; Wed, 28 Nov 2018 22:09:41 +1100 (AEDT) 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 434dGF58YjzDqjH for ; Wed, 28 Nov 2018 22:09:41 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d7X3c7DzDqgD for ; Wed, 28 Nov 2018 22:03:52 +1100 (AEDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxPsu078721 for ; Wed, 28 Nov 2018 06:03:50 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1qjwnnvy-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:50 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:48 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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) Wed, 28 Nov 2018 11:03:45 -0000 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 wASB3j808913358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:45 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D7BF9A4057; Wed, 28 Nov 2018 11:03:44 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3511BA4040; Wed, 28 Nov 2018 11:03:43 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:42 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:41 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0020-0000-0000-000002EEF23A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0021-0000-0000-0000213E4B65 Message-Id: <20181128110244.17664-20-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 19/22] mbox: 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, hbathini@linux.vnet.ibm.com, Andrew Jeffery 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 MBOX protocol to get image from PNOR. Instead it expects PNOR TOC and Hostboot Boot Loader to be availabe at particular address in LPC bus. mbox daemon in BMC side takes care of this during normal boot. Once boot is complete mbox daemon swiches 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 MBOX Reset from OPAL in assert path. Note that this is workaround to get mbox working for now. Long term solution is to use a bit in the Host Status byte of the mbox protocol's memory layout to indicate to mboxd that the host is preparing for reboot. We will implement once BMC side implementation is complete. CC: Andrew Jeffery Signed-off-by: Vasant Hegde --- core/flash.c | 9 ++++++++ hw/sbe-p9.c | 3 +++ include/skiboot.h | 1 + libflash/ipmi-hiomap.c | 25 +++++++++++++++++++++ libflash/mbox-flash.c | 23 +++++++++++++++++++ libflash/test/mbox-server.c | 1 + libflash/test/test-ipmi-hiomap.c | 48 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 110 insertions(+) diff --git a/core/flash.c b/core/flash.c index 08d69edc7..1b8af444a 100644 --- a/core/flash.c +++ b/core/flash.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,14 @@ void flash_release(void) unlock(&flash_lock); } +void flash_unregister(void) +{ + struct blocklevel_device *bl = system_flash->bl; + + if (dt_find_compatible_node(dt_root, NULL, "mbox")) + ipmi_hiomap_exit(bl); +} + static int flash_nvram_info(uint32_t *total_size) { int rc; diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index 924f73761..d9bc07fe4 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -964,6 +964,9 @@ void p9_sbe_terminate(void) if (!dt_find_by_path(opal_node, "dump")) return; + /* Unregister flash. It will request BMC MBOX reset */ + flash_unregister(); + dt_for_each_compatible(dt_root, xn, "ibm,xscom") { chip_id = dt_get_chip_id(xn); diff --git a/include/skiboot.h b/include/skiboot.h index 8b53c7681..868a23b74 100644 --- a/include/skiboot.h +++ b/include/skiboot.h @@ -225,6 +225,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 void 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/ipmi-hiomap.c b/libflash/ipmi-hiomap.c index ac47a1005..01fe90964 100644 --- a/libflash/ipmi-hiomap.c +++ b/libflash/ipmi-hiomap.c @@ -180,6 +180,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: break; default: prlog(PR_WARNING, "Unimplemented command handler: %u\n", @@ -439,6 +440,29 @@ static bool hiomap_erase(struct ipmi_hiomap *ctx, uint64_t offset, return true; } +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; @@ -871,6 +895,7 @@ void ipmi_hiomap_exit(struct blocklevel_device *bl) struct ipmi_hiomap *ctx; if (bl) { ctx = container_of(bl, struct ipmi_hiomap, bl); + hiomap_reset(ctx); free(ctx); } } diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c index 11ec90523..1bae9fba8 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 int 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 rc; + } + if (wait_for_bmc(mbox_flash, mbox_flash->timeout)) { + prlog(PR_ERR, "Error waiting for BMC\n"); + return rc; + } + + return OPAL_SUCCESS; +} + static int mbox_flash_get_info(struct blocklevel_device *bl, const char **name, uint64_t *total_size, uint32_t *erase_granule) { @@ -1171,6 +1193,7 @@ void mbox_flash_exit(struct blocklevel_device *bl) { struct mbox_flash_data *mbox_flash; if (bl) { + mbox_flash_reset(bl); mbox_flash = container_of(bl, struct mbox_flash_data, bl); free(mbox_flash); } 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 0ad08b4cf..7463dbd56 100644 --- a/libflash/test/test-ipmi-hiomap.c +++ b/libflash/test/test-ipmi-hiomap.c @@ -247,10 +247,26 @@ static const struct scenario_event hiomap_get_flash_info_call = { }, }; +static const struct scenario_event hiomap_reset_call = { + .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 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, }, SCENARIO_SENTINEL, }; @@ -269,6 +285,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, }, SCENARIO_SENTINEL, }; @@ -291,6 +308,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, }, SCENARIO_SENTINEL, }; @@ -314,6 +332,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, }, SCENARIO_SENTINEL, }; @@ -343,6 +362,7 @@ scenario_hiomap_event_daemon_lost_flash_control[] = { | HIOMAP_E_FLASH_LOST), } }, + { .type = scenario_event_p, .p = &hiomap_reset_call, }, SCENARIO_SENTINEL, }; @@ -445,6 +465,20 @@ scenario_hiomap_event_daemon_regained_flash_control_dirty[] = { }, }, }, + { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_RESET, + .seq = 7, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_RESET, + .seq = 7, + }, + }, + }, SCENARIO_SENTINEL, }; @@ -583,6 +617,20 @@ static const struct scenario_event scenario_hiomap_protocol_reset_recovery[] = { }, }, }, + { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_RESET, + .seq = 9, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_RESET, + .seq = 9, + }, + }, + }, SCENARIO_SENTINEL, }; From patchwork Wed Nov 28 11:02:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004440 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dGb6DLFz9s55 for ; Wed, 28 Nov 2018 22:09:59 +1100 (AEDT) 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 434dGb50T8zDqhm for ; Wed, 28 Nov 2018 22:09:59 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d7d2K9jzDqfp for ; Wed, 28 Nov 2018 22:03:57 +1100 (AEDT) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxNWF127843 for ; Wed, 28 Nov 2018 06:03:55 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1mptmhke-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:54 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:52 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) 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) Wed, 28 Nov 2018 11:03:49 -0000 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 wASB3mM052429018 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:48 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6DC09A405E; Wed, 28 Nov 2018 11:03:48 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 621D8A404D; Wed, 28 Nov 2018 11:03:46 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:45 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:42 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0016-0000-0000-0000022DE7F1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0017-0000-0000-0000328644F4 Message-Id: <20181128110244.17664-21-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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=676 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280100 Subject: [Skiboot] [PATCH v6 20/22] fadump: Hardcode architected register destination memory 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, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Hardcode architected register destination memory address. So that we can capture early OPAL crashes. Note that this patch splits SPIRAH memory into two parts to accommodate architected register ntuple. Today we have 1K memory for SPIRAH and it uses 288 bytes. After this split we have 244 bytes left for SPIRAH expansion. I think this is good enough (at least for P9 generation). Signed-off-by: Vasant Hegde --- core/opal-mpipl.c | 4 ++++ hdata/spira.c | 12 ++++++++++++ include/mem-map.h | 26 +++++++++++++++++++++++--- skiboot.lds.S | 5 +++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/core/opal-mpipl.c b/core/opal-mpipl.c index f9287c713..9a12395ef 100644 --- a/core/opal-mpipl.c +++ b/core/opal-mpipl.c @@ -250,6 +250,10 @@ static void add_fadump_reserve_node(struct dt_node *dump_node) mem_reserve_fw("ibm,firmware-dump", (u64)FADUMP_DEST_CON_LOG, new_size > cur_size ? new_size : cur_size); + + /* Reserved memory used to capture architected register state */ + mem_reserve_fw("ibm,firmware-arch-registers", + (u64)ARCH_REGS_STATE_BASE, ARCH_REGS_STATE_SIZE); } /* Pass OPAL dump reservation details to payload via device tree. */ diff --git a/hdata/spira.c b/hdata/spira.c index d52df3f05..01f77f9b2 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -131,6 +131,11 @@ __section(".mddt.data") struct mddt_table init_mddt_table[3] = { }, }; +__section(".procdump.data") struct proc_dump_area proc_dump_area = { + .alloc_addr = CPU_TO_BE64(ARCH_REGS_STATE_BASE | HRMOR_BIT), + .alloc_size = CPU_TO_BE32(ARCH_REGS_STATE_SIZE), +}; + /* SP Interface Root Array, aka SPIRA */ __section(".spira.data") struct spira spira = { .hdr = HDIF_SIMPLE_HDR("SPIRA ", SPIRA_VERSION, struct spira), @@ -241,6 +246,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 00d045fc5..8fcb6de4e 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 0x200 + +#define PROC_DUMP_AREA_OFF (SPIRAH_OFF + SPIRAH_SIZE) +#define PROC_DUMP_AREA_SIZE 0x200 /* 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 512 bytes (presently we use 288 bytes) + * Use 512 bytes for SPIRAH. + * + * Use 512 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 @@ -133,9 +145,17 @@ * XXX: Use continuguous memory for OPAL destination memory so that we can * create single reserve node entry in device tree for OPAL destination * memory. + * + * Note that we allocate maximum memory required to capture architected + * registers on P9 two socket system. If we ever support bigger system + * then we have to adjust this size. */ -#define FADUMP_DEST_CON_LOG (CPU_STACKS_BASE + \ +#define ARCH_REGS_STATE_BASE (CPU_STACKS_BASE + \ ((SPR_PIR_P9_MASK + 1) * STACK_SIZE)) +#define ARCH_REGS_STATE_SIZE 0x200000 + +/* Destination memory to capture OPAL dump */ +#define FADUMP_DEST_CON_LOG (ARCH_REGS_STATE_BASE + ARCH_REGS_STATE_SIZE) #define FADUMP_DEST_CON_SIZE (INMEM_CON_LEN) #define FADUMP_DEST_HBRT_LOG (FADUMP_DEST_CON_LOG + FADUMP_DEST_CON_SIZE) @@ -143,7 +163,7 @@ #define FADUMP_DEST_SKIBOOT_BASE (FADUMP_DEST_HBRT_LOG + FADUMP_DEST_HBRT_SIZE) /* Collect OPAL core including max possible CPU stack data */ -#define FADUMP_DEST_SKIBOOT_SIZE (FADUMP_DEST_CON_LOG - SKIBOOT_BASE) +#define FADUMP_DEST_SKIBOOT_SIZE (ARCH_REGS_STATE_BASE - SKIBOOT_BASE) /* * Address at which we load the kernel LID. This is also where diff --git a/skiboot.lds.S b/skiboot.lds.S index 31cc5faa2..37dbd34a7 100644 --- a/skiboot.lds.S +++ b/skiboot.lds.S @@ -37,6 +37,11 @@ SECTIONS KEEP(*(.spirah.data)) } + . = PROC_DUMP_AREA_OFF; + .procdump : { + KEEP(*(.procdump.data)) + } + . = PROCIN_OFF; .procin.data : { KEEP(*(.procin.data)) From patchwork Wed Nov 28 11:02:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004441 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dH071rNz9ryk for ; Wed, 28 Nov 2018 22:10:20 +1100 (AEDT) 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 434dH05ngnzDqfZ for ; Wed, 28 Nov 2018 22:10:20 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d7g2xcRzDqgL for ; Wed, 28 Nov 2018 22:03:59 +1100 (AEDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxMnF088344 for ; Wed, 28 Nov 2018 06:03:57 -0500 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1nvwhq0w-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:57 -0500 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:54 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 28 Nov 2018 11:03:52 -0000 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 wASB3pvC8782256 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:52 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CFBFCA4053; Wed, 28 Nov 2018 11:03:51 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF619A4059; Wed, 28 Nov 2018 11:03:49 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:49 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:43 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0012-0000-0000-000002D16D82 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0013-0000-0000-00002106B1FF Message-Id: <20181128110244.17664-22-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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-1811280100 Subject: [Skiboot] [PATCH v6 21/22] hdata: Add architected register details 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, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Post MPIPL FSP/hostboot passes architected register data via HDAT. Add support to get architected register data from HDAT and pass it to kernel. Kernel will use this data to generate vmcore and opalcore. Device tree properties under /ibm,opal/dump node: cpu-data-version - Architected register data format version cpu-data-size - Per CPU register data size result-table - Add entry for architected register Based on cpu-data-size and result-table, kernel will be able to get data for indivisual CPU/register. Signed-off-by: Vasant Hegde --- hdata/spira.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/hdata/spira.c b/hdata/spira.c index 01f77f9b2..f70f095da 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1047,6 +1047,44 @@ static void dt_init_secureboot_node(const struct iplparams_sysparams *sysparams) dt_add_property_cells(node, "hw-key-hash-size", hw_key_hash_size); } +/* Map architected register data to result-table */ +static int fadump_add_arch_regs(struct dt_node *dump_node, + struct fadump *result_table, int *res_table_cnt) +{ + const struct spira_ntuple *ntuple_proc_dump; + const struct proc_dump_area *arch_regs; + struct fadump_section *fadump_section; + + ntuple_proc_dump = &spira.ntuples.proc_dump_area; + arch_regs = (void *)ntuple_proc_dump->addr; + + if (arch_regs->dest_addr == 0 || arch_regs->act_size <= 0) { + prlog(PR_ERR, + "FADUMP: Architected register data is missing\n"); + return OPAL_HARDWARE; + } + + if (arch_regs->thread_size <= 0) { + prlog(PR_ERR, + "FADUMP: Invalid architected register thread size\n"); + return OPAL_HARDWARE; + } + + /* Add each thread size to device tree */ + dt_add_property_cells(dump_node, + "cpu-data-size", arch_regs->thread_size); + + fadump_section = &(result_table->section[*res_table_cnt]); + fadump_section->source_type = DUMP_REGION_CPU_DATA; + fadump_section->source_addr = arch_regs->dest_addr & ~(HRMOR_BIT); + fadump_section->dest_addr = arch_regs->dest_addr & ~(HRMOR_BIT); + fadump_section->source_size = arch_regs->act_size; + fadump_section->dest_size = arch_regs->act_size; + (*res_table_cnt)++; + + return OPAL_SUCCESS; +} + static void fadump_add_result_table(const struct iplparams_iplparams *p) { int i, j = 0; @@ -1087,9 +1125,9 @@ static void fadump_add_result_table(const struct iplparams_iplparams *p) prlog(PR_DEBUG, "FADUMP: Dump found, MDRT count = 0x%x\n", mdrt_cnt); - /* Calculcate property size */ + /* Number of entries in MDRT table + 1 for arch register data */ prop_size = sizeof(struct fadump) + - (mdrt_cnt * sizeof(struct fadump_section)); + ((mdrt_cnt + 1) * sizeof(struct fadump_section)); result_table = zalloc(prop_size); if (!result_table) { prlog(PR_ERR, "FADUMP: Failed to allocate memory\n"); @@ -1126,6 +1164,9 @@ static void fadump_add_result_table(const struct iplparams_iplparams *p) return; } + /* Add architected register data to result-table */ + fadump_add_arch_regs(dump_node, result_table, &j); + result_table->section_count = j; /* Actual property size */ prop_size = sizeof(struct fadump) + (j * sizeof(struct fadump_section)); @@ -1151,6 +1192,10 @@ static void fadump_add_node(void) fw_load_area[2] = (u64)INITRAMFS_LOAD_BASE; fw_load_area[3] = INITRAMFS_LOAD_SIZE; dt_add_property(node, "fw-load-area", fw_load_area, sizeof(fw_load_area)); + + /* Architected register data format version */ + dt_add_property_cells(node, "cpu-data-version", + PROC_DUMP_AREA_FORMAT_P9); } static void add_iplparams_sys_params(const void *iplp, struct dt_node *node) From patchwork Wed Nov 28 11:02:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 1004442 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 434dHN2TKSz9s55 for ; Wed, 28 Nov 2018 22:10:40 +1100 (AEDT) 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 434dHN1G7JzDqfp for ; Wed, 28 Nov 2018 22:10:40 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 434d7j4NcczDqfd for ; Wed, 28 Nov 2018 22:04:01 +1100 (AEDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wASAxMfV078537 for ; Wed, 28 Nov 2018 06:04:00 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2p1qjwnp39-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 28 Nov 2018 06:03:59 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 28 Nov 2018 11:03:56 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Wed, 28 Nov 2018 11:03:55 -0000 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 wASB3stV3146118 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 28 Nov 2018 11:03:54 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CC2B0A404D; Wed, 28 Nov 2018 11:03:54 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 34A2BA4055; Wed, 28 Nov 2018 11:03:53 +0000 (GMT) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.143]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 28 Nov 2018 11:03:52 +0000 (GMT) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 28 Nov 2018 16:32:44 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> References: <20181128110244.17664-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18112811-0020-0000-0000-000002EEF23B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18112811-0021-0000-0000-0000213E4B67 Message-Id: <20181128110244.17664-23-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-11-28_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=821 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811280100 Subject: [Skiboot] [PATCH v6 22/22] fadump: Save crashing cpu 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, hbathini@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Crashing CPU detail is required to get proper backtrace from core file. Save crashing CPU data before triggering MPIPL. During MPIPL boot pass this detail to Host Linux via device tree. Signed-off-by: Vasant Hegde --- core/opal-mpipl.c | 9 +++++++++ hdata/spira.c | 7 +++++++ hw/sbe-p9.c | 4 ++++ include/mem-map.h | 9 ++++++++- include/opal-dump.h | 8 ++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/core/opal-mpipl.c b/core/opal-mpipl.c index 9a12395ef..913ef4e0a 100644 --- a/core/opal-mpipl.c +++ b/core/opal-mpipl.c @@ -16,6 +16,7 @@ #define pr_fmt(fmt) "FADUMP: " fmt +#include #include #include #include @@ -336,6 +337,14 @@ static void adjust_opal_dump_size(struct dt_node *dump_node) add_fadump_reserve_node(dump_node); } +void opal_fadump_save_metadata(void) +{ + struct dump_metadata *m = (struct dump_metadata *)(DUMP_METADATA_AREA_BASE); + + m->crashing_cpu = this_cpu()->pir; + prlog(PR_NOTICE, "Crashing CPU = 0x%x\n", m->crashing_cpu); +} + void opal_fadump_init(void) { struct dt_node *dump_node; diff --git a/hdata/spira.c b/hdata/spira.c index f70f095da..41f72fac1 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1095,6 +1095,9 @@ static void fadump_add_result_table(const struct iplparams_iplparams *p) struct fadump_section *fadump_section; struct fadump *result_table; struct dt_node *dump_node; + struct dump_metadata *m; + + m = (struct dump_metadata *)(DUMP_METADATA_AREA_BASE - SKIBOOT_BASE + FADUMP_DEST_SKIBOOT_BASE); dump_node = dt_find_by_path(opal_node, "dump"); if (!dump_node) @@ -1167,6 +1170,10 @@ static void fadump_add_result_table(const struct iplparams_iplparams *p) /* Add architected register data to result-table */ fadump_add_arch_regs(dump_node, result_table, &j); + /* Fill crashing CPU details */ + result_table->crashing_cpu = m->crashing_cpu; + prlog(PR_NOTICE, "Crashed cpu = 0x%x\n", m->crashing_cpu); + result_table->section_count = j; /* Actual property size */ prop_size = sizeof(struct fadump) + (j * sizeof(struct fadump_section)); diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index d9bc07fe4..24f78ae9f 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -964,6 +965,9 @@ void p9_sbe_terminate(void) if (!dt_find_by_path(opal_node, "dump")) return; + /* Save crashing CPU details */ + opal_fadump_save_metadata(); + /* Unregister flash. It will request BMC MBOX reset */ flash_unregister(); diff --git a/include/mem-map.h b/include/mem-map.h index 8fcb6de4e..78e37e9fb 100644 --- a/include/mem-map.h +++ b/include/mem-map.h @@ -119,7 +119,14 @@ * 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 0x0000f000 + +/* + * This is our dump meta data area. We will use this memory to save + * crashing CPU details before triggering MPIPL. + */ +#define DUMP_METADATA_AREA_BASE (SKIBOOT_BASE + 0x01c0f000) +#define DUMP_METADATA_AREA_SIZE 0x1000 /* Total size of the above area * diff --git a/include/opal-dump.h b/include/opal-dump.h index a45f34fa2..ccf86d840 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -124,7 +124,15 @@ struct proc_reg_data { } __packed; +/* Meta data to capture before triggering MPIPL */ +struct dump_metadata { + uint32_t crashing_cpu; +}; + /* init opal dump */ extern void opal_fadump_init(void); +/* Save metadata before triggering MPIPL */ +extern void opal_fadump_save_metadata(void); + #endif /* __OPAL_DUMP_H */