From patchwork Tue Apr 3 12:04:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 894558 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Fntq2trXz9s37 for ; Tue, 3 Apr 2018 22:08:51 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40Fntq1RlzzF2HF for ; Tue, 3 Apr 2018 22:08:51 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631b20b45=hegdevasant@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40FnqN1gLKzF28T for ; Tue, 3 Apr 2018 22:05:52 +1000 (AEST) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w33Bxh9J100325 for ; Tue, 3 Apr 2018 08:05:49 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0b-001b2d01.pphosted.com with ESMTP id 2h47c7wpff-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 08:05:47 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 13:05:43 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 13:05:41 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33C5e3o2359570; Tue, 3 Apr 2018 12:05:40 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2833642042; Tue, 3 Apr 2018 12:57:32 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C257C42047; Tue, 3 Apr 2018 12:57:30 +0100 (BST) Received: from hegdevasant.in.ibm.com (unknown [9.109.198.179]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 12:57:30 +0100 (BST) From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Tue, 3 Apr 2018 17:34:42 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> References: <20180403120447.24364-1-hegdevasant@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18040312-0012-0000-0000-000005C674AE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040312-0013-0000-0000-000019428256 Message-Id: <20180403120447.24364-12-hegdevasant@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030128 Subject: [Skiboot] [RFC PATCH 11/16] hdata: Add result table property to ibm, dump node X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stewart@linux.vnet.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" result-table : Use fadump structure format to send MDRT table to host. Signed-off-by: Vasant Hegde --- hdata/spira.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- hdata/spira.h | 3 +++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/hdata/spira.c b/hdata/spira.c index 5394e609f..1ceb0071b 100644 --- a/hdata/spira.c +++ b/hdata/spira.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "hdata.h" #include "hostservices.h" @@ -1117,7 +1119,82 @@ static void add_iplparams_sys_params(const void *iplp, struct dt_node *node) dt_init_secureboot_node(p); } -static void add_fadump_node(const struct iplparams_iplparams *p __unused) +static void add_fadump_result_table(struct dt_node *node, + const struct iplparams_iplparams *p) +{ + int i, j = 0; + u32 mdrt_cnt = spira.ntuples.mdump_res.act_cnt; + size_t prop_size; + struct mdrt_table *mdrt = (void *)(MDRT_TABLE_BASE); + struct fadump_section *fadump_section; + struct fadump *result_table; + + if (p->cec_ipl_maj_type != IPLPARAMS_MAJ_TYPE_REIPL || + p->cec_ipl_min_type != IPLPARAMS_MIN_TYPE_POST_DUMP) + return; + if (p->cec_ipl_attrib != IPLPARAMS_ATTRIB_MEM_PRESERVE) + return; + + if (mdrt_cnt == 0) + return; + + prlog(PR_DEBUG, "FADUMP: Dump found, MDRT count = 0x%x\n", mdrt_cnt); + + /* Number of entries in MDRT table */ + prop_size = sizeof(struct fadump) + + (mdrt_cnt * sizeof(struct fadump_section)); + result_table = zalloc(prop_size); + if (!result_table) { + prlog(PR_ERR, "FADUMP: Failed to allocate memory\n"); + return; + } + + /* Copy MDRT entries to result-table */ + result_table->fadump_section_size = sizeof(struct fadump_section); + for (i = 0; i < mdrt_cnt; i++) { + /* Skip garbage entry */ + if ((mdrt->dest_addr == 0) || (mdrt->size == 0)) { + mdrt++; + continue; + } + + /* Old hostboot? */ + if (mdrt->data_region == 0) { + mdrt++; + continue; + } + + if (mdrt->dump_type != DUMP_TYPE_FADUMP) { + mdrt++; + continue; + } + + fadump_section = &(result_table->section[j++]); + fadump_section->source_type = mdrt->data_region; + /* Clear top bit */ + fadump_section->source_addr = mdrt->src_addr & ~(HRMOR_BIT); + fadump_section->dest_addr = mdrt->dest_addr & ~(HRMOR_BIT); + fadump_section->source_size = mdrt->size; + fadump_section->dest_size = mdrt->size; + mdrt++; + } + + if (j == 0) { + prlog(PR_DEBUG, "DUMP: MDRT table is empty\n"); + free(result_table); + return; + } + + /* TODO: Fill Architected register data */ + + result_table->section_count = j; + /* Actual property size */ + prop_size = sizeof(struct fadump) + (j * sizeof(struct fadump_section)); + dt_add_property(node, "result-table", result_table, prop_size); + free(result_table); +} + +static void add_fadump_node(const struct iplparams_iplparams *p) { u64 fw_load_area[4]; struct dt_node *node; @@ -1134,6 +1211,8 @@ static void add_fadump_node(const struct iplparams_iplparams *p __unused) fw_load_area[2] = (u64)INITRAMFS_LOAD_BASE; fw_load_area[3] = INITRAMFS_LOAD_SIZE; dt_add_property(node, "fw-load-area", fw_load_area, sizeof(fw_load_area)); + + add_fadump_result_table(node, p); } static void add_iplparams_ipl_params(const void *iplp, struct dt_node *node) diff --git a/hdata/spira.h b/hdata/spira.h index ef2aec257..c0be8212c 100644 --- a/hdata/spira.h +++ b/hdata/spira.h @@ -399,8 +399,11 @@ struct iplparams_iplparams { #define IPLPARAMS_FSP_FW_IPL_SIDE_TEMP 0x01 uint8_t ipl_speed; __be16 cec_ipl_attrib; +#define IPLPARAMS_ATTRIB_MEM_PRESERVE PPC_BIT16(2) uint8_t cec_ipl_maj_type; +#define IPLPARAMS_MAJ_TYPE_REIPL 0x01 uint8_t cec_ipl_min_type; +#define IPLPARAMS_MIN_TYPE_POST_DUMP 0x0d uint8_t os_ipl_mode; uint8_t keylock_pos; uint8_t lmb_size;