From patchwork Wed Jul 29 03:00:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahesh J Salgaonkar X-Patchwork-Id: 1338118 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGdbf3zP5z9sTR for ; Wed, 29 Jul 2020 13:01:18 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BGdbf3CZ7zDqxd for ; Wed, 29 Jul 2020 13:01:18 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=mahesh@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.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 4BGdbB13NxzDqyJ for ; Wed, 29 Jul 2020 13:00:53 +1000 (AEST) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06T2WIrA194845 for ; Tue, 28 Jul 2020 23:00:52 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32jj2jt4xt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 28 Jul 2020 23:00:51 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06T2XICq001330 for ; Tue, 28 Jul 2020 23:00:51 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 32jj2jt4x4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 23:00:51 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06T2tEvx030023; Wed, 29 Jul 2020 03:00:49 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04fra.de.ibm.com with ESMTP id 32gcpwar2x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jul 2020 03:00:49 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06T30kZM56033758 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jul 2020 03:00:46 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3CD8511C05C; Wed, 29 Jul 2020 03:00:46 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9DF2011C052; Wed, 29 Jul 2020 03:00:45 +0000 (GMT) Received: from [192.168.122.1] (unknown [9.85.72.15]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 29 Jul 2020 03:00:45 +0000 (GMT) From: Mahesh Salgaonkar To: skiboot list Date: Wed, 29 Jul 2020 08:30:44 +0530 Message-ID: <159599164473.67334.3184541706288562173.stgit@jupiter> In-Reply-To: <159599159879.67334.15754620462228186458.stgit@jupiter> References: <159599159879.67334.15754620462228186458.stgit@jupiter> User-Agent: StGit/0.21 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-29_01:2020-07-28, 2020-07-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 phishscore=0 clxscore=1015 mlxlogscore=999 suspectscore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007290013 Subject: [Skiboot] [PATCH 1/5] opal/errorlog: Allow generation of Serviceable attention events X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasant Hegde Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Mahesh Salgaonkar Add support to mark error log event as Serviceable/Customer attention events. Signed-off-by: Mahesh Salgaonkar --- core/errorlog.c | 5 +++++ core/pel.c | 3 +++ include/errorlog.h | 2 ++ include/pel.h | 1 + 4 files changed, 11 insertions(+) diff --git a/core/errorlog.c b/core/errorlog.c index f64ac3f23..2f7bcce19 100644 --- a/core/errorlog.c +++ b/core/errorlog.c @@ -73,6 +73,11 @@ struct errorlog *opal_elog_create(struct opal_err_info *e_info, uint32_t tag) return buf; } +void log_mark_serviceable(struct errorlog *buf) +{ + buf->service_req = true; +} + /* Add a new user data section to an existing error log */ void log_add_section(struct errorlog *buf, uint32_t tag) { diff --git a/core/pel.c b/core/pel.c index ec13e5590..4b2656346 100644 --- a/core/pel.c +++ b/core/pel.c @@ -160,6 +160,9 @@ static void create_user_header_section(struct errorlog *elog_data, else usrhdr->action_flags = cpu_to_be16(ERRL_ACTION_NONE); + if (elog_data->service_req) + usrhdr->action_flags |= ERRL_ACTION_SERVICE; + *pel_offset += USER_HEADER_SECTION_SIZE; } diff --git a/include/errorlog.h b/include/errorlog.h index a443d3681..74fe8b1fd 100644 --- a/include/errorlog.h +++ b/include/errorlog.h @@ -124,6 +124,7 @@ struct errorlog { uint32_t plid; uint32_t log_size; uint64_t elog_timeout; + bool service_req; char user_data_dump[OPAL_LOG_MAX_DUMP]; struct list_node link; @@ -350,6 +351,7 @@ void log_append_data(struct errorlog *buf, unsigned char *data, uint16_t size); void log_append_msg(struct errorlog *buf, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); void log_commit(struct errorlog *elog); +void log_mark_serviceable(struct errorlog *buf); /* Called by the backend after an error has been logged by the * backend. If the error could not be logged successfully success is diff --git a/include/pel.h b/include/pel.h index a0df7cc3c..252d27e2e 100644 --- a/include/pel.h +++ b/include/pel.h @@ -38,6 +38,7 @@ /* Error log reporting action */ #define ERRL_ACTION_REPORT 0x2000 +#define ERRL_ACTION_SERVICE 0x8000 #define ERRL_ACTION_NONE 0x0000 enum elogSectionId { From patchwork Wed Jul 29 03:00:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahesh J Salgaonkar X-Patchwork-Id: 1338119 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGdc14sZGz9sSd for ; Wed, 29 Jul 2020 13:01:37 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BGdc11ybKzDr0y for ; Wed, 29 Jul 2020 13:01:37 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=mahesh@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.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 4BGdbK3YMgzDqxj for ; Wed, 29 Jul 2020 13:01:01 +1000 (AEST) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06T2ViSo178173 for ; Tue, 28 Jul 2020 23:00:58 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 32jpw3r48p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 28 Jul 2020 23:00:58 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06T2rl0a048245 for ; Tue, 28 Jul 2020 23:00:58 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 32jpw3r47y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 23:00:58 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06T2uZhS022423; Wed, 29 Jul 2020 03:00:56 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 32gcqgmg24-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jul 2020 03:00:56 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06T30rXD32440688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jul 2020 03:00:53 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4EDD6A405F; Wed, 29 Jul 2020 03:00:53 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94F30A4057; Wed, 29 Jul 2020 03:00:52 +0000 (GMT) Received: from [192.168.122.1] (unknown [9.85.72.15]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 29 Jul 2020 03:00:52 +0000 (GMT) From: Mahesh Salgaonkar To: skiboot list Date: Wed, 29 Jul 2020 08:30:51 +0530 Message-ID: <159599165147.67334.10462493500128619298.stgit@jupiter> In-Reply-To: <159599159879.67334.15754620462228186458.stgit@jupiter> References: <159599159879.67334.15754620462228186458.stgit@jupiter> User-Agent: StGit/0.21 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-29_01:2020-07-28, 2020-07-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=999 malwarescore=0 spamscore=0 impostorscore=0 suspectscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007290013 Subject: [Skiboot] [PATCH 2/5] opal/errorlog: Add support to include callout section in error log. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasant Hegde Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Mahesh Salgaonkar Allow inclusion of HW callout to eSEL being generated. This will help OPAL to generate errorlog with fru callout section that includes location code, part number and serial number of a faulty hardware that may need replacement. Signed-off-by: Mahesh Salgaonkar --- core/errorlog.c | 41 ++++++++++++++ core/pel.c | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++ include/errorlog.h | 17 ++++++ include/pel.h | 69 ++++++++++++++++++++++++ 4 files changed, 273 insertions(+), 2 deletions(-) diff --git a/core/errorlog.c b/core/errorlog.c index 2f7bcce19..bd2679531 100644 --- a/core/errorlog.c +++ b/core/errorlog.c @@ -105,6 +105,47 @@ void log_add_section(struct errorlog *buf, uint32_t tag) buf->user_section_count++; } +void log_add_callout_section(struct errorlog *buf, const char *loc_code, + const char *part_no, const char *serial_no) +{ + int index = buf->num_fru_callout; + struct elog_fru_callout *fru = &buf->fru_callout[index]; + + if (!buf) { + prerror("ELOG: Cannot add callout section. " + "Buffer is invalid\n"); + return; + } + + if (buf->num_fru_callout >= OPAL_MAX_FRU_CALL_OUTS) { + prerror("ELOG: Cannot add callout section. " + "Maximum limit reached\n"); + return; + } + + /* Location codes -- at most 80 chars with null termination */ + if (strlen(loc_code) >= LOC_CODE_SIZE) { + prerror("ELOG: Invalid Size of location code.\n"); + return; + } + + buf->num_fru_callout++; + memset(fru->loc_code, 0, LOC_CODE_SIZE); + strcpy(fru->loc_code, loc_code); + + /* + * Part number contains a null-terminated ASCII character string. + * 7 ASCII character part number + */ + if (part_no) { + memcpy(fru->part_no, part_no, OPAL_FRU_PART_LEN); + fru->part_no[7] = '\0'; + } + + if (serial_no) + memcpy(fru->serial_no, serial_no, OPAL_FRU_SERIAL_LEN); +} + void opal_elog_complete(struct errorlog *buf, bool success) { if (!success) diff --git a/core/pel.c b/core/pel.c index 4b2656346..4c0b9db2d 100644 --- a/core/pel.c +++ b/core/pel.c @@ -107,10 +107,108 @@ static void setrefcode(struct opal_src_section *src, uint16_t src_refcode) memcpy(src->srcstring+4, refcode, 4); } +static int create_fru_identity(struct elog_fru_callout *elog_fru, + char *pel_buffer, int pel_offset) +{ + int data_len = 0; + struct opal_fru_identity *identity; + + identity = (struct opal_fru_identity *)(pel_buffer + pel_offset); + + if (!strlen(elog_fru->part_no) && !strlen(elog_fru->serial_no)) + return 0; + + identity->id = OPAL_FRU_IDENT_ID; + identity->flags = OPAL_FRU_IDENT_FLAG_NORMAL; + + if (strlen(elog_fru->part_no)) { + identity->flags |= OPAL_FRU_IDENT_FLAG_PART; + memset(identity->fru_data, 0, OPAL_FRU_PART_LEN); + memcpy(identity->fru_data, elog_fru->part_no, + OPAL_FRU_PART_LEN); + data_len = OPAL_FRU_PART_LEN; + } + + if (strlen(elog_fru->serial_no)) { + identity->flags |= OPAL_FRU_IDENT_FLAG_SERIAL; + memset(identity->fru_data + data_len, 0, OPAL_FRU_SERIAL_LEN); + memcpy(identity->fru_data + data_len, elog_fru->serial_no, + OPAL_FRU_SERIAL_LEN); + data_len += OPAL_FRU_SERIAL_LEN; + } + identity->length = FRU_IDENTITY_HEADER_SIZE + data_len; + + return identity->length; +} + +/* + * The FRU Call-out section is added as additional/optional sub section. + * Each additional sub section starts with sub section header followed by + * data. The sub section header contains section id, flags and size of the + * sub section including header size. A variable number of FRU Call-outs are + * possible up to the maximum of 10. Each FRU Callout structure starts on a + * word boundary. + */ +static int create_fru_callout_section(struct errorlog *elog_data, + char *pel_buffer, int pel_offset) +{ + int len; + struct opal_fru_callout_section *fru; + struct opal_fru_callout *fru_callout; + int i, fru_count; + + fru = (struct opal_fru_callout_section *)(pel_buffer + pel_offset); + fru->header.id = OPAL_SRC_SUB_SECTION_ID; + fru->header.flags = 0; + /* + * Initialize SRC sub section size with sub section header size. + * SRC sub section size is expressed in # of words (4 byte fields) + * SRC sub section size will be updated for each FRU call out. + */ + fru->header.length += SRC_SUBSECTION_HEADER_SIZE / 4; + pel_offset += SRC_SUBSECTION_HEADER_SIZE; + fru_callout = (struct opal_fru_callout *)(pel_buffer + pel_offset); + + /* Add FRU Call-outs */ + fru_count = MIN(OPAL_MAX_FRU_CALL_OUTS, elog_data->num_fru_callout); + for (i = 0; i < fru_count; i++) { + struct elog_fru_callout *elog_fru = &elog_data->fru_callout[i]; + + fru_callout->type = OPAL_FRU_TYPE_NORMAL; + fru_callout->priority = OPAL_FRU_PRIO_MEDIUM; + /* Size of loc-code including NULL terminator. */ + len = strlen(elog_fru->loc_code) + 1; + + /* Length of Location Code field - must be a multiple of 4. */ + len = ALIGN_UP(len, 4); + memcpy(fru_callout->loc_code, elog_fru->loc_code, len); + fru_callout->loc_code_len = len; + fru_callout->length = FRU_CALLOUT_SECTION_SIZE + + fru_callout->loc_code_len; + + pel_offset += fru_callout->length; + len = create_fru_identity(elog_fru, pel_buffer, pel_offset); + if (len) + fru_callout->flags = OPAL_FRU_FLAG_IDENTITY_INCLUDED; + fru_callout->length += len; + pel_offset += len; + + /* + * SRC sub section size is expressed in # of words + * (4 byte fields) + */ + fru->header.length += fru_callout->length / 4; + fru_callout = + (struct opal_fru_callout *)(pel_buffer + pel_offset); + } + return fru->header.length * 4; +} + /* Create SRC section of OPAL log */ static void create_src_section(struct errorlog *elog_data, char *pel_buffer, int *pel_offset) { + int len; struct opal_src_section *src = (struct opal_src_section *) (pel_buffer + *pel_offset); @@ -134,6 +232,16 @@ static void create_src_section(struct errorlog *elog_data, src->hexwords[6] = cpu_to_be32(elog_data->additional_info[2]); src->hexwords[7] = cpu_to_be32(elog_data->additional_info[3]); *pel_offset += SRC_SECTION_SIZE; + + if (!elog_data->num_fru_callout) + return; + + /* Fill up src sub section header */ + len = create_fru_callout_section(elog_data, pel_buffer, *pel_offset); + src->srclength += len; + src->v6header.length += len; + src->flags |= OPAL_SRC_FLAG_SUB_SECTION_PRESENT; + *pel_offset += len; } /* Create user header section */ @@ -252,9 +360,47 @@ static size_t pel_user_section_size(struct errorlog *elog_data) return total; } +static size_t pel_fru_callout_section_size(struct errorlog *elog_data) +{ + int i, fru_count; + size_t total = 0; + + if (!elog_data->num_fru_callout) + return 0; + + total += SRC_SUBSECTION_HEADER_SIZE; + fru_count = MIN(OPAL_MAX_FRU_CALL_OUTS, elog_data->num_fru_callout); + for (i = 0; i < fru_count; i++) { + size_t len; + + total += FRU_CALLOUT_SECTION_SIZE; + /* Size of loc-code including NULL terminator. */ + len = strlen(elog_data->fru_callout[i].loc_code) + 1; + len = ALIGN_UP(len, 4); + total += len; + + /* Calculate size for FRU identity if present */ + if (!strlen(elog_data->fru_callout[i].part_no) + && !strlen(elog_data->fru_callout[i].serial_no)) + continue; + + if (strlen(elog_data->fru_callout[i].part_no)) + total += OPAL_FRU_PART_LEN; + + if (strlen(elog_data->fru_callout[i].serial_no)) + total += OPAL_FRU_SERIAL_LEN; + + total += FRU_IDENTITY_HEADER_SIZE; + } + return total; +} + size_t pel_size(struct errorlog *elog_data) { - return PEL_MIN_SIZE + pel_user_section_size(elog_data); + size_t len; + + len = PEL_MIN_SIZE + pel_user_section_size(elog_data); + return len + pel_fru_callout_section_size(elog_data); } /* Converts an OPAL errorlog into a PEL formatted log */ diff --git a/include/errorlog.h b/include/errorlog.h index 74fe8b1fd..24d12c4d8 100644 --- a/include/errorlog.h +++ b/include/errorlog.h @@ -89,6 +89,12 @@ /* Max user dump size is 14K */ #define OPAL_LOG_MAX_DUMP 14336 +#define OPAL_FRU_PART_LEN 8 +#define OPAL_FRU_SERIAL_LEN 12 + +/* Maximum possible FRU Call-outs */ +#define OPAL_MAX_FRU_CALL_OUTS 10 + /* Origin of error, elog_origin */ #define ORG_SAPPHIRE 1 #define ORG_POWERNV 2 @@ -101,6 +107,13 @@ struct elog_user_data_section { char data_dump[1]; } __packed; + +struct elog_fru_callout { + char loc_code[LOC_CODE_SIZE]; + char part_no[OPAL_FRU_PART_LEN]; + char serial_no[OPAL_FRU_SERIAL_LEN]; +}; + /* * All the information regarding an error/event to be reported * needs to populate this structure using pre-defined interfaces @@ -125,6 +138,8 @@ struct errorlog { uint32_t log_size; uint64_t elog_timeout; bool service_req; + uint16_t num_fru_callout; + struct elog_fru_callout fru_callout[OPAL_MAX_FRU_CALL_OUTS]; char user_data_dump[OPAL_LOG_MAX_DUMP]; struct list_node link; @@ -347,6 +362,8 @@ uint32_t log_simple_error(struct opal_err_info *e_info, struct errorlog *opal_elog_create(struct opal_err_info *e_info, uint32_t tag) __warn_unused_result; void log_add_section(struct errorlog *buf, uint32_t tag); +void log_add_callout_section(struct errorlog *buf, const char *loc_code, + const char *part_no, const char *serial_no); void log_append_data(struct errorlog *buf, unsigned char *data, uint16_t size); void log_append_msg(struct errorlog *buf, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); diff --git a/include/pel.h b/include/pel.h index 252d27e2e..e2e816036 100644 --- a/include/pel.h +++ b/include/pel.h @@ -12,12 +12,14 @@ #define PRIVATE_HEADER_SECTION_SIZE 48 #define USER_HEADER_SECTION_SIZE 24 #define SRC_SECTION_SIZE 80 -#define SRC_SUBSECTION_SIZE 4 +#define SRC_SUBSECTION_HEADER_SIZE 4 #define SRC_LENGTH 72 #define OPAL_MAX_SRC_BYTES 32 #define EXTENDED_HEADER_SECTION_SIZE 76 #define MTMS_SECTION_SIZE 28 #define IO_EVENT_SECTION_SIZE 16 +#define FRU_CALLOUT_SECTION_SIZE 4 +#define FRU_IDENTITY_HEADER_SIZE 4 #define OPAL_ELOG_VERSION 1 #define OPAL_ELOG_SST 0 @@ -36,6 +38,8 @@ #define OPAL_SRC_SEC_VER 0x02 #define OPAL_EXT_HRD_VER 0x01 +#define OPAL_SRC_FLAG_SUB_SECTION_PRESENT 0x01 + /* Error log reporting action */ #define ERRL_ACTION_REPORT 0x2000 #define ERRL_ACTION_SERVICE 0x8000 @@ -71,6 +75,37 @@ struct opal_v6_header { /* opal_srctype */ #define OPAL_SRC_TYPE_ERROR 0xBB +/* opal SRC subsection id */ +#define OPAL_SRC_SUB_SECTION_ID 0xC0 + +/* FRU callout Type */ +#define OPAL_FRU_TYPE_NORMAL 0x2 +/* FRU callout flags */ +#define OPAL_FRU_FLAG_IDENTITY_INCLUDED 0x8 +#define OPAL_FRU_FLAG_MRU_INCLUDED 0x4 +/* FRU callout priority */ +#define OPAL_FRU_PRIO_HIGH 'H' +#define OPAL_FRU_PRIO_MEDIUM 'M' +#define OPAL_FRU_PRIO_MEDIUM_GROUP_A 'A' +#define OPAL_FRU_PRIO_MEDIUM_GROUP_B 'B' +#define OPAL_FRU_PRIO_MEDIUM_GROUP_C 'C' +#define OPAL_FRU_PRIO_LOW 'L' + +/* FRU identity srtucture id */ +#define OPAL_FRU_IDENT_ID 0x4944 /* ID */ +/* FRU identity flags bits 0-3 */ +#define OPAL_FRU_IDENT_FLAG_NORMAL 0x10 /* "normal" hardware FRU */ +#define OPAL_FRU_IDENT_FLAG_CODE 0x20 /* code FRU */ +#define OPAL_FRU_IDENT_FLAG_CONFIG 0x30 /* configuration error */ +#define OPAL_FRU_IDENT_FLAG_MAINT 0x40 /* Maintenance Procedure req */ +#define OPAL_FRU_IDENT_FLAG_EXT 0x90 /* External FRU */ +#define OPAL_FRU_IDENT_FLAG_EXT_CODE 0xa0 /* External code FRU */ +#define OPAL_FRU_IDENT_FLAG_TOOL 0xb0 /* Tool FRU */ +#define OPAL_FRU_IDENT_FLAG_SYMBOL 0xc0 /* Symbolic FRU */ +/* FRU identity flags bits 4-7 */ +#define OPAL_FRU_IDENT_FLAG_PART 0x08 /* FRU Part Number supplied */ +#define OPAL_FRU_IDENT_FLAG_CCIN 0x04 /* CCIN supplied */ +#define OPAL_FRU_IDENT_FLAG_SERIAL 0x01 /* FRU serial number supplied */ #define OPAL_CID_SAPPHIRE 'K' /* creator ID for sapphire log */ #define OPAL_CID_POWERNV 'P' /* creator ID for powernv log */ @@ -129,6 +164,38 @@ struct opal_src_section { char srcstring[OPAL_MAX_SRC_BYTES]; } __packed; +struct opal_src_sub_section { + uint8_t id; /* SRC sub section id */ + uint8_t flags; + uint16_t length; /* in # of words (4 byte fields) */ +}; + +struct opal_fru_callout_section { + struct opal_src_sub_section header; +}; + +struct opal_fru_callout { + uint8_t length; /* in bytes */ + uint8_t type:4; + uint8_t flags:4; + uint8_t priority; + uint8_t loc_code_len; + char loc_code[0]; +}; + +struct opal_fru_identity { + uint16_t id; + uint8_t length; + uint8_t flags; + /* + * Depending on flags[4-7] bits fru_data will contain: + * part number 8 bytes (7 ASCII character + 1 null-terminator) + * CCIN number 4 bytes (not a null-terminated string) + * FRU serial number 12 bytes (not a null-terminated string) + */ + char fru_data[0]; +}; + struct opal_extended_header_section { struct opal_v6_header v6header; char model[OPAL_SYS_MODEL_LEN]; From patchwork Wed Jul 29 03:00:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahesh J Salgaonkar X-Patchwork-Id: 1338120 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGdcP3jrtz9sSd for ; Wed, 29 Jul 2020 13:01:57 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BGdcP35nzzDqyH for ; Wed, 29 Jul 2020 13:01:57 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=mahesh@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.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 4BGdbT3xZCzDqxs for ; Wed, 29 Jul 2020 13:01:09 +1000 (AEST) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06T2VdZd168538 for ; Tue, 28 Jul 2020 23:01:05 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 32j0a6g5j4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 28 Jul 2020 23:01:05 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06T2VnDG169077 for ; Tue, 28 Jul 2020 23:01:04 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 32j0a6g5hp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 23:01:04 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06T2t4Gv006450; Wed, 29 Jul 2020 03:01:03 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 32gcr0jqv7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jul 2020 03:01:03 +0000 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 06T310WC32309658 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jul 2020 03:01:00 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 011DD4204C; Wed, 29 Jul 2020 03:01:00 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6589B42049; Wed, 29 Jul 2020 03:00:59 +0000 (GMT) Received: from [192.168.122.1] (unknown [9.85.72.15]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 29 Jul 2020 03:00:59 +0000 (GMT) From: Mahesh Salgaonkar To: skiboot list Date: Wed, 29 Jul 2020 08:30:58 +0530 Message-ID: <159599165853.67334.17196614937783713785.stgit@jupiter> In-Reply-To: <159599159879.67334.15754620462228186458.stgit@jupiter> References: <159599159879.67334.15754620462228186458.stgit@jupiter> User-Agent: StGit/0.21 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-29_01:2020-07-28, 2020-07-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 impostorscore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007290013 Subject: [Skiboot] [PATCH 3/5] opal: Get chip part-number and serial-number. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasant Hegde Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Mahesh Salgaonkar Get chip part-number and serial-number and store it under proc_chip for quick reference while sending error log that needs proc chip FRU details. Signed-off-by: Mahesh Salgaonkar --- core/chip.c | 13 +++++++++++++ include/chip.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/core/chip.c b/core/chip.c index 191432d29..8e97a7bcd 100644 --- a/core/chip.c +++ b/core/chip.c @@ -63,6 +63,8 @@ static void init_chip(struct dt_node *dn) struct proc_chip *chip; uint32_t id; const char *lc = NULL; + const char *part_no = NULL; + const char *serial_no = NULL; id = dt_get_chip_id(dn); assert(id < MAX_CHIPS); @@ -93,6 +95,17 @@ static void init_chip(struct dt_node *dn) if (lc) chip->loc_code = strdup(lc); + /* Update part number and serial number for this chip */ + if (dt_has_node_property(dn, "part-number", NULL)) + part_no = dt_prop_get(dn, "part-number"); + if (part_no) + chip->part_no = strdup(part_no); + + if (dt_has_node_property(dn, "serial-number", NULL)) + serial_no = dt_prop_get(dn, "serial-number"); + if (serial_no) + chip->serial_no = strdup(serial_no); + prlog(PR_INFO, "CHIP: Initialised chip %d from %s\n", id, dn->name); chips[id] = chip; } diff --git a/include/chip.h b/include/chip.h index b79b63ecf..e63f17a18 100644 --- a/include/chip.h +++ b/include/chip.h @@ -187,6 +187,10 @@ struct proc_chip { /* location code of this chip */ const uint8_t *loc_code; + /* part-number and serial number for this chip */ + const uint8_t *part_no; + const uint8_t *serial_no; + /* Used by hw/sbe-p9.c */ struct p9_sbe *sbe; @@ -233,5 +237,29 @@ static inline const char *chip_loc_code(uint32_t chip_id) return chip->loc_code; } +/* helper to get part number of a chip */ +static inline const char *chip_part_number(uint32_t chip_id) +{ + struct proc_chip *chip; + + chip = get_chip(chip_id); + if (!chip) + return NULL; + + return chip->part_no; +} + +/* helper to get serial number of a chip */ +static inline const char *chip_serial_number(uint32_t chip_id) +{ + struct proc_chip *chip; + + chip = get_chip(chip_id); + if (!chip) + return NULL; + + return chip->serial_no; +} + #endif /* __CHIP_H */ From patchwork Wed Jul 29 03:01:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahesh J Salgaonkar X-Patchwork-Id: 1338121 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGdcm1FgXz9sSd for ; Wed, 29 Jul 2020 13:02:16 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BGdcl3f1ZzDr0y for ; Wed, 29 Jul 2020 13:02:15 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=mahesh@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Received: from mx0b-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 4BGdbb2mLNzDqxf for ; Wed, 29 Jul 2020 13:01:15 +1000 (AEST) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06T2Vr9F186982 for ; Tue, 28 Jul 2020 23:01:12 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32j7sy30k5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 28 Jul 2020 23:01:12 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06T2WXF8188767 for ; Tue, 28 Jul 2020 23:01:11 -0400 Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 32j7sy30jc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 23:01:11 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06T2qMK1012282; Wed, 29 Jul 2020 03:01:10 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06fra.de.ibm.com with ESMTP id 32jgvprs38-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jul 2020 03:01:09 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06T317pi57409916 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jul 2020 03:01:07 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A4182AE057; Wed, 29 Jul 2020 03:01:06 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 17155AE061; Wed, 29 Jul 2020 03:01:06 +0000 (GMT) Received: from [192.168.122.1] (unknown [9.85.72.15]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 29 Jul 2020 03:01:05 +0000 (GMT) From: Mahesh Salgaonkar To: skiboot list Date: Wed, 29 Jul 2020 08:31:05 +0530 Message-ID: <159599166522.67334.389838163476654740.stgit@jupiter> In-Reply-To: <159599159879.67334.15754620462228186458.stgit@jupiter> References: <159599159879.67334.15754620462228186458.stgit@jupiter> User-Agent: StGit/0.21 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-29_01:2020-07-28, 2020-07-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxscore=0 clxscore=1015 phishscore=0 malwarescore=0 impostorscore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007290013 Subject: [Skiboot] [PATCH 4/5] opal/eeh: Send an error callout on EEH error. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasant Hegde Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" On EEH error send out an error log (eSEL) with hardware callout. To avoid generating multiple events for same error, use a bit flag in generic PHB structure. Use two bits i.e SEND and SENT bit. Whenever an EEH freeze/fence is detected, a SEND error log bit is set. Once the error log is queued, a SENT error log bit is set. These bits are sticky and gets reset when PHB is reinitialized to clear the EEH error. The error log includes FRU details and PHB diag data Signed-off-by: Mahesh Salgaonkar --- core/pci-opal.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/phb3.c | 6 ++++++ hw/phb4.c | 6 ++++++ include/errorlog.h | 1 + include/pci.h | 5 +++++ 5 files changed, 67 insertions(+) diff --git a/core/pci-opal.c b/core/pci-opal.c index aa375c6aa..47503d5d2 100644 --- a/core/pci-opal.c +++ b/core/pci-opal.c @@ -13,6 +13,12 @@ #include #include #include +#include +#include + +DEFINE_LOG_ENTRY(OPAL_RC_PCI_RESET_PHB, OPAL_INPUT_OUTPUT_ERR_EVT, + OPAL_PCI, OPAL_IO_DEVICES, OPAL_UNRECOVERABLE_ERR_GENERAL, + OPAL_NA); #define OPAL_PCICFG_ACCESS_READ(op, cb, type) \ static int64_t opal_pci_config_##op(uint64_t phb_id, \ @@ -984,6 +990,45 @@ static int64_t opal_pci_set_power_state(uint64_t async_token, } opal_call(OPAL_PCI_SET_POWER_STATE, opal_pci_set_power_state, 3); +static void send_eeh_serviceable_event(struct phb *phb, void *diag_buffer) +{ + struct errorlog *buf; + const char *loc, *part, *serial; + uint32_t chip_id, len; + struct OpalIoPhbErrorCommon *common; + + /* Generate and send an error log/eSEL */ + buf = opal_elog_create(&e_info(OPAL_RC_PCI_RESET_PHB), 0); + if (!buf) { + prerror("Unable to send EEH error log (eSEL)\n"); + return; + } + + log_append_msg(buf, "PHB#%x Freeze/Fence detected!\n", phb->opal_id); + log_mark_serviceable(buf); + + /* Add PHB base location code */ + loc = phb->base_loc_code; + log_add_callout_section(buf, loc, NULL, NULL); + + /* Add FRU callout of associated chip id */ + chip_id = dt_get_chip_id(phb->dt_node); + loc = chip_loc_code(chip_id); + part = chip_part_number(chip_id); + serial = chip_serial_number(chip_id); + log_add_callout_section(buf, loc, part, serial); + + /* Insert the phb diag data. */ + common = (struct OpalIoPhbErrorCommon *)diag_buffer; + len = be32_to_cpu(common->len); + + log_add_section(buf, OPAL_ELOG_SEC_DIAG); + log_append_data(buf, diag_buffer, len); + log_commit(buf); + + phb->flags |= PCI_EEH_ERR_LOG_SENT; +} + static int64_t opal_pci_get_phb_diag_data2(uint64_t phb_id, void *diag_buffer, uint64_t diag_buffer_len) @@ -1000,6 +1045,10 @@ static int64_t opal_pci_get_phb_diag_data2(uint64_t phb_id, return OPAL_UNSUPPORTED; phb_lock(phb); rc = phb->ops->get_diag_data2(phb, diag_buffer, diag_buffer_len); + + /* Send an error log if required */ + if ((phb->flags & PCI_EEH_ERR_LOG_MASK) == PCI_EEH_ERR_LOG_SEND) + send_eeh_serviceable_event(phb, diag_buffer); phb_unlock(phb); return rc; diff --git a/hw/phb3.c b/hw/phb3.c index 8af6b6164..0d7370f52 100644 --- a/hw/phb3.c +++ b/hw/phb3.c @@ -68,6 +68,9 @@ static bool phb3_fenced(struct phb3 *p) if (nfir & PPC_BIT(16)) { p->flags |= PHB3_AIB_FENCED; + /* Mark flag to send an error log */ + p->phb.flags |= PCI_EEH_ERR_LOG_SEND; + phb3_eeh_dump_regs(p, NULL); return true; } @@ -2758,6 +2761,9 @@ static int64_t phb3_creset(struct pci_slot *slot) */ p->flags &= ~PHB3_AIB_FENCED; p->flags &= ~PHB3_CAPP_RECOVERY; + + /* Reset the error logging related flag */ + p->phb.flags &= ~PCI_EEH_ERR_LOG_MASK; phb3_init_hw(p, false); if (p->flags & PHB3_CAPP_DISABLING) { diff --git a/hw/phb4.c b/hw/phb4.c index 3f22a2c4d..8e59cdba4 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -2550,6 +2550,9 @@ static bool phb4_fenced(struct phb4 *p) /* Mark ourselves fenced */ p->flags |= PHB4_AIB_FENCED; + /* Mark flag to send an error log */ + p->phb.flags |= PCI_EEH_ERR_LOG_SEND; + PHBERR(p, "PHB Freeze/Fence detected !\n"); phb4_dump_pec_err_regs(p); @@ -3444,6 +3447,9 @@ static int64_t phb4_creset(struct pci_slot *slot) p->flags &= ~PHB4_AIB_FENCED; p->flags &= ~PHB4_CAPP_RECOVERY; p->flags &= ~PHB4_CFG_USE_ASB; + + /* Reset the error logging related flag */ + p->phb.flags &= ~PCI_EEH_ERR_LOG_MASK; phb4_init_hw(p); pci_slot_set_state(slot, PHB4_SLOT_CRESET_FRESET); diff --git a/include/errorlog.h b/include/errorlog.h index 24d12c4d8..9490e4ec4 100644 --- a/include/errorlog.h +++ b/include/errorlog.h @@ -341,6 +341,7 @@ enum opal_reasoncode { }; #define OPAL_ELOG_SEC_DESC 0x44455343 +#define OPAL_ELOG_SEC_DIAG 0x44494147 /* For EEH diag data */ #define DEFINE_LOG_ENTRY(reason, type, id, subsys, \ severity, subtype) static struct opal_err_info err_##reason = \ diff --git a/include/pci.h b/include/pci.h index eb23a6d9b..feadbf21d 100644 --- a/include/pci.h +++ b/include/pci.h @@ -382,6 +382,11 @@ struct phb { /* Additional data the platform might need to attach */ void *platform_data; + + uint32_t flags; +#define PCI_EEH_ERR_LOG_SEND 0x1 +#define PCI_EEH_ERR_LOG_SENT 0x2 +#define PCI_EEH_ERR_LOG_MASK 0x3 }; static inline void phb_lock(struct phb *phb) From patchwork Wed Jul 29 03:01:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mahesh J Salgaonkar X-Patchwork-Id: 1338122 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGdd41qytz9sSd for ; Wed, 29 Jul 2020 13:02:32 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BGdd40GjNzDqyH for ; Wed, 29 Jul 2020 13:02:32 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0b-001b2d01.pphosted.com; envelope-from=mahesh@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Received: from mx0b-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 4BGdbk64BbzDqxg for ; Wed, 29 Jul 2020 13:01:22 +1000 (AEST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06T314rn115985 for ; Tue, 28 Jul 2020 23:01:19 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32jqrse9p8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 28 Jul 2020 23:01:19 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06T31EWO116712 for ; Tue, 28 Jul 2020 23:01:18 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 32jqrse9nn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 23:01:18 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06T2tjvQ007534; Wed, 29 Jul 2020 03:01:17 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 32gcpx4gvy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jul 2020 03:01:16 +0000 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 06T31DLG54394952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jul 2020 03:01:13 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 511A911C05E; Wed, 29 Jul 2020 03:01:13 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B73E111C04A; Wed, 29 Jul 2020 03:01:12 +0000 (GMT) Received: from [192.168.122.1] (unknown [9.85.72.15]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 29 Jul 2020 03:01:12 +0000 (GMT) From: Mahesh Salgaonkar To: skiboot list Date: Wed, 29 Jul 2020 08:31:11 +0530 Message-ID: <159599167188.67334.9580090334203045402.stgit@jupiter> In-Reply-To: <159599159879.67334.15754620462228186458.stgit@jupiter> References: <159599159879.67334.15754620462228186458.stgit@jupiter> User-Agent: StGit/0.21 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-29_01:2020-07-28, 2020-07-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 impostorscore=0 suspectscore=2 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007290018 Subject: [Skiboot] [PATCH 5/5] run-pel: Add additional tests with FRU callout section. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vasant Hegde Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Signed-off-by: Mahesh Salgaonkar --- core/test/run-pel.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/core/test/run-pel.c b/core/test/run-pel.c index 812c8996c..ac365dbf7 100644 --- a/core/test/run-pel.c +++ b/core/test/run-pel.c @@ -58,6 +58,7 @@ int main(void) struct opal_err_info *opal_err_info = &err_TEST_ERROR; char *buffer; struct elog_user_data_section *tmp; + int i; dt_root = dt_new_root(""); dt_add_property_string(dt_root, "model", "run-pel-unittest"); @@ -113,6 +114,53 @@ int main(void) assert(size == create_pel_log(elog, pel_buf, size)); + /* Add single FRU callout with location code only. */ + i = elog->num_fru_callout++; + strcpy(elog->fru_callout[0].loc_code, "Hello World!"); + + size = pel_size(elog); + pel_buf = realloc(pel_buf, size); + assert(pel_buf); + + assert(size == create_pel_log(elog, pel_buf, size)); + + /* Add additional FRU callout with loc-code and part-no. */ + i = elog->num_fru_callout++; + strcpy(elog->fru_callout[i].loc_code, "Hello World2!"); + strcpy(elog->fru_callout[i].part_no, "PARTNO"); + + size = pel_size(elog); + pel_buf = realloc(pel_buf, size); + assert(pel_buf); + + assert(size == create_pel_log(elog, pel_buf, size)); + + /* Add additional FRU callout with loc-code, part-no and serial no. */ + i = elog->num_fru_callout++; + strcpy(elog->fru_callout[i].loc_code, "Hello World2!"); + strcpy(elog->fru_callout[i].part_no, "PARTNO"); + strcpy(elog->fru_callout[i].serial_no, "SERIALNO"); + + size = pel_size(elog); + pel_buf = realloc(pel_buf, size); + assert(pel_buf); + + assert(size == create_pel_log(elog, pel_buf, size)); + + /* Add maximum of 10 FRU callouts */ + for (i = elog->num_fru_callout; i < OPAL_MAX_FRU_CALL_OUTS; i++) { + elog->num_fru_callout++; + strcpy(elog->fru_callout[i].loc_code, "Hello World2!"); + strcpy(elog->fru_callout[i].part_no, "PARTNO"); + strcpy(elog->fru_callout[i].serial_no, "SERIALNO"); + } + + size = pel_size(elog); + pel_buf = realloc(pel_buf, size); + assert(pel_buf); + + assert(size == create_pel_log(elog, pel_buf, size)); + free(pel_buf); free(elog);