Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11539377ybi; Thu, 25 Jul 2019 18:46:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfXWGrewNZjcXoDaciQQBW+O9kZTyWfpNq4evuuMWWMC8xCwz/fhbmvJTl4ftqtLalUS6n X-Received: by 2002:a17:902:7c90:: with SMTP id y16mr95196232pll.238.1564105589978; Thu, 25 Jul 2019 18:46:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564105589; cv=none; d=google.com; s=arc-20160816; b=nR2+v5tXxrm2pn2cLLtYEofoezlBlLhJgnawBH7t1OzWnJkwVZlJFFsN5H7g0Z3dr5 9i+Yt27jIiXHhPeYMSjMLcwm4JKZ6Q74M17QKSuhkgXs8zijOgq0cxSvV2MSkTOw9tuq fB9DU49W0xvi1iqS9Zd7jjSRj+LyMEPULTBuC8hxiMMpLomJi5PImDTsAS22ougnkFV7 ugzX0WZ/DZ2/A0Sy8Rn8AxBaOTm3TMevjQR4Xug9HONOLeQ41x8DM0w5pQWgY1Csxg3p X/Eu2KVq9n09Lmzzg719J/szU7o362lH2lepf8d6UWBMjOUhiQuQtrQfKdsvj1C8zat8 OWuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=qkIHXdT043oHOKACdiWHWGDcjCjl2c4nTUcD9f6CO5o=; b=COKCJ68HzYdsJXownFsRvRUBHLgr0oTXO8PziQoIDt6MI942iy0gA5T3tF0JNa15eK liVwHD48E8I/ZFBJ45sCe9KHjYRF2y3p+Msumg0tUtDS3ajBhqG1b/0nsUZ2O+X4V7Gz wczD867q81a+LIsPEaKVHPbziUYxsrnHc15d+q6EaLta7+o1am0MbvphGDCXYZh2K7jL vu4/G8Dj4mzqXsJJlKFdEL9pLJGHUhmmGFkhNz35zRVfsIUgOtFewaqYaytsa0rnQgbF H7pzMoJ1Z58PiiNl0P6ZOpZvnSelCLf02iwyXJ1E2rnGihKK6SCQDiK9fNbshI009xZV /UKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a63si17649449pge.113.2019.07.25.18.46.14; Thu, 25 Jul 2019 18:46:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725955AbfGZBpl (ORCPT + 99 others); Thu, 25 Jul 2019 21:45:41 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:41058 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725852AbfGZBpl (ORCPT ); Thu, 25 Jul 2019 21:45:41 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 8EF18370B50BB262F715; Fri, 26 Jul 2019 09:45:38 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Fri, 26 Jul 2019 09:45:31 +0800 From: Xiaofei Tan To: CC: Xiaofei Tan , , , , , , , , , , Subject: [PATCH v2 1/1] efi: cper: print AER info of PCIe fatal error Date: Fri, 26 Jul 2019 09:43:37 +0800 Message-ID: <1564105417-232048-1-git-send-email-tanxiaofei@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org AER info of PCIe fatal error is not printed in the current driver. Because APEI driver will panic directly for fatal error, and can't run to the place of printing AER info. An example log is as following: {763}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 11 {763}[Hardware Error]: event severity: fatal {763}[Hardware Error]: Error 0, type: fatal {763}[Hardware Error]: section_type: PCIe error {763}[Hardware Error]: port_type: 0, PCIe end point {763}[Hardware Error]: version: 4.0 {763}[Hardware Error]: command: 0x0000, status: 0x0010 {763}[Hardware Error]: device_id: 0000:82:00.0 {763}[Hardware Error]: slot: 0 {763}[Hardware Error]: secondary_bus: 0x00 {763}[Hardware Error]: vendor_id: 0x8086, device_id: 0x10fb {763}[Hardware Error]: class_code: 000002 Kernel panic - not syncing: Fatal hardware error! This issue was imported by the patch, '37448adfc7ce ("aerdrv: Move cper_print_aer() call out of interrupt context")'. To fix this issue, this patch adds print of AER info in cper_print_pcie() for fatal error. Here is the example log after this patch applied: {24}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 10 {24}[Hardware Error]: event severity: fatal {24}[Hardware Error]: Error 0, type: fatal {24}[Hardware Error]: section_type: PCIe error {24}[Hardware Error]: port_type: 0, PCIe end point {24}[Hardware Error]: version: 4.0 {24}[Hardware Error]: command: 0x0546, status: 0x4010 {24}[Hardware Error]: device_id: 0000:01:00.0 {24}[Hardware Error]: slot: 0 {24}[Hardware Error]: secondary_bus: 0x00 {24}[Hardware Error]: vendor_id: 0x15b3, device_id: 0x1019 {24}[Hardware Error]: class_code: 000002 {24}[Hardware Error]: aer_uncor_status: 0x00040000, aer_uncor_mask: 0x00000000 {24}[Hardware Error]: aer_uncor_severity: 0x00062010 {24}[Hardware Error]: TLP Header: 000000c0 01010000 00000001 00000000 Kernel panic - not syncing: Fatal hardware error! Fixes: 37448adfc7ce ("aerdrv: Move cper_print_aer() call out of interrupt context") Signed-off-by: Xiaofei Tan Reviewed-by: James Morse --- drivers/firmware/efi/cper.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index 8fa977c..78b8922 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -390,6 +390,21 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie, printk( "%s""bridge: secondary_status: 0x%04x, control: 0x%04x\n", pfx, pcie->bridge.secondary_status, pcie->bridge.control); + + /* Fatal errors call __ghes_panic() before AER handler prints this */ + if (pcie->validation_bits & CPER_PCIE_VALID_AER_INFO && + gdata->error_severity & CPER_SEV_FATAL) { + struct aer_capability_regs *aer; + + aer = (struct aer_capability_regs *)pcie->aer_info; + printk("%saer_uncor_status: 0x%08x, aer_uncor_mask: 0x%08x\n", + pfx, aer->uncor_status, aer->uncor_mask); + printk("%saer_uncor_severity: 0x%08x\n", + pfx, aer->uncor_severity); + printk("%sTLP Header: %08x %08x %08x %08x\n", pfx, + aer->header_log.dw0, aer->header_log.dw1, + aer->header_log.dw2, aer->header_log.dw3); + } } static void cper_print_tstamp(const char *pfx, -- 2.8.1