Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1049530rdh; Mon, 25 Sep 2023 01:20:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEi7iLmwWheshGKRFecO4YzhsYbXwRxbANQAF8sOEBZnFHc19O9W+0hUXfVpBfSbobBpGWQ X-Received: by 2002:a17:902:ce92:b0:1c5:be64:2c71 with SMTP id f18-20020a170902ce9200b001c5be642c71mr5484358plg.8.1695630058161; Mon, 25 Sep 2023 01:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695630058; cv=none; d=google.com; s=arc-20160816; b=Z9TeLBYmEPe95HVelsgI9DFc0tR4wywkvuonpOcOgf0iDIRxAL3FHgBK9tqsTWNJnK vkreKGu9SVz8muMHZKZ2AmpsqViehPI5xMaL6j2DraB36uoKNf1qC3zU5nelmcLKR+Ug PNwybp1zSf3sYp9srTa48kv6GZCj7msAI/2c0Yg1TxdEACAtVfBn6verI6YCc0qADOEm SKvqujasvPCuSVsXGT3bw1cuxaWTpqQWOZeKW2krXENUYcTnq1SkbqJFa7IV1nPwtMyq L2vpFk02HmKAT7/hncwAY8Y9vOs86F3h705GDnxBNxkJx4NkCMQDN7c+W7n5qhH5SrkQ JK+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hd2XwEPaR9kv1QdBYvWdXRHceP3kf+VGfUrJDAZx7ZA=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=obzvqFjxM9Oa94v2DWMMFJCbFzIBgUCLcvZ/RYKqzkyhR+nqCAFkdHYrn5NBRFuYiG vgFN354vTzXeMYOWAKq+atYx/uEQGsS1iald4c5HUzkHKISIJ2zuf5UkjcUJGIlHdqAY B+W4BFF6V7msOIRAXUBIWJqJ+kpuZt5aHrRdonX8sljltM0QXXOZP6PTrgBWmi1LOwIM 2kZPQA3ZpCxymEOchS61rBvIGCZn7Rjs4NRJt+ojj7dFCxlkiPYOFjKSDw7htAnCJZRX /4TdQmeONmarxE9TUZx5HBsvZcwADcw9XmqyhTOsGkNujCQxEauku58UxhkT1pq5wYyL QTYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id l13-20020a170902f68d00b001c5fc13fb2dsi2213873plg.294.2023.09.25.01.20.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:20:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 13A9C8036E95; Mon, 25 Sep 2023 00:45:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232521AbjIYHpX (ORCPT + 99 others); Mon, 25 Sep 2023 03:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231967AbjIYHpQ (ORCPT ); Mon, 25 Sep 2023 03:45:16 -0400 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B87A1A5; Mon, 25 Sep 2023 00:44:50 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vsmvt3._1695627886; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvt3._1695627886) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:47 +0800 From: Shuai Xue To: keescook@chromium.org, tony.luck@intel.com, gpiccoli@igalia.com, rafael@kernel.org, lenb@kernel.org, james.morse@arm.com, bp@alien8.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ardb@kernel.org, robert.moore@intel.com Cc: linux-hardening@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-efi@vger.kernel.org, acpica-devel@lists.linuxfoundation.org, xueshuai@linux.alibaba.com, baolin.wang@linux.alibaba.com Subject: [RFC PATCH v2 8/9] ACPI: APEI: ESRT: print AER to report serialized PCIe errors Date: Mon, 25 Sep 2023 15:44:25 +0800 Message-Id: <20230925074426.97856-9-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230925074426.97856-1-xueshuai@linux.alibaba.com> References: <20230925074426.97856-1-xueshuai@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:45:28 -0700 (PDT) Introduce a new pstore_record type, PSTORE_TYPE_CPER_PCIE, so that serialized PCIe errors can be restrived and saved as a file in pstore file system. While the serialized PCIe errors is retrieved from ERST backend, print AER information. Signed-off-by: Shuai Xue --- drivers/acpi/apei/erst.c | 15 +++++++++++++++ fs/pstore/platform.c | 1 + include/linux/pstore.h | 1 + 3 files changed, 17 insertions(+) diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 786d46c767ee..e0c44ea46acc 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -27,6 +27,8 @@ #include /* kvfree() */ #include #include +#include +#include #ifdef CONFIG_X86_MCE /* only define CREATE_TRACE_POINTS once */ #include @@ -1077,6 +1079,19 @@ static ssize_t erst_reader(struct pstore_record *record) record->type = PSTORE_TYPE_CPER_MEM; arch_apei_report_mem_error(0x2, (struct cper_sec_mem_err *)rcd->data); atomic_notifier_call_chain(&ghes_report_chain, 0x2, rcd->data); + } else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SEC_PCIE)) { + + struct cper_sec_pcie *pcie_err = (struct cper_sec_pcie *)rcd->data; + unsigned int devfn = PCI_DEVFN(pcie_err->device_id.device, + pcie_err->device_id.function); + struct pci_dev *pdev = pci_get_domain_bus_and_slot( + pcie_err->device_id.segment, pcie_err->device_id.bus, + devfn); + + record->type = PSTORE_TYPE_CPER_PCIE; + cper_print_aer( + pdev, AER_FATAL, + (struct aer_capability_regs *)pcie_err->aer_info); } else record->type = PSTORE_TYPE_MAX; diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 4e63ac8be755..40a062546fe4 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -52,6 +52,7 @@ static const char * const pstore_type_names[] = { "pmsg", "powerpc-opal", "cper-mem", + "cper-pcie", }; static int pstore_new_entry; diff --git a/include/linux/pstore.h b/include/linux/pstore.h index d18ecaacd1b5..e63f51e9c22e 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -42,6 +42,7 @@ enum pstore_type_id { /* APEI section */ PSTORE_TYPE_CPER_MEM = 9, + PSTORE_TYPE_CPER_PCIE = 10, /* End of the list */ PSTORE_TYPE_MAX -- 2.41.0