From patchwork Tue Apr 3 12:04: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: 894548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Fnqj5cxjz9s37 for ; Tue, 3 Apr 2018 22:06:09 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40Fnqj43pzzF26c for ; Tue, 3 Apr 2018 22:06:09 +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=prvs=0631b20b45=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 40Fnpp4nrBzF26c for ; Tue, 3 Apr 2018 22:05:22 +1000 (AEST) 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 w33BxgE9100253 for ; Tue, 3 Apr 2018 08:05:20 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2h47c7wncy-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:19 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:14 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:13 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5DWK51183724; Tue, 3 Apr 2018 12:05:13 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D8DF4204C; Tue, 3 Apr 2018 12:57:04 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0337842049; Tue, 3 Apr 2018 12:57:03 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:02 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:32 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0040-0000-0000-000004492358 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0041-0000-0000-000020ED2E0F Message-Id: <20180403120447.24364-2-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 01/16] FSP/MDST: Rename fsp-mdst-table.c -> fsp-sysdump.c 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: , Cc: stewart@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 it 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} | 6 +++--- include/{fsp-mdst-table.h => opal-dump.h} | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) rename hw/fsp/{fsp-mdst-table.c => fsp-sysdump.c} (98%) rename include/{fsp-mdst-table.h => opal-dump.h} (89%) diff --git a/hdata/spira.c b/hdata/spira.c index 9d28ea43b..ba9fe5f69 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..5f88733db 100644 --- a/hw/fsp/fsp-mdst-table.c +++ b/hw/fsp/fsp-sysdump.c @@ -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 89% rename from include/fsp-mdst-table.h rename to include/opal-dump.h index 5989cdb73..9ffffeeee 100644 --- a/include/fsp-mdst-table.h +++ b/include/opal-dump.h @@ -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 Tue Apr 3 12:04: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: 894549 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 40Fnqz12ksz9s37 for ; Tue, 3 Apr 2018 22:06:23 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40Fnqy6QnxzF28k for ; Tue, 3 Apr 2018 22:06:22 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=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 40Fnpq2GJ6zF27L for ; Tue, 3 Apr 2018 22:05:23 +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 w33C3krd025790 for ; Tue, 3 Apr 2018 08:05:21 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h48v5hgk2-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:20 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:17 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:16 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5FPg57147428; Tue, 3 Apr 2018 12:05:15 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 351EA4203F; Tue, 3 Apr 2018 12:57:07 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CE56D42045; Tue, 3 Apr 2018 12:57:05 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:05 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:33 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0044-0000-0000-00000542DE43 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0045-0000-0000-00002882F046 Message-Id: <20180403120447.24364-3-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 02/16] hdata: Fix MDST structure 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: , Cc: stewart@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. Signed-off-by: Vasant Hegde --- hdata/spira.c | 6 ++++-- hw/fsp/fsp-sysdump.c | 10 ++++++---- include/opal-dump.h | 18 ++++++++++++++---- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/hdata/spira.c b/hdata/spira.c index ba9fe5f69..43363278d 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 5f88733db..92b812eae 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 9ffffeeee..0dedeae86 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -21,10 +21,13 @@ /* * Dump region ids * - * 0x01 - 0x7F : OPAL + * 0x00 - 0x00 : CPU data + * 0x01 - 0x3F : OPAL + * 0x40 - 0x79 : 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_HOST_START OPAL_DUMP_REGION_HOST_START @@ -33,16 +36,23 @@ #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 Tue Apr 3 12:04: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: 894550 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40FnrV6MGVz9s37 for ; Tue, 3 Apr 2018 22:06:50 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40FnrV5CkdzF2B0 for ; Tue, 3 Apr 2018 22:06:50 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=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 40Fnpt3RyyzF28k for ; Tue, 3 Apr 2018 22:05:26 +1000 (AEST) 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 w33C2HgP012703 for ; Tue, 3 Apr 2018 08:05:23 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h45ffkr8b-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:23 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:20 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:19 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5IA947906842; Tue, 3 Apr 2018 12:05:18 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 04D3C4204D; Tue, 3 Apr 2018 12:57:10 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9F74742041; Tue, 3 Apr 2018 12:57:08 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:08 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:34 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0008-0000-0000-000004E622AE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0009-0000-0000-00001E792D18 Message-Id: <20180403120447.24364-4-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 03/16] hdata: Define MDDT and MDRT table 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: , Cc: stewart@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" MDDT and MDRT are part of SPIRAH.. used in MPIPL. - 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. Signed-off-by: Vasant Hegde --- include/opal-dump.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/opal-dump.h b/include/opal-dump.h index 0dedeae86..faa4a1639 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -55,4 +55,29 @@ 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 reserved[3]; + __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; + #endif /* __OPAL_DUMP_H */ From patchwork Tue Apr 3 12:04: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: 894551 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Fnrd5H3Yz9s0W for ; Tue, 3 Apr 2018 22:06:57 +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 40Fnrd42G3zF28j for ; Tue, 3 Apr 2018 22:06:57 +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=prvs=0631b20b45=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 40Fnpy6cpHzF28y for ; Tue, 3 Apr 2018 22:05:30 +1000 (AEST) 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 w33Bxgnh100249 for ; Tue, 3 Apr 2018 08:05:27 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2h47c7wnnw-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:26 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:23 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:21 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5Lmu13566302; Tue, 3 Apr 2018 12:05:21 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B32A442047; Tue, 3 Apr 2018 12:57:12 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5C89B42041; Tue, 3 Apr 2018 12:57:11 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:11 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:35 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0040-0000-0000-00000429D999 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0041-0000-0000-0000262D0714 Message-Id: <20180403120447.24364-5-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 04/16] hdata: Setup memory for MDDT table 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: , Cc: stewart@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 d2bc23fc4..12b0a71b3 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 a6e71077c..bc134fd41 100644 --- a/skiboot.lds.S +++ b/skiboot.lds.S @@ -46,6 +46,11 @@ SECTIONS KEEP(*(.mdst.data)) } + . = MDDT_TABLE_OFF; + .mddt : { + KEEP(*(.mddt.data)) + } + . = CPU_CTL_OFF; .cpuctrl : { KEEP(*(.cpuctrl.data)) From patchwork Tue Apr 3 12:04: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: 894552 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 40Fnry4Z4Gz9s37 for ; Tue, 3 Apr 2018 22:07:14 +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 40Fnry2Md6zF2C7 for ; Tue, 3 Apr 2018 22:07:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=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 40Fnpz2MWWzF291 for ; Tue, 3 Apr 2018 22:05:31 +1000 (AEST) 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 w33C47ns085452 for ; Tue, 3 Apr 2018 08:05:29 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h45mctm47-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:28 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:26 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:24 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5OXh57082016; Tue, 3 Apr 2018 12:05:24 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9373C42045; Tue, 3 Apr 2018 12:57:15 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2E0884203F; Tue, 3 Apr 2018 12:57:14 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:13 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:36 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0044-0000-0000-00000542DE46 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0045-0000-0000-00002882F049 Message-Id: <20180403120447.24364-6-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 05/16] hdata: Setup memory for MDRT table 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: , Cc: stewart@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 12b0a71b3..50c70c7d3 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 dump 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 Tue Apr 3 12:04: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: 894553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40FnsC4Z6Qz9s37 for ; Tue, 3 Apr 2018 22:07:27 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40FnsC3B2NzF2Cg for ; Tue, 3 Apr 2018 22:07:27 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=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 40Fnq16f1bzF28G for ; Tue, 3 Apr 2018 22:05:33 +1000 (AEST) 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 w33C2uPA052108 for ; Tue, 3 Apr 2018 08:05:31 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h476we92p-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:30 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:28 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:27 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5Qtc58523902; Tue, 3 Apr 2018 12:05:26 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5AED74204B; Tue, 3 Apr 2018 12:57:18 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 022CD42041; Tue, 3 Apr 2018 12:57:17 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:16 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:37 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0008-0000-0000-000004E622B4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0009-0000-0000-00001E792D1F Message-Id: <20180403120447.24364-7-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 06/16] fadump: Define destination memory for boot 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: , Cc: stewart@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 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/mem-map.h b/include/mem-map.h index 50c70c7d3..ab64ca1fa 100644 --- a/include/mem-map.h +++ b/include/mem-map.h @@ -125,6 +125,19 @@ */ #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. + */ +#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) +#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 Tue Apr 3 12:04: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: 894554 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 40Fnsj1sXVz9s37 for ; Tue, 3 Apr 2018 22:07:53 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40Fnsj0l0yzF2Dt for ; Tue, 3 Apr 2018 22:07:53 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=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 40Fnq42Z6BzF28k for ; Tue, 3 Apr 2018 22:05:36 +1000 (AEST) 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 w33C50QG061714 for ; Tue, 3 Apr 2018 08:05:34 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h476we963-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:34 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:32 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:30 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5TlV9503196; Tue, 3 Apr 2018 12:05:29 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2E4134203F; Tue, 3 Apr 2018 12:57:21 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B3E3742047; Tue, 3 Apr 2018 12:57:19 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:19 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:38 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0020-0000-0000-0000040D77DD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0021-0000-0000-000042A182D6 Message-Id: <20180403120447.24364-8-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 07/16] 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: , Cc: stewart@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 43363278d..3bce046b3 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 len. + * But looks like hostboot uses actual count and len to + * get MDRT table size. And updates act_cnt after + * collecting dump. + */ + .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 f7ed65e66..0f4ec4a73 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 faa4a1639..a4b052e95 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 Tue Apr 3 12:04: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: 894555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Fnsq0hwdz9s37 for ; Tue, 3 Apr 2018 22:07:59 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40Fnsp6Qr4zF2G8 for ; Tue, 3 Apr 2018 22:07:58 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=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 40Fnq96zw9zF28j for ; Tue, 3 Apr 2018 22:05:41 +1000 (AEST) 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 w33BxlxU145309 for ; Tue, 3 Apr 2018 08:05:39 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h45ffkrs0-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:38 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:34 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:33 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5Wj349610958; Tue, 3 Apr 2018 12:05:32 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 047FC42049; Tue, 3 Apr 2018 12:57:24 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 87B6A42047; Tue, 3 Apr 2018 12:57:22 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:22 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:39 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0008-0000-0000-000004E622B6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0009-0000-0000-00001E792D21 Message-Id: <20180403120447.24364-9-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 08/16] hdata: Adjust various structure offset after relocation 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: , Cc: stewart@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" ntuple addresses are relative to payload base. Update various addresses after relocation so that hostboot can access new address to capture dump. 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 3bce046b3..48b6ef813 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "hdata.h" #include "hostservices.h" @@ -1695,12 +1696,36 @@ 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)); prlog(PR_DEBUG, "Parsing HDAT...\n"); + update_spirah_addr(); + fixup_spira(); /* From patchwork Tue Apr 3 12:04: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: 894556 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Fnt41B6wz9s3M for ; Tue, 3 Apr 2018 22:08:12 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40Fnt36Hc3zF26F for ; Tue, 3 Apr 2018 22:08:11 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=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 40FnqC3Z6xzF27L for ; Tue, 3 Apr 2018 22:05:43 +1000 (AEST) 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 w33C2HAr076368 for ; Tue, 3 Apr 2018 08:05:41 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h45mctmh5-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:40 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:38 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:35 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5ZPP12321098; Tue, 3 Apr 2018 12:05:35 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 98B8242049; Tue, 3 Apr 2018 12:57:26 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B7D442041; Tue, 3 Apr 2018 12:57:25 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:25 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:40 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0040-0000-0000-000004492361 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0041-0000-0000-000020ED2E18 Message-Id: <20180403120447.24364-10-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 09/16] fadump: Define FADUMP structure 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: , Cc: stewart@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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/opal-api.h b/include/opal-api.h index df71cf2d7..4fb2db27d 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1303,6 +1303,36 @@ 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 strcture. + * And passes this to payload via device tree. + */ +struct fadump_section { + u8 source_type; /* DUMP_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 reserved; + struct fadump_section section[]; +}; + #endif /* __ASSEMBLY__ */ #endif /* __OPAL_API_H */ From patchwork Tue Apr 3 12:04: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: 894557 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40FntJ3dBsz9s37 for ; Tue, 3 Apr 2018 22:08:24 +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 40FntJ2MsRzF29R for ; Tue, 3 Apr 2018 22:08:24 +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=prvs=0631b20b45=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 40FnqG3sClzF27L for ; Tue, 3 Apr 2018 22:05:46 +1000 (AEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w33C0vR7144156 for ; Tue, 3 Apr 2018 08:05:43 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2h481k3te3-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:43 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:40 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:38 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5bfV44630126; Tue, 3 Apr 2018 12:05:37 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 576924203F; Tue, 3 Apr 2018 12:57:29 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EE3D442041; Tue, 3 Apr 2018 12:57:27 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:27 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:41 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0040-0000-0000-00000429D99F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0041-0000-0000-0000262D0719 Message-Id: <20180403120447.24364-11-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 10/16] hdata: Create ibm,dump DT node 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: , Cc: stewart@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Create /ibm,dump device tree node and populate below properties: - compatible - ibm,dump version - fw-load-area - Memory used by OPAL to load kernel/initrd from PNOR (KERNEL_LOAD_BASE & INITRAMFS_LOAD_BASE) Signed-off-by: Vasant Hegde --- hdata/spira.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/hdata/spira.c b/hdata/spira.c index 48b6ef813..5394e609f 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1117,6 +1117,25 @@ static void add_iplparams_sys_params(const void *iplp, struct dt_node *node) dt_init_secureboot_node(p); } +static void add_fadump_node(const struct iplparams_iplparams *p __unused) +{ + u64 fw_load_area[4]; + struct dt_node *node; + + if (proc_gen < proc_gen_p9) + return; + + node = dt_new(dt_root, "ibm,dump"); + assert(node); + dt_add_property_string(node, "compatible", "ibm,opal-dump-v1"); + + 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_ipl_params(const void *iplp, struct dt_node *node) { const struct iplparams_iplparams *p; @@ -1155,6 +1174,9 @@ static void add_iplparams_ipl_params(const void *iplp, struct dt_node *node) dt_add_property_strings(node, "cec-major-type", p->cec_ipl_maj_type ? "hot" : "cold"); + /* Populate fadump node */ + add_fadump_node(p); + /* Add LED type info under '/ibm,opal/led' node */ led_node = dt_find_by_path(opal_node, DT_PROPERTY_LED_NODE); assert(led_node); From patchwork Tue Apr 3 12:04: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: 894558 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 40Fntq2trXz9s37 for ; Tue, 3 Apr 2018 22:08:51 +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 40Fntq1RlzzF2HF for ; Tue, 3 Apr 2018 22:08:51 +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=prvs=0631b20b45=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 40FnqN1gLKzF28T for ; Tue, 3 Apr 2018 22:05:52 +1000 (AEST) 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 w33Bxh9J100325 for ; Tue, 3 Apr 2018 08:05:49 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2h47c7wpff-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:47 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:43 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:41 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5e3o2359570; Tue, 3 Apr 2018 12:05:40 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2833642042; Tue, 3 Apr 2018 12:57:32 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C257C42047; Tue, 3 Apr 2018 12:57:30 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:30 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:42 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0012-0000-0000-000005C674AE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0013-0000-0000-000019428256 Message-Id: <20180403120447.24364-12-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 11/16] hdata: Add result table property to ibm, dump node 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: , Cc: stewart@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" result-table : Use fadump structure format to send MDRT table to host. Signed-off-by: Vasant Hegde --- hdata/spira.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- hdata/spira.h | 3 +++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/hdata/spira.c b/hdata/spira.c index 5394e609f..1ceb0071b 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "hdata.h" #include "hostservices.h" @@ -1117,7 +1119,82 @@ static void add_iplparams_sys_params(const void *iplp, struct dt_node *node) dt_init_secureboot_node(p); } -static void add_fadump_node(const struct iplparams_iplparams *p __unused) +static void add_fadump_result_table(struct dt_node *node, + const struct iplparams_iplparams *p) +{ + int i, j = 0; + u32 mdrt_cnt = spira.ntuples.mdump_res.act_cnt; + size_t prop_size; + struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE); + struct fadump_section *fadump_section; + struct fadump *result_table; + + if (p->cec_ipl_maj_type != IPLPARAMS_MAJ_TYPE_REIPL || + p->cec_ipl_min_type != IPLPARAMS_MIN_TYPE_POST_DUMP) + return; + if (p->cec_ipl_attrib != IPLPARAMS_ATTRIB_MEM_PRESERVE) + return; + + if (mdrt_cnt == 0) + return; + + prlog(PR_DEBUG, "FADUMP: Dump found, MDRT count = 0x%x\n", mdrt_cnt); + + /* Number of entries in MDRT table */ + 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; + } + + /* Old hostboot? */ + if (mdrt->data_region == 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, "DUMP: MDRT table is empty\n"); + free(result_table); + return; + } + + /* TODO: Fill Architected register data */ + + result_table->section_count = j; + /* Actual property size */ + prop_size = sizeof(struct fadump) + (j * sizeof(struct fadump_section)); + dt_add_property(node, "result-table", result_table, prop_size); + free(result_table); +} + +static void add_fadump_node(const struct iplparams_iplparams *p) { u64 fw_load_area[4]; struct dt_node *node; @@ -1134,6 +1211,8 @@ static void add_fadump_node(const struct iplparams_iplparams *p __unused) 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)); + + add_fadump_result_table(node, p); } static void add_iplparams_ipl_params(const void *iplp, struct dt_node *node) diff --git a/hdata/spira.h b/hdata/spira.h index ef2aec257..c0be8212c 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -399,8 +399,11 @@ 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 0x01 uint8_t cec_ipl_min_type; +#define IPLPARAMS_MIN_TYPE_POST_DUMP 0x0d uint8_t os_ipl_mode; uint8_t keylock_pos; uint8_t lmb_size; From patchwork Tue Apr 3 12:04: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: 894559 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 40Fnty1CWtz9s37 for ; Tue, 3 Apr 2018 22:08:58 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40Fntx75PlzF2JF for ; Tue, 3 Apr 2018 22:08:57 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=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 40FnqN4KsCzF28j for ; Tue, 3 Apr 2018 22:05:52 +1000 (AEST) 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 w33C5cmD069122 for ; Tue, 3 Apr 2018 08:05:49 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h47eynk6x-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:48 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:46 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:43 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5hdb27000844; Tue, 3 Apr 2018 12:05:43 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB00A42042; Tue, 3 Apr 2018 12:57:34 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 80CAC4203F; Tue, 3 Apr 2018 12:57:33 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:33 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:43 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0040-0000-0000-000004492363 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0041-0000-0000-000020ED2E1A Message-Id: <20180403120447.24364-13-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 12/16] fadump: Add fw-source-table to ibm, dump node 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: , Cc: stewart@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 these detail to create ELF notes. This patch also adjusts MDST and MDRT 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-dump.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-dump.h | 3 + 4 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 core/opal-dump.c diff --git a/core/Makefile.inc b/core/Makefile.inc index d36350590..5f65168b2 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-dump.o ifeq ($(SKIBOOT_GCOV),1) CORE_OBJS += gcov-profiling.o diff --git a/core/init.c b/core/init.c index f5b3b473e..090fd2583 100644 --- a/core/init.c +++ b/core/init.c @@ -51,6 +51,7 @@ #include #include #include +#include enum proc_gen proc_gen; unsigned int pcie_max_link_speed; @@ -1016,6 +1017,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-dump.c b/core/opal-dump.c new file mode 100644 index 000000000..dd5544fe8 --- /dev/null +++ b/core/opal-dump.c @@ -0,0 +1,170 @@ +/* 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(void) +{ + int i; + u32 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 */ + 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. + * Note that presently OPAL reserves memory for OPAL dump only. + */ +static void dt_add_fadump_source_table(struct mdst_table *mdst, + struct mddt_table *mddt) +{ + size_t prop_size; + struct dt_node *node; + struct fadump *source_table; + + node = dt_find_by_path(dt_root, "ibm,dump"); + if (!node) + return; + + if (mdst->data_region != DUMP_REGION_OPAL_MEMORY || + mddt->data_region != DUMP_REGION_OPAL_MEMORY) + 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(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). Hence + * adjust OPAL dump entry in MDST and MDDT to reflect OPAL runtime size. + */ +static void adjust_opal_dump_size(void) +{ + 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(mdst, mddt); + /* Make sure OPAL dump destination memory is reserved */ + add_fadump_reserve_node(); +} + +void opal_fadump_init(void) +{ + if (proc_gen < proc_gen_p9) + return; + + /* fadump needs HDAT support. */ + if (!dt_find_by_path(dt_root, "ibm,dump")) + 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(); +} diff --git a/include/opal-dump.h b/include/opal-dump.h index a4b052e95..b36d306cd 100644 --- a/include/opal-dump.h +++ b/include/opal-dump.h @@ -81,4 +81,7 @@ struct mdrt_table { __be64 padding; } __packed; +/* init opal dump */ +extern void opal_fadump_init(void); + #endif /* __OPAL_DUMP_H */ From patchwork Tue Apr 3 12:04: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: 894560 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 40FnvG3558z9s37 for ; Tue, 3 Apr 2018 22:09:14 +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 40FnvG1k8yzF2BT for ; Tue, 3 Apr 2018 22:09:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=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 40FnqQ5xDLzF28T for ; Tue, 3 Apr 2018 22:05:54 +1000 (AEST) 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 w33BxkjV061962 for ; Tue, 3 Apr 2018 08:05:52 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h45mctmve-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:51 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:49 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:46 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5kam5374216; Tue, 3 Apr 2018 12:05:46 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 912AC42047; Tue, 3 Apr 2018 12:57:37 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 37CD142041; Tue, 3 Apr 2018 12:57:36 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:35 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:44 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0044-0000-0000-00000542DE4B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0045-0000-0000-00002882F04E Message-Id: <20180403120447.24364-14-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 13/16] fadump: Add OPAL API to register for fadump 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: , Cc: stewart@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 TODO: - Add documentation for new API call Signed-off-by: Vasant Hegde --- core/opal-dump.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-api.h | 13 +++- 2 files changed, 188 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index dd5544fe8..ebf184902 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -37,6 +37,179 @@ 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)); +} + +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 = %lld)\n", dsize); + return OPAL_PARAMETER; + } + + sec_cnt = be16_to_cpu(fadump->section_count); + if (sec_cnt <= 0) { + prlog(PR_DEBUG, "Invalid section count = %d\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 : %d\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_TRACE, "Registered new entry : src - 0x%llx, " + "dst - 0x%llx, size - 0x%x\n", + mdst->addr, mddt->addr, mdst->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); + break; + case OPAL_FADUMP_UNREGISTER: + opal_fadump_unregister(); + break; + case OPAL_FADUMP_INVALIDATE: + opal_fadump_invalidate(); + 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(void) @@ -167,4 +340,7 @@ void opal_fadump_init(void) ntuple_mdrt = &(spirah.ntuples.mdump_res); adjust_opal_dump_size(); + + /* OPAL interface */ + opal_register(OPAL_FADUMP_MANAGE, opal_fadump_manage, 3); } diff --git a/include/opal-api.h b/include/opal-api.h index 4fb2db27d..b8192fcaf 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -223,7 +223,8 @@ #define OPAL_PCI_GET_PBCQ_TUNNEL_BAR 164 #define OPAL_PCI_SET_PBCQ_TUNNEL_BAR 165 #define OPAL_HANDLE_HMI2 166 -#define OPAL_LAST 166 +#define OPAL_FADUMP_MANAGE 167 +#define OPAL_LAST 167 #define QUIESCE_HOLD 1 /* Spin all calls at entry */ #define QUIESCE_REJECT 2 /* Fail all calls with OPAL_BUSY */ @@ -1333,6 +1334,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 Tue Apr 3 12:04:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 894562 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40FnwK1zg2z9s3M for ; Tue, 3 Apr 2018 22:10:09 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40FnwH1mX6zF28S for ; Tue, 3 Apr 2018 22:10:07 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=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 40FnqY3xYqzF28y for ; Tue, 3 Apr 2018 22:06:01 +1000 (AEST) 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 w33C3a3x046835 for ; Tue, 3 Apr 2018 08:05:59 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h499gg5ac-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:59 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:51 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:49 +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 w33C5mR056426564; Tue, 3 Apr 2018 12:05:48 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 31D6242049; Tue, 3 Apr 2018 12:57:40 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E94E642045; Tue, 3 Apr 2018 12:57:38 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:38 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:45 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0012-0000-0000-000005C674B2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0013-0000-0000-00001942825A Message-Id: <20180403120447.24364-15-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 14/16] fadump: Introduce new reboot type 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: , Cc: stewart@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 | 4 ++++ doc/opal-api/opal-cec-reboot-6-116.rst | 7 +++++++ include/opal-api.h | 1 + 3 files changed, 12 insertions(+) diff --git a/core/platform.c b/core/platform.c index f09ea3c13..0ea7fa1a5 100644 --- a/core/platform.c +++ b/core/platform.c @@ -101,6 +101,10 @@ static int64_t opal_cec_reboot2(uint32_t reboot_type, char *diag) case OPAL_REBOOT_FULL_IPL: disable_fast_reboot("full IPL reboot requested"); return opal_cec_reboot(); + case OPAL_REBOOT_MPIPL: + prlog(PR_ERR, "Kernel requested for fadump\n"); + 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..11cf54aa1 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_MPIPL = 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 b8192fcaf..0cdc47665 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1224,6 +1224,7 @@ enum { OPAL_REBOOT_NORMAL = 0, OPAL_REBOOT_PLATFORM_ERROR, OPAL_REBOOT_FULL_IPL, + OPAL_REBOOT_MPIPL, }; /* Argument to OPAL_PCI_TCE_KILL */ From patchwork Tue Apr 3 12:04:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 894561 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40FnvT5TNhz9s37 for ; Tue, 3 Apr 2018 22:09:25 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40FnvT3yqQzF2Ck for ; Tue, 3 Apr 2018 22:09:25 +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=prvs=0631b20b45=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 40FnqX3nxZzF28h for ; Tue, 3 Apr 2018 22:06:00 +1000 (AEST) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w33C3I2v139363 for ; Tue, 3 Apr 2018 08:05:57 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2h499fr619-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:56 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:54 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:52 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5pa154984850; Tue, 3 Apr 2018 12:05:51 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2098642047; Tue, 3 Apr 2018 12:57:43 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0D9C42042; Tue, 3 Apr 2018 12:57:41 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:41 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:46 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0044-0000-0000-00000542DE52 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0045-0000-0000-00002882F055 Message-Id: <20180403120447.24364-16-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 15/16] dump: Send OPAL relocated base address to SBE 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: , Cc: stewart@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" OPAL relocates itself during boot. During memory preserving IPL hostboot needs to access relocated OPAL. Hence send relocated base address to SBE via 'stash MPIPL config' chip-op. During next IPL SBE will send stashed data to hostboot... so that hostboot can access these data. Signed-off-by: Vasant Hegde --- core/opal-dump.c | 4 ++++ hw/sbe-p9.c | 31 +++++++++++++++++++++++++++++++ include/sbe-p9.h | 6 ++++++ 3 files changed, 41 insertions(+) diff --git a/core/opal-dump.c b/core/opal-dump.c index ebf184902..c7671424a 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -341,6 +342,9 @@ void opal_fadump_init(void) adjust_opal_dump_size(); + /* 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 0da9516f8..e2566bf26 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -756,6 +756,37 @@ 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); + + if (rc == SBE_STATUS_PRI_SUCCESS) { + prlog(PR_DEBUG, "Sent stash MPIPL config"); + } else { + prlog(PR_DEBUG, + "Failed to send stash MPIPL config [rc = 0x%x]\n", rc); + } + + p9_sbe_freemsg(msg); +} + +void p9_sbe_send_relocated_base(uint64_t val) +{ + 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, val, 0); + if (!msg) { + prlog(PR_DEBUG, "Message allocation failed\n"); + return; + } + if (p9_sbe_queue_msg(sbe_default_chip_id, msg, p9_sbe_stash_chipop_resp)) { + prlog(PR_ERR, "Failed to queue stash MPIPL config message\n"); + } +} + void p9_sbe_init(void) { struct dt_node *xn; diff --git a/include/sbe-p9.h b/include/sbe-p9.h index c68894f11..b7ca8dba8 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 */ @@ -236,4 +239,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 val); + #endif /* __SBE_P9_H */ From patchwork Tue Apr 3 12:04:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 894563 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40FnwY1v6mz9s37 for ; Tue, 3 Apr 2018 22:10:21 +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 40FnwX6S9jzF2FK for ; Tue, 3 Apr 2018 22:10:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=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 40FnqY3xY9zF28t for ; Tue, 3 Apr 2018 22:06:01 +1000 (AEST) 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 w33C3twe084767 for ; Tue, 3 Apr 2018 08:05:59 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h45mctn3b-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:59 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:56 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:54 +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 w33C5s6o52429002; Tue, 3 Apr 2018 12:05:54 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CFA5842042; Tue, 3 Apr 2018 12:57:45 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8B4F642045; Tue, 3 Apr 2018 12:57:44 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:44 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:47 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0012-0000-0000-000005C674B6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0013-0000-0000-00001942825F Message-Id: <20180403120447.24364-17-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , 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 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 16/16] Add support to trigger memory preserving IPL on BMC system 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: , Cc: stewart@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/s1 interrupt to initiate memory preserving IPL. This patch adds support to call s0/s1 interrupt. Flow: - s1 interrupt on slave chip SBE - s0 interrupt on master chip SBE Signed-off-by: Vasant Hegde --- hw/ipmi/ipmi-attn.c | 4 ++++ hw/sbe-p9.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ include/sbe-p9.h | 10 ++++++++++ 3 files changed, 62 insertions(+) diff --git a/hw/ipmi/ipmi-attn.c b/hw/ipmi/ipmi-attn.c index 8ff872c62..15aeace56 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) { + /* On P9 BMC system this will trigger fadump */ + 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 e2566bf26..9c8253b28 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -828,3 +828,51 @@ 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; + struct dt_node *xn; + + if (proc_gen < proc_gen_p9) + 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_S1); + /* Initiate normal reboot */ + if (rc) { + prlog(PR_ERR, "Failed to write S1 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; + } + + while (1) + time_wait_ms(100); +} diff --git a/include/sbe-p9.h b/include/sbe-p9.h index b7ca8dba8..4df799cd5 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 @@ -242,4 +249,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 val); +/* Terminate and trigger MPIPL */ +extern void p9_sbe_terminate(void); + #endif /* __SBE_P9_H */