From patchwork Wed Jun 6 05:35: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: 925731 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 410yBL3l4Hz9s0W for ; Wed, 6 Jun 2018 15:38:02 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 410yBL2YDxzF2ZP for ; Wed, 6 Jun 2018 15:38:02 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 410y8C1gC8zF2vk for ; Wed, 6 Jun 2018 15:36:10 +1000 (AEST) 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 w565YTOf021821 for ; Wed, 6 Jun 2018 01:36:08 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2je966rvbg-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 06 Jun 2018 01:36:07 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 6 Jun 2018 06:36:05 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 6 Jun 2018 06:36:03 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w565a21b35717276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 6 Jun 2018 05:36:02 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EE78E42047; Wed, 6 Jun 2018 06:26:23 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 09F1142045; Wed, 6 Jun 2018 06:26:23 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.176.210]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 6 Jun 2018 06:26:22 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Wed, 6 Jun 2018 11:05:24 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180606053535.8855-1-hegdevasant@linux.vnet.ibm.com> References: <20180606053535.8855-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18060605-0012-0000-0000-0000027B9B67 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18060605-0013-0000-0000-000020ACA3A5 Message-Id: <20180606053535.8855-8-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-06_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1806060064 Subject: [Skiboot] [PATCH v3 07/18] hdata: Add support for early OPAL crash X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 9f908edd3..12e7f2f61 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 8c61b4f62..46e755a66 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 781627164..3619057c1 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