From patchwork Fri May 4 10:28:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908649 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 40cpCf3JGFz9s3Z for ; Fri, 4 May 2018 20:29:18 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40cpCf0zXkzDqjP for ; Fri, 4 May 2018 20:29:18 +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=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 40cpBs441nzDqhm for ; Fri, 4 May 2018 20:28:37 +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 w44ARItH083936 for ; Fri, 4 May 2018 06:28:34 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hrmvrau1x-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:28:34 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:28:30 +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; Fri, 4 May 2018 11:28:29 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44AST6O21102818; Fri, 4 May 2018 10:28:29 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AF95B11C04C; Fri, 4 May 2018 11:20:01 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 60FD011C050; Fri, 4 May 2018 11:20:00 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:00 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:01 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0044-0000-0000-0000054EEEB4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0045-0000-0000-000028901A91 Message-Id: <20180504102817.11059-2-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040096 Subject: [Skiboot] [PATCH v2 01/17] 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 attention and creates SYSDUMP. Soon we are going to support memory preserving IPL. Hence make below changes to reflect its usage: - fsp-mdst-table.c -> fsp-sysdump.c - fsp-mdst-table.h -> opal-dump.h (This will cater both SYSDUMP and memory preserving IPL). - Rename structure name : dump_mdst_table -> mdst_table This patch does renaming and header file adjustment. No functionality changes. Signed-off-by: Vasant Hegde --- hdata/spira.c | 4 ++-- hw/fsp/Makefile.inc | 2 +- hw/fsp/{fsp-mdst-table.c => fsp-sysdump.c} | 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 20879eea8..8b6fe3e66 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 Fri May 4 10:28:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908650 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cpCv3VGrz9s1d for ; Fri, 4 May 2018 20:29:31 +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 40cpCv1j1XzDqwb for ; Fri, 4 May 2018 20:29:31 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpBv2PDZzDqhm for ; Fri, 4 May 2018 20:28:38 +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 w44AO4UN005742 for ; Fri, 4 May 2018 06:28:35 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hrnmqgba2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:28:35 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:28:33 +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; Fri, 4 May 2018 11:28:32 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ASWYc44433470; Fri, 4 May 2018 10:28:32 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C9FF11C04A; Fri, 4 May 2018 11:20:04 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1B71011C04C; Fri, 4 May 2018 11:20:03 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:02 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:02 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0020-0000-0000-00000418EF2E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0021-0000-0000-000042AE15B9 Message-Id: <20180504102817.11059-3-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040096 Subject: [Skiboot] [PATCH v2 02/17] 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 8b6fe3e66..421396903 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 Fri May 4 10:28:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908651 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cpDD0W77z9s1d for ; Fri, 4 May 2018 20:29:48 +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 40cpDC4r8TzDrS5 for ; Fri, 4 May 2018 20:29:47 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpBx077MzDqkh for ; Fri, 4 May 2018 20:28:40 +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 w44AO6ce065169 for ; Fri, 4 May 2018 06:28:38 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hrjyn0j0m-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:28:38 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:28:36 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 4 May 2018 11:28:35 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ASYku50200670; Fri, 4 May 2018 10:28:34 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 62A1D11C069; Fri, 4 May 2018 11:20:07 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0922711C050; Fri, 4 May 2018 11:20:06 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:05 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:03 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0044-0000-0000-0000054EEEB5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0045-0000-0000-000028901A92 Message-Id: <20180504102817.11059-4-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040096 Subject: [Skiboot] [PATCH v2 03/17] 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 and 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 Fri May 4 10:28:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908660 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 40cpGz3b26z9s1d for ; Fri, 4 May 2018 20:32:11 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40cpGz2FJ0zDqkX for ; Fri, 4 May 2018 20:32: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.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpCZ4HyJzDrLj for ; Fri, 4 May 2018 20:29:14 +1000 (AEST) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w44ATAqb062595 for ; Fri, 4 May 2018 06:29:11 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hrh314k0x-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:11 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:28:39 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 4 May 2018 11:28:38 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ASbAf52428858; Fri, 4 May 2018 10:28:37 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4EA4011C05E; Fri, 4 May 2018 11:20:10 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7FA311C050; Fri, 4 May 2018 11:20:08 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:08 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:04 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0012-0000-0000-000005D1ECF3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0013-0000-0000-0000194F1984 Message-Id: <20180504102817.11059-5-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 04/17] 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 3e30d9b76..98f781cc5 100644 --- a/include/mem-map.h +++ b/include/mem-map.h @@ -49,12 +49,16 @@ */ #define PROCIN_OFF (SPIRA_OFF + 0x800) -/* Initial MDST table like PROCIN, we need fixed addresses, +/* Initial MDST and MDDT tables like PROCIN, we need fixed addresses, * we leave a 2k gap for PROCIN */ #define MDST_TABLE_OFF (SPIRA_OFF + 0x1000) +#define MDST_TABLE_SIZE 0x400 -/* Like MDST, we need fixed address for CPU control header. +#define MDDT_TABLE_OFF (SPIRA_OFF + 0x1400) +#define MDDT_TABLE_SIZE 0x400 + +/* Like MDST and MDDT, we need fixed address for CPU control header. * We leave a 2k gap for MDST. CPU_CTL table is of size ~4k */ #define CPU_CTL_OFF (SPIRA_OFF + 0x1800) diff --git a/skiboot.lds.S b/skiboot.lds.S index 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 Fri May 4 10:28:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908654 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 40cpF76JlMz9s1d for ; Fri, 4 May 2018 20:30:35 +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 40cpF72q9VzDqnn for ; Fri, 4 May 2018 20:30:35 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpCQ4Vf1zDsM4 for ; Fri, 4 May 2018 20:29:06 +1000 (AEST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w44AT2h1116722 for ; Fri, 4 May 2018 06:29:03 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hrkx4e0gw-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:03 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:28:43 +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; Fri, 4 May 2018 11:28:40 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ASeEO58195972; Fri, 4 May 2018 10:28:40 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1286011C058; Fri, 4 May 2018 11:20:13 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A521D11C054; Fri, 4 May 2018 11:20:11 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:11 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:05 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0044-0000-0000-0000054EEEB9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0045-0000-0000-000028901A96 Message-Id: <20180504102817.11059-6-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 05/17] 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 98f781cc5..6a1de3dff 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 Fri May 4 10:28:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908663 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cpHy0KKCz9s1d for ; Fri, 4 May 2018 20:33:02 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40cpHx5z3GzDr4X for ; Fri, 4 May 2018 20:33:01 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpCj6b7hzDrcY for ; Fri, 4 May 2018 20:29:21 +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 w44ATI8L075858 for ; Fri, 4 May 2018 06:29:19 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hrh31u6yf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:18 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:28:45 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 4 May 2018 11:28:43 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ASh4E8126802; Fri, 4 May 2018 10:28:43 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D115311C054; Fri, 4 May 2018 11:20:15 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5FCFC11C052; Fri, 4 May 2018 11:20:14 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:14 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:06 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0012-0000-0000-000005D1ECF5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0013-0000-0000-0000194F1987 Message-Id: <20180504102817.11059-7-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 06/17] fadump: Define destination memory for OPAL 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 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/mem-map.h b/include/mem-map.h index 6a1de3dff..dcc279891 100644 --- a/include/mem-map.h +++ b/include/mem-map.h @@ -127,6 +127,20 @@ */ #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) +/* Collect OPAL core including Max possible CPU stack data */ +#define FADUMP_DEST_SKIBOOT_SIZE (FADUMP_DEST_CON_LOG - SKIBOOT_BASE) + /* * Address at which we load the kernel LID. This is also where * we expect a passed-in kernel if booting without FSP and From patchwork Fri May 4 10:28:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908656 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 40cpFt1LrPz9s1d for ; Fri, 4 May 2018 20:31: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 40cpFs4N1nzDqwb for ; Fri, 4 May 2018 20:31:13 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpCR3LgBzDqw8 for ; Fri, 4 May 2018 20:29:07 +1000 (AEST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w44AT2lC116697 for ; Fri, 4 May 2018 06:29:03 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hrkx4e0j3-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:03 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:28:47 +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; Fri, 4 May 2018 11:28:46 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ASjVB11534750; Fri, 4 May 2018 10:28:45 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79AA111C054; Fri, 4 May 2018 11:20:18 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 32ABC11C04C; Fri, 4 May 2018 11:20:17 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:17 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:07 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0040-0000-0000-00000435F06F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0041-0000-0000-0000263A18A4 Message-Id: <20180504102817.11059-8-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 07/17] 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 421396903..4e3e2928a 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -89,7 +89,7 @@ __section(".cpuctrl.data") struct cpu_ctl_init_data cpu_ctl_init_data = { * addresses, we set the top bit to 1 on physical addresses */ -__section(".mdst.data") struct mdst_table init_mdst_table[2] = { +__section(".mdst.data") struct mdst_table init_mdst_table[3] = { { .addr = CPU_TO_BE64(INMEM_CON_START | HRMOR_BIT), .data_region = DUMP_REGION_CONSOLE, @@ -102,6 +102,30 @@ __section(".mdst.data") struct mdst_table init_mdst_table[2] = { .dump_type = DUMP_TYPE_SYSDUMP, .size = CPU_TO_BE32(HBRT_CON_LEN), }, + { + .addr = CPU_TO_BE64(SKIBOOT_BASE | HRMOR_BIT), + .data_region = DUMP_REGION_OPAL_MEMORY, + .dump_type = DUMP_TYPE_FADUMP, + .size = CPU_TO_BE32(FADUMP_DEST_SKIBOOT_SIZE), + }, +}; + +__section(".mddt.data") struct mddt_table init_mddt_table[3] = { + { + .addr = CPU_TO_BE64(FADUMP_DEST_CON_LOG | HRMOR_BIT), + .data_region = DUMP_REGION_CONSOLE, + .size = CPU_TO_BE32(FADUMP_DEST_CON_SIZE), + }, + { + .addr = CPU_TO_BE64(FADUMP_DEST_HBRT_LOG | HRMOR_BIT), + .data_region = DUMP_REGION_HBRT_LOG, + .size = CPU_TO_BE32(FADUMP_DEST_HBRT_SIZE), + }, + { + .addr = CPU_TO_BE64(FADUMP_DEST_SKIBOOT_BASE | HRMOR_BIT), + .data_region = DUMP_REGION_OPAL_MEMORY, + .size = CPU_TO_BE32(FADUMP_DEST_SKIBOOT_SIZE), + }, }; /* SP Interface Root Array, aka SPIRA */ @@ -187,10 +211,32 @@ __section(".spirah.data") struct spirah spirah = { #endif .mdump_src = { .addr = CPU_TO_BE64(MDST_TABLE_OFF), - .alloc_cnt = CPU_TO_BE16(ARRAY_SIZE(init_mdst_table)), + .alloc_cnt = CPU_TO_BE16(MDST_TABLE_SIZE / sizeof(struct mdst_table)), .act_cnt = CPU_TO_BE16(ARRAY_SIZE(init_mdst_table)), - .alloc_len = - CPU_TO_BE32(sizeof(init_mdst_table)), + .alloc_len = CPU_TO_BE32(sizeof(struct mdst_table)), + .act_len = CPU_TO_BE32(sizeof(struct mdst_table)), + }, + .mdump_dst = { + .addr = CPU_TO_BE64(MDDT_TABLE_OFF), + .alloc_cnt = CPU_TO_BE16(MDDT_TABLE_SIZE / sizeof(struct mddt_table)), + .act_cnt = CPU_TO_BE16(ARRAY_SIZE(init_mddt_table)), + .alloc_len = CPU_TO_BE32(sizeof(struct mddt_table)), + .act_len = CPU_TO_BE32(sizeof(struct mddt_table)), + }, + .mdump_res = { + .addr = CPU_TO_BE64(MDRT_TABLE_BASE), + .alloc_cnt = + CPU_TO_BE16(MDRT_TABLE_SIZE / sizeof(struct mdrt_table)), + /* + * XXX: Ideally hostboot should use allocated count and + * length. But looks like hostboot uses actual count + * and length get MDRT table size. And post dump + * hostboot will update actu_cnt. + */ + .act_cnt = + CPU_TO_BE16(MDRT_TABLE_SIZE / sizeof(struct mdrt_table)), + .alloc_len = CPU_TO_BE32(sizeof(struct mdrt_table)), + .act_len = CPU_TO_BE32(sizeof(struct mdrt_table)), }, }, }; diff --git a/hdata/test/hdata_to_dt.c b/hdata/test/hdata_to_dt.c index 8c61b4f62..46e755a66 100644 --- a/hdata/test/hdata_to_dt.c +++ b/hdata/test/hdata_to_dt.c @@ -77,6 +77,7 @@ unsigned long tb_hz = 512000000; #define PVR_P9 0x004e0200 #define SPR_PVR 0x11f /* RO: Processor version register */ +#define SPR_PIR_P9_MASK 0x7fff /* Mask of implemented bits */ #define __CPU_H struct cpu_thread { diff --git a/include/opal-dump.h b/include/opal-dump.h index 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 Fri May 4 10:28:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cpG91bF3z9s1d for ; Fri, 4 May 2018 20:31:29 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40cpG90HMYzDr3y for ; Fri, 4 May 2018 20:31:29 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpCT6Vv9zDr4q for ; Fri, 4 May 2018 20:29:09 +1000 (AEST) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w44AT5eO042865 for ; Fri, 4 May 2018 06:29:07 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hrkq4ppdx-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:06 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:28:50 +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; Fri, 4 May 2018 11:28:48 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ASmCV64487556; Fri, 4 May 2018 10:28:48 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02E4A11C04A; Fri, 4 May 2018 11:20:21 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C931D11C050; Fri, 4 May 2018 11:20:19 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:19 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:08 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0008-0000-0000-000004F2EF41 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0009-0000-0000-00001E871BB3 Message-Id: <20180504102817.11059-9-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 08/17] 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 in SPIRAH 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 4e3e2928a..1c9a9681a 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "hdata.h" #include "hostservices.h" @@ -1703,12 +1704,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 Fri May 4 10:28:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908659 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cpGs5RFzz9s1d for ; Fri, 4 May 2018 20:32:05 +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 40cpGs41rwzDqlJ for ; Fri, 4 May 2018 20:32:05 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpCX3R3jzDrLj for ; Fri, 4 May 2018 20:29:12 +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 w44AT5Sa020271 for ; Fri, 4 May 2018 06:29:09 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hrnmqgbjk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:07 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:28:53 +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; Fri, 4 May 2018 11:28:51 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ASoPx10420558; Fri, 4 May 2018 10:28:50 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 904AA11C054; Fri, 4 May 2018 11:20:23 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 50DC711C050; Fri, 4 May 2018 11:20:22 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:22 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:09 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0040-0000-0000-00000435F070 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0041-0000-0000-0000263A18A5 Message-Id: <20180504102817.11059-10-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 09/17] 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 09c77c18e..e30963909 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1311,6 +1311,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 structure. + * And passes this to payload via device tree. + */ +struct fadump_section { + u8 source_type; /* FADUMP_REGION_* */ + u8 reserved[7]; + u64 source_addr; + u64 source_size; + u64 dest_addr; + u64 dest_size; +} __packed; + +struct fadump { + u16 fadump_section_size; /* sizeof(struct fadump_section) */ + u16 section_count; + u32 reserved; + struct fadump_section section[]; +}; + #endif /* __ASSEMBLY__ */ #endif /* __OPAL_API_H */ From patchwork Fri May 4 10:28:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908652 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 40cpDZ2S24z9s1d for ; Fri, 4 May 2018 20:30:06 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40cpDZ14d8zDqvV for ; Fri, 4 May 2018 20:30:06 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpCK1Z9JzDsNM for ; Fri, 4 May 2018 20:29:00 +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 w44ASmBW079055 for ; Fri, 4 May 2018 06:28:58 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hrjyn0jdm-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:28:58 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:28:56 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 4 May 2018 11:28:54 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ASr2i459056; Fri, 4 May 2018 10:28:53 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 49CC211C052; Fri, 4 May 2018 11:20:26 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E744B11C050; Fri, 4 May 2018 11:20:24 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:24 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:10 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0040-0000-0000-00000435F072 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0041-0000-0000-0000263A18A7 Message-Id: <20180504102817.11059-11-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 10/17] 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 1c9a9681a..565579aae 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1119,6 +1119,25 @@ static void add_iplparams_sys_params(const void *iplp, struct dt_node *node) dt_init_secureboot_node(p); } +static void fadump_add_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; @@ -1167,6 +1186,9 @@ static void add_iplparams_ipl_params(const void *iplp, struct dt_node *node) else dt_add_property_strings(led_node, DT_PROPERTY_LED_MODE, LED_MODE_GUIDING_LIGHT); + + /* Populate fadump node */ + fadump_add_node(p); } static void add_iplparams_serials(const void *iplp, struct dt_node *node) From patchwork Fri May 4 10:28:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908653 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 40cpDt6N2Dz9s3G for ; Fri, 4 May 2018 20:30:22 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40cpDt4TS5zDqjk for ; Fri, 4 May 2018 20:30: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.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpCL0mfzzDsNM for ; Fri, 4 May 2018 20:29: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 w44ASpjg088569 for ; Fri, 4 May 2018 06:29:00 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hrmvrauj1-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:00 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:28:57 +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; Fri, 4 May 2018 11:28:56 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ASuTG8257808; Fri, 4 May 2018 10:28:56 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0440E11C050; Fri, 4 May 2018 11:20:29 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A0E1A11C054; Fri, 4 May 2018 11:20:27 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:27 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:11 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0040-0000-0000-00000454EFCE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0041-0000-0000-000020F91BD5 Message-Id: <20180504102817.11059-12-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 11/17] 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" During MPIPL hostboot updates MDRT table with details of memory movement (source, destination address, size, etc). Convert these details to fadump structure format and pass it to kernel via 'result-table' property. Device tree property: /ibm,dump/result-table - follows fadump structure format Signed-off-by: Vasant Hegde --- hdata/spira.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- hdata/spira.h | 4 +++ 2 files changed, 82 insertions(+), 1 deletion(-) diff --git a/hdata/spira.c b/hdata/spira.c index 565579aae..00bfa87a5 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "hdata.h" #include "hostservices.h" @@ -1119,7 +1121,80 @@ static void add_iplparams_sys_params(const void *iplp, struct dt_node *node) dt_init_secureboot_node(p); } -static void fadump_add_node(const struct iplparams_iplparams *p __unused) +static void fadump_add_result_table(struct dt_node *node, + const struct iplparams_iplparams *p) +{ + int i, j = 0; + u32 mdrt_cnt = spira.ntuples.mdump_res.act_cnt; + u32 mdrt_max_cnt = MDRT_TABLE_SIZE / sizeof(struct mdrt_table); + size_t prop_size; + struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE); + struct fadump_section *fadump_section; + struct fadump *result_table; + + /* Check boot params to detect MPIPL boot or not */ + if (p->cec_ipl_maj_type != IPLPARAMS_MAJ_TYPE_REIPL) + return; + if (p->cec_ipl_min_type != IPLPARAMS_MIN_TYPE_POST_DUMP && + p->cec_ipl_min_type != IPLPARAMS_MIN_TYPE_PLAT_REBOOT) + return; + if (p->cec_ipl_attrib != IPLPARAMS_ATTRIB_MEM_PRESERVE) + return; + + if (mdrt_cnt == 0 || mdrt_cnt == mdrt_max_cnt) { + prlog(PR_ERR, "FADUMP: Invalid MDRT count : %x\n", mdrt_cnt); + return; + } + + prlog(PR_DEBUG, "FADUMP: Dump found, MDRT count = 0x%x\n", mdrt_cnt); + + /* 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; + } + + if (mdrt->dump_type != DUMP_TYPE_FADUMP) { + mdrt++; + continue; + } + + fadump_section = &(result_table->section[j++]); + fadump_section->source_type = mdrt->data_region; + /* Clear top bit */ + fadump_section->source_addr = mdrt->src_addr & ~(HRMOR_BIT); + fadump_section->dest_addr = mdrt->dest_addr & ~(HRMOR_BIT); + fadump_section->source_size = mdrt->size; + fadump_section->dest_size = mdrt->size; + mdrt++; + } + + if (j == 0) { + prlog(PR_DEBUG, "FADUMP: MDRT table is empty\n"); + free(result_table); + return; + } + + result_table->section_count = j; + /* Actual property size */ + prop_size = sizeof(struct fadump) + (j * sizeof(struct fadump_section)); + dt_add_property(node, "result-table", result_table, prop_size); + free(result_table); +} + +static void fadump_add_node(const struct iplparams_iplparams *p) { u64 fw_load_area[4]; struct dt_node *node; @@ -1136,6 +1211,8 @@ static void fadump_add_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)); + + fadump_add_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..46d7c70c8 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -399,8 +399,12 @@ struct iplparams_iplparams { #define IPLPARAMS_FSP_FW_IPL_SIDE_TEMP 0x01 uint8_t ipl_speed; __be16 cec_ipl_attrib; +#define IPLPARAMS_ATTRIB_MEM_PRESERVE PPC_BIT16(2) uint8_t cec_ipl_maj_type; +#define IPLPARAMS_MAJ_TYPE_REIPL 0x1 uint8_t cec_ipl_min_type; +#define IPLPARAMS_MIN_TYPE_POST_DUMP 0xc +#define IPLPARAMS_MIN_TYPE_PLAT_REBOOT 0xd uint8_t os_ipl_mode; uint8_t keylock_pos; uint8_t lmb_size; From patchwork Fri May 4 10:28:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908655 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cpFl6DJYz9s1d for ; Fri, 4 May 2018 20:31:07 +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 40cpFl4rC1zDr4q for ; Fri, 4 May 2018 20:31: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.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpCR0lyxzDsPd for ; Fri, 4 May 2018 20:29:06 +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 w44AT2di059711 for ; Fri, 4 May 2018 06:29:04 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hrmvrjr14-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:03 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:29:01 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 4 May 2018 11:28:59 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ASxhw41156856; Fri, 4 May 2018 10:28:59 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA79911C05C; Fri, 4 May 2018 11:20:31 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 59C3811C050; Fri, 4 May 2018 11:20:30 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:30 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:12 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0040-0000-0000-00000435F073 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0041-0000-0000-0000263A18A8 Message-Id: <20180504102817.11059-13-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 12/17] hdata: Add architected register support 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" Post MPIPL FSP/hostboot passes architected register data via HDAT. Add support get architected register data from HDAT and pass it to kernel. Kernel will use this data to generate vmcore and opalcore. This patch moves 'proc_dump_area' ntuple from SPIRAH to SPIRAS..as HDAT provides 'proc_dump_area' under SPIRAS. Device tree properties under /ibm,dump node: cpu-data-version - Architected register data format version cpu-data-size - Each CPU register data size result-table - Add entry for architected register Based on cpu-data-size and result-table, kernel will be able to get data for indivisual CPU/register. Signed-off-by: Vasant Hegde --- hdata/spira.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- hdata/spira.h | 20 +++++++++++++++----- 2 files changed, 65 insertions(+), 7 deletions(-) diff --git a/hdata/spira.c b/hdata/spira.c index 00bfa87a5..aa2733762 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -1121,6 +1121,47 @@ static void add_iplparams_sys_params(const void *iplp, struct dt_node *node) dt_init_secureboot_node(p); } +/* Map architected register data from HDAT memory to result-table */ +static int fadump_add_arch_regs(struct dt_node *node, + struct fadump *result_table, int *res_cnt) +{ + u64 size, *addr; + const struct HDIF_common_hdr *reg_hdif; + const struct HDIF_array_hdr *reg_data; + struct fadump_section *fadump_section; + + reg_hdif = get_hdif(&spira.ntuples.proc_dump_area, PROC_DUMP_HDIF_SIG); + if (!reg_hdif) { + prlog(PR_ERR, "FADUMP: Architected register is missing\n"); + return OPAL_HARDWARE; + } + + reg_data = HDIF_get_idata(reg_hdif, PROC_DUMP_ARCH_REG_DATA, NULL); + if (!CHECK_SPPTR(reg_data)) { + prlog(PR_ERR, "FADUMP: Invalid architected register data\n"); + return OPAL_HARDWARE; + } + + /* Add each thread size */ + dt_add_property_cells(node, "cpu-data-size", + be32_to_cpu(reg_data->eactsz)); + prlog(PR_TRACE, "FADUMP: Architected regs : thread count = %x, " + "size of each thread = %x\n", + be32_to_cpu(reg_data->ecnt), be32_to_cpu(reg_data->eactsz)); + + size = be32_to_cpu(reg_data->ecnt) * be32_to_cpu(reg_data->eactsz); + addr = (void *)reg_data + be32_to_cpu(reg_data->offset); + + fadump_section = &(result_table->section[*res_cnt]); + fadump_section->source_type = DUMP_REGION_CPU_DATA; + fadump_section->source_addr = (u64)addr; + fadump_section->dest_addr = (u64)addr; + fadump_section->source_size = size; + fadump_section->dest_size = size; + (*res_cnt)++; + return OPAL_SUCCESS; +} + static void fadump_add_result_table(struct dt_node *node, const struct iplparams_iplparams *p) { @@ -1148,9 +1189,9 @@ static void fadump_add_result_table(struct dt_node *node, prlog(PR_DEBUG, "FADUMP: Dump found, MDRT count = 0x%x\n", mdrt_cnt); - /* Number of entries in MDRT table */ + /* Number of entries in MDRT table + 1 for arch register data */ prop_size = sizeof(struct fadump) + - (mdrt_cnt * sizeof(struct fadump_section)); + ((mdrt_cnt + 1) * sizeof(struct fadump_section)); result_table = zalloc(prop_size); if (!result_table) { prlog(PR_ERR, "FADUMP: Failed to allocate memory\n"); @@ -1187,6 +1228,9 @@ static void fadump_add_result_table(struct dt_node *node, return; } + /* Add architected register data to result-table */ + fadump_add_arch_regs(node, result_table, &j); + result_table->section_count = j; /* Actual property size */ prop_size = sizeof(struct fadump) + (j * sizeof(struct fadump_section)); @@ -1212,6 +1256,9 @@ static void fadump_add_node(const struct iplparams_iplparams *p) fw_load_area[3] = INITRAMFS_LOAD_SIZE; dt_add_property(node, "fw-load-area", fw_load_area, sizeof(fw_load_area)); + /* Architected register data format version */ + dt_add_property_cells(node, "cpu-data-version", PROC_DUMP_ARCH_REG_VER); + fadump_add_result_table(node, p); } @@ -1801,6 +1848,7 @@ static void fixup_spira(void) spira.ntuples.hs_data = spiras->ntuples.hs_data; spira.ntuples.ipmi_sensor = spiras->ntuples.ipmi_sensor; spira.ntuples.node_stb_data = spiras->ntuples.node_stb_data; + spira.ntuples.proc_dump_area = spiras->ntuples.proc_dump_area; } /* diff --git a/hdata/spira.h b/hdata/spira.h index 46d7c70c8..e0766fd49 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -76,6 +76,7 @@ struct spira_ntuples { struct spira_ntuple hs_data; /* 0x320 */ struct spira_ntuple ipmi_sensor; /* 0x360 */ struct spira_ntuple node_stb_data; /* 0x380 */ + struct spira_ntuple proc_dump_area; /* 0x3a0 */ }; struct spira { @@ -89,7 +90,7 @@ struct spira { * * According to FSP engineers, this is an okay thing to do. */ - u8 reserved[0x80]; + u8 reserved[0x40]; } __packed __align(0x100); extern struct spira spira; @@ -111,7 +112,6 @@ struct spirah_ntuples { struct spira_ntuple mdump_src; /* 0x0a0 */ struct spira_ntuple mdump_dst; /* 0x0c0 */ struct spira_ntuple mdump_res; /* 0x0e0 */ - struct spira_ntuple proc_dump_area; /* 0x100 */ }; struct spirah { @@ -119,7 +119,7 @@ struct spirah { struct HDIF_idata_ptr ntuples_ptr; __be64 pad; struct spirah_ntuples ntuples; - u8 reserved[0xE0]; + u8 reserved[0x100]; } __packed __align(0x100); extern struct spirah spirah; @@ -132,7 +132,7 @@ extern struct spirah spirah; #define SPIRAS_VERSION_P9 0x50 /* N-tuples in SPIRAS */ -#define SPIRAS_NTUPLES_COUNT 0x10 +#define SPIRAS_NTUPLES_COUNT 0x13 struct spiras_ntuples { struct HDIF_array_hdr array_hdr; /* 0x030 */ @@ -154,6 +154,7 @@ struct spiras_ntuples { struct spira_ntuple hbrt_data; /* 0x220 */ struct spira_ntuple ipmi_sensor; /* 0x240 */ struct spira_ntuple node_stb_data; /* 0x260 */ + struct spira_ntuple proc_dump_area; /* 0x280 */ }; struct spiras { @@ -161,7 +162,7 @@ struct spiras { struct HDIF_idata_ptr ntuples_ptr; __be64 pad; struct spiras_ntuples ntuples; - u8 reserved[0x180]; + u8 reserved[0x160]; } __packed __align(0x100); extern struct spiras *spiras; @@ -1291,6 +1292,15 @@ struct hash_and_verification { __be32 offset; } __packed; + +/* Processor dump area. Used by MPIPL boot to get architected register data */ +#define PROC_DUMP_HDIF_SIG "ARCREG" + +/* Idata index 0 : Architected register data area */ +#define PROC_DUMP_ARCH_REG_DATA 0 + +#define PROC_DUMP_ARCH_REG_VER 0x10 /* P9 format */ + static inline const char *cpu_state(u32 flags) { switch ((flags & CPU_ID_VERIFY_MASK) >> CPU_ID_VERIFY_SHIFT) { From patchwork Fri May 4 10:28:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908665 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cpJQ0qJyz9s1d for ; Fri, 4 May 2018 20:33:26 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40cpJP5sHFzDqw8 for ; Fri, 4 May 2018 20:33: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.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpD10gDRzDqjP for ; Fri, 4 May 2018 20:29:36 +1000 (AEST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w44ATW9x102696 for ; Fri, 4 May 2018 06:29:34 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hrm0gx8vf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:33 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:29:04 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 4 May 2018 11:29:02 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44AT18M27394248; Fri, 4 May 2018 10:29:01 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 86C9211C050; Fri, 4 May 2018 11:20:34 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EEFEF11C058; Fri, 4 May 2018 11:20:32 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:32 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:13 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0008-0000-0000-000004F2EF44 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0009-0000-0000-00001E871BB9 Message-Id: <20180504102817.11059-14-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=4 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 13/17] 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 details to create ELF notes. This patch also adjusts MDST and MDDT entry for OPAL dump. Now OPAL dump size reflects runtime size of OPAL. Finally add reserve node for opal dump destination memory. If dump is available then reserve node size is max of current dump destination size and memory reserved for next dump. Signed-off-by: Vasant Hegde --- core/Makefile.inc | 2 +- core/init.c | 4 ++ core/opal-dump.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-dump.h | 3 + 4 files changed, 177 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 3b887a24d..3552af383 100644 --- a/core/init.c +++ b/core/init.c @@ -52,6 +52,7 @@ #include #include #include +#include enum proc_gen proc_gen; unsigned int pcie_max_link_speed; @@ -1036,6 +1037,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..51e5b0d0b --- /dev/null +++ b/core/opal-dump.c @@ -0,0 +1,169 @@ +/* Copyright 2018 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define pr_fmt(fmt) "FADUMP: " fmt + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "hdata/spira.h" + +/* Actual address of MDST and MDDT table */ +#define MDST_TABLE_BASE (SKIBOOT_BASE + MDST_TABLE_OFF) +#define MDDT_TABLE_BASE (SKIBOOT_BASE + MDDT_TABLE_OFF) + +static struct spira_ntuple *ntuple_mdst; +static struct spira_ntuple *ntuple_mddt; +static struct spira_ntuple *ntuple_mdrt; + + +/* Reserve OPAL dump destination memory */ +static void add_fadump_reserve_node(struct dt_node *dump_node) +{ + int i; + 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 */ + if (dt_find_property(dump_node, "result-table")) { + for (i = 0; i < ntuple_mdrt->act_cnt; i++) { + if (mdrt->data_region >= DUMP_REGION_OPAL_START && + mdrt->data_region < DUMP_REGION_OPAL_END) + cur_size += be32_to_cpu(mdrt->size); + + mdrt++; + } + } + + /* Get new OPAL dump reservation size */ + for (i = 0; i < ntuple_mddt->act_cnt; i++) { + if (mddt->data_region >= DUMP_REGION_OPAL_START && + mddt->data_region < DUMP_REGION_OPAL_END) + new_size += be32_to_cpu(mddt->size); + + mddt++; + } + + mem_reserve_fw("ibm,firmware-dump", (u64)FADUMP_DEST_CON_LOG, + new_size > cur_size ? new_size : cur_size); +} + +/* Pass OPAL dump reservation details to payload via device tree. */ +static void dt_add_fadump_source_table(struct dt_node *dump_node, + struct mdst_table *mdst, + struct mddt_table *mddt) +{ + size_t prop_size; + struct fadump *source_table; + + if (mdst->data_region != DUMP_REGION_OPAL_MEMORY || + mddt->data_region != DUMP_REGION_OPAL_MEMORY) + return; + + prop_size = sizeof(struct fadump) + sizeof(struct fadump_section); + source_table = zalloc(prop_size); + if (!source_table) { + prlog(PR_ERR, "Failed to allocate memory\n"); + return; + } + + source_table->fadump_section_size = sizeof(struct fadump_section); + source_table->section_count = 1; + source_table->section[0].source_type = mdst->data_region; + source_table->section[0].source_addr = mdst->addr & ~(HRMOR_BIT); + source_table->section[0].source_size = mdst->size; + source_table->section[0].dest_addr = mddt->addr & ~(HRMOR_BIT); + source_table->section[0].dest_size = mddt->size; + + dt_add_property(dump_node, "fw-source-table", source_table, prop_size); + free(source_table); +} + +/* + * OPAL adjusts runtime OPAL size based on number of CPUs and PIR value. + * Hardcoded dump entry in MDST and MDDT table contains maximum size required + * to capture OPAL dump (so that we can capture early OPAL dump). Hence + * adjust OPAL dump entry in MDST and MDDT to reflect OPAL runtime size. + */ +static void adjust_opal_dump_size(struct dt_node *dump_node) +{ + int i; + u64 opal_size; + /* Use relocated memory address */ + struct mdst_table *mdst = (void *)(MDST_TABLE_BASE); + struct mddt_table *mddt = (void *)(MDDT_TABLE_BASE); + + /* Get OPAL runtime size */ + if (!dt_find_property(opal_node, "opal-runtime-size")) + return; + opal_size = dt_prop_get_u64(opal_node, "opal-runtime-size"); + + /* Safe to assume MDST, MDDT table contains entry for OPAL dump + * (see hdata/spira.c) + */ + for (i = 0; i < ntuple_mdst->act_cnt; i++) { + if (mdst->data_region != DUMP_REGION_OPAL_MEMORY) { + mdst++; + continue; + } + mdst->size = opal_size; + break; + } + + for (i = 0; i < ntuple_mddt->act_cnt; i++) { + if (mddt->data_region != DUMP_REGION_OPAL_MEMORY) { + mddt++; + continue; + } + mddt->size = opal_size; + break; + } + + /* Add OPAL dump reservation details to DT */ + dt_add_fadump_source_table(dump_node, mdst, mddt); + /* Make sure OPAL dump destination memory is reserved */ + add_fadump_reserve_node(dump_node); +} + +void opal_fadump_init(void) +{ + struct dt_node *dump_node; + + if (proc_gen < proc_gen_p9) + return; + + /* fadump needs HDAT support */ + dump_node = dt_find_by_path(dt_root, "ibm,dump"); + if (!dump_node) + return; + + /* Get MDST and MDDT ntuple from SPIRAH */ + ntuple_mdst = &(spirah.ntuples.mdump_src); + ntuple_mddt = &(spirah.ntuples.mdump_dst); + ntuple_mdrt = &(spirah.ntuples.mdump_res); + + adjust_opal_dump_size(dump_node); +} diff --git a/include/opal-dump.h b/include/opal-dump.h index 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 Fri May 4 10:28:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908658 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cpGN3yWhz9s1d for ; Fri, 4 May 2018 20:31:40 +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 40cpGN2jQCzDqnn for ; Fri, 4 May 2018 20:31:40 +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=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 40cpCW48PmzDqws for ; Fri, 4 May 2018 20:29:11 +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 w44ASnPA115700 for ; Fri, 4 May 2018 06:29:08 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hrjbcag81-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:08 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:29:06 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 4 May 2018 11:29:05 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44AT4iq2294196; Fri, 4 May 2018 10:29:04 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 42E9211C04A; Fri, 4 May 2018 11:20:37 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DC56411C052; Fri, 4 May 2018 11:20:35 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:35 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:14 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0020-0000-0000-00000418EF39 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0021-0000-0000-000042AE15C6 Message-Id: <20180504102817.11059-15-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 14/17] 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 Signed-off-by: Vasant Hegde --- core/opal-dump.c | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++++ include/opal-api.h | 13 +++- 2 files changed, 193 insertions(+), 1 deletion(-) diff --git a/core/opal-dump.c b/core/opal-dump.c index 51e5b0d0b..16def2a05 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -37,6 +37,184 @@ 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); + if (rc == OPAL_SUCCESS) + prlog(PR_NOTICE, "Payload registered for dump\n"); + break; + case OPAL_FADUMP_UNREGISTER: + opal_fadump_unregister(); + prlog(PR_NOTICE, "Payload unregistered for dump\n"); + break; + case OPAL_FADUMP_INVALIDATE: + opal_fadump_invalidate(); + prlog(PR_NOTICE, "Payload Invalidated dump\n"); + break; + default: + prlog(PR_DEBUG, "Unsupported command : 0x%llx\n", cmd); + rc = OPAL_PARAMETER; + break; + } + + return rc; +} /* Reserve OPAL dump destination memory */ static void add_fadump_reserve_node(struct dt_node *dump_node) @@ -166,4 +344,7 @@ void opal_fadump_init(void) ntuple_mdrt = &(spirah.ntuples.mdump_res); adjust_opal_dump_size(dump_node); + + /* OPAL interface */ + opal_register(OPAL_FADUMP_MANAGE, opal_fadump_manage, 3); } diff --git a/include/opal-api.h b/include/opal-api.h index e30963909..58c826e34 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 */ @@ -1341,6 +1342,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 Fri May 4 10:28:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908661 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 40cpHD350Gz9s1d for ; Fri, 4 May 2018 20:32: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 40cpHD1gKgzDrK5 for ; Fri, 4 May 2018 20:32: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=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 40cpCZ2KSNzDr4q for ; Fri, 4 May 2018 20:29:14 +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 w44AT2m0059756 for ; Fri, 4 May 2018 06:29:11 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hrmvrjr4t-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:10 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:29:08 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 4 May 2018 11:29:07 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44AT7Lp7012848; Fri, 4 May 2018 10:29:07 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D55311C04C; Fri, 4 May 2018 11:20:40 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 986CF11C050; Fri, 4 May 2018 11:20:38 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:38 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:15 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0040-0000-0000-00000454EFD0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0041-0000-0000-000020F91BD7 Message-Id: <20180504102817.11059-16-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 15/17] 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 58c826e34..250549566 100644 --- a/include/opal-api.h +++ b/include/opal-api.h @@ -1232,6 +1232,7 @@ enum { OPAL_REBOOT_NORMAL = 0, OPAL_REBOOT_PLATFORM_ERROR, OPAL_REBOOT_FULL_IPL, + OPAL_REBOOT_MPIPL, }; /* Argument to OPAL_PCI_TCE_KILL */ From patchwork Fri May 4 10:28:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908664 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cpJ61HmHz9s1d for ; Fri, 4 May 2018 20:33:10 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40cpJ56q0rzDqhm for ; Fri, 4 May 2018 20:33: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=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 40cpCr4p9wzDqhm for ; Fri, 4 May 2018 20:29:28 +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 w44ATFD3075747 for ; Fri, 4 May 2018 06:29:26 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hrh31u79x-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:25 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:29:11 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 4 May 2018 11:29:10 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ATA7D6553926; Fri, 4 May 2018 10:29:10 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B3A6A11C058; Fri, 4 May 2018 11:20:42 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5324C11C050; Fri, 4 May 2018 11:20:41 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:41 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:16 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0044-0000-0000-0000054EEEBF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0045-0000-0000-000028901A9C Message-Id: <20180504102817.11059-17-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 16/17] fadump: 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 16def2a05..1343bfe44 100644 --- a/core/opal-dump.c +++ b/core/opal-dump.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -345,6 +346,9 @@ void opal_fadump_init(void) adjust_opal_dump_size(dump_node); + /* Send OPAL relocated base address to SBE */ + p9_sbe_send_relocated_base(SKIBOOT_BASE); + /* OPAL interface */ opal_register(OPAL_FADUMP_MANAGE, opal_fadump_manage, 3); } diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index d52ada15a..12d9e97ff 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -861,6 +861,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\n"); + } 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 4b839d8ba..7101dc700 100644 --- a/include/sbe-p9.h +++ b/include/sbe-p9.h @@ -159,6 +159,9 @@ #define CONTROL_TIMER_START 0x0001 #define CONTROL_TIMER_STOP 0x0002 +/* Stash MPIPL config */ +#define SBE_STASH_KEY_SKIBOOT_BASE 0x03 + /* SBE message state */ enum p9_sbe_msg_state { sbe_msg_unused = 0, /* Free */ @@ -237,4 +240,7 @@ extern bool p9_sbe_timer_ok(void); /* Update SBE timer expiry */ extern void p9_sbe_update_timer_expiry(uint64_t new_target); +/* Send skiboot relocated base address to SBE */ +extern void p9_sbe_send_relocated_base(uint64_t val); + #endif /* __SBE_P9_H */ From patchwork Fri May 4 10:28:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 908662 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40cpHR576Kz9s1d for ; Fri, 4 May 2018 20:32:35 +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 40cpHR3jN6zDqkh for ; Fri, 4 May 2018 20:32:35 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40cpCg0z53zDrDT for ; Fri, 4 May 2018 20:29:18 +1000 (AEST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w44AT2m5116668 for ; Fri, 4 May 2018 06:29:16 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hrkx4e0xy-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 04 May 2018 06:29:16 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 4 May 2018 11:29:14 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 4 May 2018 11:29:13 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w44ATCsB3735970; Fri, 4 May 2018 10:29:12 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2BAA011C050; Fri, 4 May 2018 11:20:45 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D90211C05C; Fri, 4 May 2018 11:20:44 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.199.177.123]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 4 May 2018 11:20:43 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Fri, 4 May 2018 15:58:17 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> References: <20180504102817.11059-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050410-0012-0000-0000-000005D1ECFF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050410-0013-0000-0000-0000194F1991 Message-Id: <20180504102817.11059-18-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-04_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805040097 Subject: [Skiboot] [PATCH v2 17/17] fadump: 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 interrupt to initiate memory preserving IPL. This patch adds support to call s0 interrupt. Sequence : - s0 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 12d9e97ff..8502bafce 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -931,3 +931,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_S0); + /* Initiate normal reboot */ + if (rc) { + prlog(PR_ERR, "Failed to write S0 interrupt [chip id = %x]\n", + chip_id); + return; + } + } + + if (primary_chip == -1) { + prlog(PR_ERR, "Master chip ID not found.\n"); + return; + } + + /* Write S0 interrupt on master SBE */ + rc = xscom_write(primary_chip, + SBE_CONTROL_REG_RW, SBE_CONTROL_REG_S0); + /* Initiate normal reboot */ + if (rc) { + prlog(PR_ERR, "Failed to write S0 interrupt [chip id = %x]\n", + primary_chip); + return; + } + + while (1) + time_wait_ms(100); +} diff --git a/include/sbe-p9.h b/include/sbe-p9.h index 7101dc700..396d38940 100644 --- a/include/sbe-p9.h +++ b/include/sbe-p9.h @@ -103,6 +103,13 @@ #define SBE_HOST_TIMER_EXPIRY PPC_BIT(14) #define SBE_HOST_RESPONSE_MASK (PPC_BITMASK(0, 4) | SBE_HOST_TIMER_EXPIRY) +/* SBE Control Register */ +#define SBE_CONTROL_REG_RW 0x00050008 + +/* SBE interrupt s0/s1 bits */ +#define SBE_CONTROL_REG_S0 PPC_BIT(14) +#define SBE_CONTROL_REG_S1 PPC_BIT(15) + /* SBE Target Type */ #define SBE_TARGET_TYPE_PROC 0x00 #define SBE_TARGET_TYPE_EX 0x01 @@ -243,4 +250,7 @@ extern void p9_sbe_update_timer_expiry(uint64_t new_target); /* Send skiboot relocated base address to SBE */ extern void p9_sbe_send_relocated_base(uint64_t val); +/* Terminate and trigger MPIPL */ +extern void p9_sbe_terminate(void); + #endif /* __SBE_P9_H */