From patchwork Mon Sep 25 07:44:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144256 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1050515vqu; Mon, 25 Sep 2023 01:10:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsnxEZh7SSidKsW1Q6AZ0PUuDry7sEOj2vKm3auLF5zjY7cpwQDRV6QMLcWwGPtaJL+V1E X-Received: by 2002:a05:6870:65a6:b0:1d0:da52:4235 with SMTP id fp38-20020a05687065a600b001d0da524235mr8545741oab.26.1695629454512; Mon, 25 Sep 2023 01:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695629454; cv=none; d=google.com; s=arc-20160816; b=RkFN1AOUz8woHocjkwfkgNS41VnRA1S3yn//8rWljsy9P988Cpcyu42sYCBxegQ+te +pS69ZANnlxUZbBfFcQ6TfDy/UA79udVBW3cMYx3GseFAJ6f6KXMTnv1QI5b4cT6WMIf kxcmWG1sZKT2NhWBpyCK+Eu0etk4I2csOi+HdkmaKa7r7ViK7Q0TBs5tUAog56e2nRMv Z7BBqMizO/iMHIJkTEOysyp4P5k9F++bfVsfDJzBtTBu4ESPlF7XY28hbqQJNSoQ3Q3x m3mVpkIunDyH1iFAZRkmGftM3yyjSYWL7wvTZ1JHcEHz/zNQHfbQQLHBoRI1swHy3Xwh i+Tw== 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=wo5aRE7v49PP21OSTtQfTSVkBgWIoZUj6tUwQmFvobc=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=SfudOmEnqW/ELfewK5S05fx3r0K7Nhfyw9gg2XrecZUqkXaFJ23PiP/DrRw/iCHyLJ pvxa5p2ZlWCHSCVGBLduf+9NVRZzMwE/3mqDgNf5jUwlm+7DwrlOZkl8a7N/quzH8swo oSWY7rg7AciV1TH/s3cmgispo1zK/uybUzn/WQIYXh5lEyYnHzBy9A5z32ljM1X6NYdg DhjDKPMpwDhcVYNUEeWlw0u1jDbZgIg6vN2SaJtlPKPdiIphcSfw8MCwJuxU893/FagI KtZDKgnOqqF24CrheyR3gR+AJbQVBUS9jvM4RW0f3FrwaBLdeC+4rNQ71a9TsbqHR93p y0Nw== 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:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id k33-20020a634b61000000b00578a084850dsi9276110pgl.720.2023.09.25.01.10.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:10:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 32A278080C61; Mon, 25 Sep 2023 00:45:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232450AbjIYHor (ORCPT + 30 others); Mon, 25 Sep 2023 03:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232499AbjIYHoo (ORCPT ); Mon, 25 Sep 2023 03:44:44 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A87FFB; Mon, 25 Sep 2023 00:44:36 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R751e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vsmvsxu_1695627872; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvsxu_1695627872) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:33 +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 1/9] pstore: move pstore creator id, section type and record struct to common header Date: Mon, 25 Sep 2023 15:44:18 +0800 Message-Id: <20230925074426.97856-2-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 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:45:43 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777996351002000380 X-GMAIL-MSGID: 1777996351002000380 Move pstore creator id, section type and record struct to the common header, so that it can be use by MCE and GHES driver. Signed-off-by: Shuai Xue --- drivers/acpi/apei/erst.c | 19 ------------------- include/linux/pstore.h | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 247989060e29..528ac5eb4871 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -997,25 +997,6 @@ static struct pstore_info erst_info = { .erase = erst_clearer }; -#define CPER_CREATOR_PSTORE \ - GUID_INIT(0x75a574e3, 0x5052, 0x4b29, 0x8a, 0x8e, 0xbe, 0x2c, \ - 0x64, 0x90, 0xb8, 0x9d) -#define CPER_SECTION_TYPE_DMESG \ - GUID_INIT(0xc197e04e, 0xd545, 0x4a70, 0x9c, 0x17, 0xa5, 0x54, \ - 0x94, 0x19, 0xeb, 0x12) -#define CPER_SECTION_TYPE_DMESG_Z \ - GUID_INIT(0x4f118707, 0x04dd, 0x4055, 0xb5, 0xdd, 0x95, 0x6d, \ - 0x34, 0xdd, 0xfa, 0xc6) -#define CPER_SECTION_TYPE_MCE \ - GUID_INIT(0xfe08ffbe, 0x95e4, 0x4be7, 0xbc, 0x73, 0x40, 0x96, \ - 0x04, 0x4a, 0x38, 0xfc) - -struct cper_pstore_record { - struct cper_record_header hdr; - struct cper_section_descriptor sec_hdr; - char data[]; -} __packed; - static int reader_pos; static int erst_open_pstore(struct pstore_info *psi) diff --git a/include/linux/pstore.h b/include/linux/pstore.h index 638507a3c8ff..ad44b3baf10e 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -17,6 +17,7 @@ #include #include #include +#include struct module; @@ -210,6 +211,29 @@ struct pstore_info { extern int pstore_register(struct pstore_info *); extern void pstore_unregister(struct pstore_info *); +#define CPER_CREATOR_PSTORE \ + GUID_INIT(0x75a574e3, 0x5052, 0x4b29, 0x8a, 0x8e, 0xbe, 0x2c, \ + 0x64, 0x90, 0xb8, 0x9d) +#define CPER_SECTION_TYPE_DMESG \ + GUID_INIT(0xc197e04e, 0xd545, 0x4a70, 0x9c, 0x17, 0xa5, 0x54, \ + 0x94, 0x19, 0xeb, 0x12) +#define CPER_SECTION_TYPE_DMESG_Z \ + GUID_INIT(0x4f118707, 0x04dd, 0x4055, 0xb5, 0xdd, 0x95, 0x6d, \ + 0x34, 0xdd, 0xfa, 0xc6) +#define CPER_SECTION_TYPE_MCE \ + GUID_INIT(0xfe08ffbe, 0x95e4, 0x4be7, 0xbc, 0x73, 0x40, 0x96, \ + 0x04, 0x4a, 0x38, 0xfc) + +/* + * CPER specification (in UEFI specification 2.3 appendix N) requires + * byte-packed. + */ +struct cper_pstore_record { + struct cper_record_header hdr; + struct cper_section_descriptor sec_hdr; + char data[]; +} __packed; + struct pstore_ftrace_record { unsigned long ip; unsigned long parent_ip; From patchwork Mon Sep 25 07:44:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144258 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1051825vqu; Mon, 25 Sep 2023 01:14:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsHIZQrcP5ysf6TXb9mrVpRq92AaOUWz6tZv3SkHRsaNEPQQb5ijX8hyxxWZe08sFDOiH5 X-Received: by 2002:a05:6a00:1d18:b0:68f:be13:6c16 with SMTP id a24-20020a056a001d1800b0068fbe136c16mr7180814pfx.2.1695629647642; Mon, 25 Sep 2023 01:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695629647; cv=none; d=google.com; s=arc-20160816; b=CDFX6P903V/h3qZOHynuglKtvJJ6Wy2UiZPvBKXqhF8vWjhOa7eCsJVerr8e9/7aCE 48okbFZ337ypulHhcso9rguoX7Tu0DPwkUcCxue1Wmw8eDK8pI9ed7nUW+8POTLoxf81 wIfzSAF4z1vPuJqaokhuFLhgHUaOdEAMs98XdNkJM7iXfKG6CuRA+yjlDdJcDdGEV7D0 9Ghs6My6VAo/g38hy71D2/lceopdCSHTnH5ZI+S3kedHspnKBPh7DDyt7LAOEvF1oQ1q vntEwqjgygJfGqT43xwiWBbNIL8VI7erqE2aLq9vRNQ+YO6qFbKU8CxaAMiEI089cIeZ Jl6A== 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=YKjs8b9TFqPjTB0Zw1QwZaOeXiuTdJjK6ZS/EhOLCwM=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=Ipw0/lHMkMSi6JGSeiUAFylBcpz3YgNfwfP4Vmd0GeJXy25JRqze8sWLHC01Yn4OAr IufzD8IfQLYo1ZyO9+REEWB70BfdScDL4/f8X+fkUN+1oA+FiiPwOIDZrLzz8nwjuu16 +tB8LLHP6+eRph5wCuwJ5KUgtuA39tkaAjirlXfZBBX+FTRKxrhmCvU63rec2+u5Kbth 6QlhqBRa5jl9nQPypBLqR1ZRiptp6ApP984k0igZ7mMhVZMzeXf/5F64v0RNQAd8z1fU ek86MB2xaCjKmcMwW0A2zolIjY9aRXWaESi1vfrf/+kY6PgsxR27FAi8VNKozVG/OhYd bLpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id cv7-20020a056a0044c700b00690cc6f7598si9579227pfb.247.2023.09.25.01.14.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:14:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 4D3C2825CD23; Mon, 25 Sep 2023 00:44:53 -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 S232482AbjIYHow (ORCPT + 30 others); Mon, 25 Sep 2023 03:44:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232426AbjIYHoq (ORCPT ); Mon, 25 Sep 2023 03:44:46 -0400 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD800103; Mon, 25 Sep 2023 00:44:38 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vsmvsyw_1695627874; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvsyw_1695627874) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:35 +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 2/9] ACPI: APEI: Use common ERST struct to read/write serialized MCE record Date: Mon, 25 Sep 2023 15:44:19 +0800 Message-Id: <20230925074426.97856-3-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 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:44:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777996553306181191 X-GMAIL-MSGID: 1777996553306181191 It is confusing to define two creator IDs with the same GUID number, and unnecessary to define the same data structure twice. Use common ERST struct to read/write MCE record. Signed-off-by: Shuai Xue --- arch/x86/kernel/cpu/mce/apei.c | 82 +++++++++++++++------------------- 1 file changed, 35 insertions(+), 47 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/apei.c b/arch/x86/kernel/cpu/mce/apei.c index 8ed341714686..f732f8902c86 100644 --- a/arch/x86/kernel/cpu/mce/apei.c +++ b/arch/x86/kernel/cpu/mce/apei.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -124,58 +125,45 @@ int apei_smca_report_x86_error(struct cper_ia_proc_ctx *ctx_info, u64 lapic_id) return 0; } -#define CPER_CREATOR_MCE \ - GUID_INIT(0x75a574e3, 0x5052, 0x4b29, 0x8a, 0x8e, 0xbe, 0x2c, \ - 0x64, 0x90, 0xb8, 0x9d) -#define CPER_SECTION_TYPE_MCE \ - GUID_INIT(0xfe08ffbe, 0x95e4, 0x4be7, 0xbc, 0x73, 0x40, 0x96, \ - 0x04, 0x4a, 0x38, 0xfc) - -/* - * CPER specification (in UEFI specification 2.3 appendix N) requires - * byte-packed. - */ -struct cper_mce_record { - struct cper_record_header hdr; - struct cper_section_descriptor sec_hdr; - struct mce mce; -} __packed; - int apei_write_mce(struct mce *m) { - struct cper_mce_record rcd; - - memset(&rcd, 0, sizeof(rcd)); - memcpy(rcd.hdr.signature, CPER_SIG_RECORD, CPER_SIG_SIZE); - rcd.hdr.revision = CPER_RECORD_REV; - rcd.hdr.signature_end = CPER_SIG_END; - rcd.hdr.section_count = 1; - rcd.hdr.error_severity = CPER_SEV_FATAL; + struct cper_pstore_record *rcd; + int record_len = sizeof(*m) + sizeof(*rcd); + int data_len = sizeof(*m); + + rcd = kmalloc(record_len, GFP_KERNEL); + memset(rcd, 0, sizeof(*rcd)); + + memcpy(rcd->hdr.signature, CPER_SIG_RECORD, CPER_SIG_SIZE); + rcd->hdr.revision = CPER_RECORD_REV; + rcd->hdr.signature_end = CPER_SIG_END; + rcd->hdr.section_count = 1; + rcd->hdr.error_severity = CPER_SEV_FATAL; /* timestamp, platform_id, partition_id are all invalid */ - rcd.hdr.validation_bits = 0; - rcd.hdr.record_length = sizeof(rcd); - rcd.hdr.creator_id = CPER_CREATOR_MCE; - rcd.hdr.notification_type = CPER_NOTIFY_MCE; - rcd.hdr.record_id = cper_next_record_id(); - rcd.hdr.flags = CPER_HW_ERROR_FLAGS_PREVERR; - - rcd.sec_hdr.section_offset = (void *)&rcd.mce - (void *)&rcd; - rcd.sec_hdr.section_length = sizeof(rcd.mce); - rcd.sec_hdr.revision = CPER_SEC_REV; - /* fru_id and fru_text is invalid */ - rcd.sec_hdr.validation_bits = 0; - rcd.sec_hdr.flags = CPER_SEC_PRIMARY; - rcd.sec_hdr.section_type = CPER_SECTION_TYPE_MCE; - rcd.sec_hdr.section_severity = CPER_SEV_FATAL; - - memcpy(&rcd.mce, m, sizeof(*m)); - - return erst_write(&rcd.hdr); + rcd->hdr.validation_bits = 0; + rcd->hdr.record_length = record_len; + rcd->hdr.creator_id = CPER_CREATOR_PSTORE; + rcd->hdr.notification_type = CPER_NOTIFY_MCE; + rcd->hdr.record_id = cper_next_record_id(); + rcd->hdr.flags = CPER_HW_ERROR_FLAGS_PREVERR; + + rcd->sec_hdr.section_offset = (void *)&rcd->data - (void *)&rcd; + rcd->sec_hdr.section_length = data_len; + rcd->sec_hdr.revision = CPER_SEC_REV; + /* ->ru_id and fru_text is invalid */ + rcd->sec_hdr.validation_bits = 0; + rcd->sec_hdr.flags = CPER_SEC_PRIMARY; + rcd->sec_hdr.section_type = CPER_SECTION_TYPE_MCE; + rcd->sec_hdr.section_severity = CPER_SEV_FATAL; + + memcpy(rcd->data, m, data_len); + + return erst_write(&rcd->hdr); } ssize_t apei_read_mce(struct mce *m, u64 *record_id) { - struct cper_mce_record rcd; + struct cper_pstore_record rcd; int rc, pos; rc = erst_get_record_id_begin(&pos); @@ -189,14 +177,14 @@ ssize_t apei_read_mce(struct mce *m, u64 *record_id) if (*record_id == APEI_ERST_INVALID_RECORD_ID) goto out; rc = erst_read_record(*record_id, &rcd.hdr, sizeof(rcd), sizeof(rcd), - &CPER_CREATOR_MCE); + &CPER_CREATOR_PSTORE); /* someone else has cleared the record, try next one */ if (rc == -ENOENT) goto retry; else if (rc < 0) goto out; - memcpy(m, &rcd.mce, sizeof(*m)); + memcpy(m, &rcd.data, sizeof(*m)); rc = sizeof(*m); out: erst_get_record_id_end(); From patchwork Mon Sep 25 07:44:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144260 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1052109vqu; Mon, 25 Sep 2023 01:14:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGRoWIcSXgXxJKeMFgjmD8ScsI8mjzcSm1KjVDyVVgMtSMrHevNZ/moxT2Cj+5KvkJvWhKI X-Received: by 2002:a05:6a00:1d18:b0:68f:be13:6c16 with SMTP id a24-20020a056a001d1800b0068fbe136c16mr7181974pfx.2.1695629694187; Mon, 25 Sep 2023 01:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695629694; cv=none; d=google.com; s=arc-20160816; b=dF4VoW/lq+v0S9rCHEB35ety8wDAMXwqS9KYl3HMlgKkTSCcMQrvB1w1mJtSUvmWAB ejbXKoA9YucO37QfDgmIIHK24pLQUW6hbKNs5/n30zknOXzxUEOjD42Jc/ZmPBC8A5jd Z49lfEH3Lf/CW9HhSZsqqm42Q7GLKzo2fszlxdvL5z+eXiWaIa+YxWkRjGiSrplauq+I 3bCZaeJHZm8NXlX2H3xXTdx5yqLMooE1pOS0sV320vFkVh2AwJwaU74Ryl7imvnYBSPO 5OM1DndroNBTAl2rwH0pGORXE7YjOpw6Ednr4ZBBtgevcfbANyZK41Z59ajCLzObjVdu +yJA== 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=57fH6m3mujKBOG6QFM7l0e+IGEzQP3AdayBX+e2YKQU=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=UE8qZieSiMc8wbRHW6s4OKiEtoVHUGvmtq8x8YOorARk+fO70heLUjw54J3dpi27G4 20dtVZ3rWNHzy7v2ZWm2bFgyDFpznEs9x0Uwa5JTUvjC/2DP+iMjFQKB/NaH2AbaVgzg X4CoV8meDq36I9RagpmboulbhyOLTwIlQdbTCF3kjjFpPutX1U9ORqpyPu4WdMPxmAzB 8lW8SKxLhjQ4OB7z8Pia/gGNX9F/+Ayc6CnrNMdWrPAYqVuXuxCNkK1TQDW3PKa+PFlg pfaYrWASr05xtfaUYpCdNqPDYnMaego/eD0p6OoghycTtZH83O2IN7OGDoO8FVHBJiCs CBJA== 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 Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id m8-20020a056a00080800b0068fa8499af1si9973866pfk.11.2023.09.25.01.14.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:14:54 -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 6800A82A41FA; Mon, 25 Sep 2023 00:45:11 -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 S232526AbjIYHpD (ORCPT + 30 others); Mon, 25 Sep 2023 03:45:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232466AbjIYHov (ORCPT ); Mon, 25 Sep 2023 03:44:51 -0400 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90CB2DA; Mon, 25 Sep 2023 00:44:42 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R831e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vsmvt-0_1695627876; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvt-0_1695627876) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:37 +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 3/9] ACPI: APEI: ERST: Emit the mce_record tracepoint Date: Mon, 25 Sep 2023 15:44:20 +0800 Message-Id: <20230925074426.97856-4-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 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:11 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777996602066168960 X-GMAIL-MSGID: 1777996602066168960 After /dev/mcelog character device deprecated by commit 5de97c9f6d85 ("x86/mce: Factor out and deprecate the /dev/mcelog driver"), the serialized hardware error log, a.k.a MCE record, of previous boot in persistent storage is not collected via APEI ERST. Emit the mce_record tracepoint so that it can consumed by the new generation rasdaemon. Signed-off-by: Shuai Xue --- drivers/acpi/apei/erst.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 528ac5eb4871..82f57aaf89ad 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -26,6 +26,10 @@ #include #include /* kvfree() */ #include +#ifdef CONFIG_X86_MCE +/* only define CREATE_TRACE_POINTS once */ +#include +#endif #include "apei-internal.h" @@ -1063,8 +1067,12 @@ static ssize_t erst_reader(struct pstore_record *record) record->compressed = true; } else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_DMESG)) record->type = PSTORE_TYPE_DMESG; - else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_MCE)) + else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SECTION_TYPE_MCE)) { +#ifdef CONFIG_X86_MCE + trace_mce_record((struct mce *)rcd->data); +#endif record->type = PSTORE_TYPE_MCE; + } else record->type = PSTORE_TYPE_MAX; From patchwork Mon Sep 25 07:44:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144257 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1051432vqu; Mon, 25 Sep 2023 01:13:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWlXbi5jUtzZDs3rX2CEOqsEKPEnAPA6GhCW82FUDqQowmW+veoRipqfqMkM9kiQOZjsqb X-Received: by 2002:a17:902:dac1:b0:1c6:1d3d:b412 with SMTP id q1-20020a170902dac100b001c61d3db412mr1207804plx.30.1695629584648; Mon, 25 Sep 2023 01:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695629584; cv=none; d=google.com; s=arc-20160816; b=XSk1B2JM8D3hGppdMPjJJL6ZoYngxxrTxePknQ1d6h0sOihnmG9AyOXEHELjdXx3xc sWaQq3zT6Q0nMx2NmG1xGLJgoqioBtEOu7bErwO+9QE1qqeW3A7iD22Yp32JYj56BmOx 3oNNKa4sFj4fhJyJNnj11lJvGhYDNKNx93708N/wrRNtaRZi4pLSQBPRykiAL294poHH nP44Lk1cnzRiuefHmqk+9b9n4QbPfkkrGeGyoOyCO5UnOZM4t6JEi2L7sPb3BAA6EZm2 4RDUHTuSL39SrZLGudV61iv7Xs+DTumEkfpad+E0fOYuleCqKJFQPGiIJiylSwntP8gS fBww== 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=a0ykU0DCtEpSTz+Rb1yKUiw+DgcibIyW0sHVZoEC2JI=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=RKZWeQKb1ehD3jfnKSDr35LkVzJy3BzQcOSUYlNM5v89+yWckjq9Y+/Xo5uJDfpCGV PSvbg8I7SYTl1xeXCbT/OeVzAqC5wHHoBl9Cg+lBWrgPscBxBUc+OKLeYPGbtNNW4udO 3ECTkST+FFuqf4Po09VCBMuUn9Upv6zZv6GoqLz04zJxHG2Y3/eFrMxpEeLUzSq2iWZT VnIEVfrrghRsKMwlVaFy60R0UZRB7cZ6Zfww1FNm4uhax/g/O2x/MP5gk/oxKha8AwNq S8T42vLtcL0uW019CF1QF77ozf7VjWdNIPzabsuu+olZOQFz98OqVZg4zlbGTg8XlkTr /INA== 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 Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id s17-20020a170902c65100b001b3d27ca12fsi8782252pls.207.2023.09.25.01.13.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:13:04 -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 A43798283A47; Mon, 25 Sep 2023 00:45:06 -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 S232474AbjIYHo6 (ORCPT + 30 others); Mon, 25 Sep 2023 03:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232462AbjIYHou (ORCPT ); Mon, 25 Sep 2023 03:44:50 -0400 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E97B9EE; Mon, 25 Sep 2023 00:44:42 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vsmvt.C_1695627878; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvt.C_1695627878) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:39 +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 4/9] ACPI: tables: change section_type of generic error data as guid_t Date: Mon, 25 Sep 2023 15:44:21 +0800 Message-Id: <20230925074426.97856-5-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 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, 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:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777996487318119875 X-GMAIL-MSGID: 1777996487318119875 The section_type of generic error data is now an array of u8. It is a burden to perform explicit type casting from u8[] to guid_t, and to copy the guid_t values to u8[] using memcpy. To alleviate this issue, change the section_type from an array to the type guid_t, which is also consistent with the cper_section_descriptor. Signed-off-by: Shuai Xue --- drivers/acpi/acpi_extlog.c | 2 +- drivers/acpi/apei/ghes.c | 2 +- drivers/firmware/efi/cper.c | 2 +- include/acpi/actbl1.h | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c index e120a96e1eae..d46435792d64 100644 --- a/drivers/acpi/acpi_extlog.c +++ b/drivers/acpi/acpi_extlog.c @@ -170,7 +170,7 @@ static int extlog_print(struct notifier_block *nb, unsigned long val, fru_text = gdata->fru_text; else fru_text = ""; - sec_type = (guid_t *)gdata->section_type; + sec_type = &gdata->section_type; if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) { struct cper_sec_mem_err *mem = acpi_hest_get_payload(gdata); diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index ef59d6ea16da..d14e00751161 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -648,7 +648,7 @@ static bool ghes_do_proc(struct ghes *ghes, sev = ghes_severity(estatus->error_severity); apei_estatus_for_each_section(estatus, gdata) { - sec_type = (guid_t *)gdata->section_type; + sec_type = &gdata->section_type; sec_sev = ghes_severity(gdata->error_severity); if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID) fru_id = (guid_t *)gdata->fru_id; diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c index 35c37f667781..a2ba70aa928f 100644 --- a/drivers/firmware/efi/cper.c +++ b/drivers/firmware/efi/cper.c @@ -527,7 +527,7 @@ static void cper_estatus_print_section(const char *pfx, struct acpi_hest_generic_data *gdata, int sec_no) { - guid_t *sec_type = (guid_t *)gdata->section_type; + guid_t *sec_type = &gdata->section_type; __u16 severity; char newpfx[64]; diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index 8d5572ad48cb..ab25a8495a43 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -19,6 +19,7 @@ * ******************************************************************************/ +#include /* * Values for description table header signatures for tables defined in this * file. Useful because they make it more difficult to inadvertently type in @@ -1637,7 +1638,7 @@ struct acpi_hest_generic_status { /* Generic Error Data entry */ struct acpi_hest_generic_data { - u8 section_type[16]; + guid_t section_type; u32 error_severity; u16 revision; u8 validation_bits; @@ -1650,7 +1651,7 @@ struct acpi_hest_generic_data { /* Extension for revision 0x0300 */ struct acpi_hest_generic_data_v300 { - u8 section_type[16]; + guid_t section_type; u32 error_severity; u16 revision; u8 validation_bits; From patchwork Mon Sep 25 07:44:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144273 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1054328vqu; Mon, 25 Sep 2023 01:20:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGr/iIsgQBShWvHPeVoIdZqDRcyflMb4xWmb4zJ5TqloR1ejK6QC1d+/5oFYmxOdClhcH9s X-Received: by 2002:a17:90b:1103:b0:269:154b:6290 with SMTP id gi3-20020a17090b110300b00269154b6290mr5101477pjb.24.1695630054002; Mon, 25 Sep 2023 01:20:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695630053; cv=none; d=google.com; s=arc-20160816; b=RQeQB61LwmzFiTdEAEGN5rBFbZuYnoExB3Y8yfAn25HboAaYJ4ccj1NQ8BHvqwkegk j5gfJ0oOCysO4T81UuAqn4KZsdTKG667KUA7ItcpoqQuPc1nWc1lPvFZvGZTl8gBvnRD DK/hbfeCB/G1OYHonvgFFzrTSfjIu1q38BRczV2Xey5FtvVy6MeGD9MVfLznXyABNvCy n49yuTTIfVdRmdCna9NfymePp0DVF7jgCLVjKW+KM2ZyV26wtkH3XjXuesS9iopxLTSx Hyyp0SuziYXumDHY+0rci6xhhzFC3vzoUppjk/frVtYQxdDVnlGFrPNd58ctnLVkuKk1 u4wA== 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=jQh3T0VYNzdVNjcoAb/56Rb1Mc3Qg+EexF0fmrIY7jY=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=E3iaX/9rxz6tiMWHAWzcN+2UW4Ko6dGIj/zTr6em7yuJ/0xWxnyZnarC6lUCifdlyI boFHR3YmRqQlE3a4aU7O2UMi/khpPwKcH1hrlUxBcBckkiQdAoFUU3Aal3B68H7Wty7V m6TXEb60qpRg5eojSjzqaWRe1+Ne/LwBXdPIujG0rKEpWXIi9F6nNA4dtr9e942U6Q/n acibCSZVAKhoIDvis2/zPo7xinJUbGJ6zg/q/vtQMo3R28gK8lxOR335L969FFj3hh9/ Jia+XunY036ExCEltXYLk7iJh8J8qRZEvbguCZqltQ3aDZgasOfFOiVZ8oVdn/UaEL8S X5AQ== 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 Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id ob3-20020a17090b390300b00277496b6ec1si3253644pjb.34.2023.09.25.01.20.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:20:53 -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 28EB182A676D; Mon, 25 Sep 2023 00:45:15 -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 S232513AbjIYHpH (ORCPT + 30 others); Mon, 25 Sep 2023 03:45:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232494AbjIYHox (ORCPT ); Mon, 25 Sep 2023 03:44:53 -0400 Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9C64FC; Mon, 25 Sep 2023 00:44:45 -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=ay29a033018045192;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vsmvt.x_1695627880; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvt.x_1695627880) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:41 +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 5/9] ACPI: APEI: GHES: Use ERST to serialize APEI generic error before panic Date: Mon, 25 Sep 2023 15:44:22 +0800 Message-Id: <20230925074426.97856-6-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 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:15 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777996979810099310 X-GMAIL-MSGID: 1777996979810099310 In certain scenarios (ie. hosts/guests with root filesystems on NFS/iSCSI where networking software and/or hardware fails, and thus kdump fails), it is necessary to serialize hardware error information available for post-mortem debugging. Save the hardware error log into flash via ERST before go panic, the hardware error log can be gotten from the flash after system boot successful again, which is very useful in production. Signed-off-by: Shuai Xue --- drivers/acpi/apei/ghes.c | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index d14e00751161..306bced16884 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -636,6 +637,43 @@ static void ghes_defer_non_standard_event(struct acpi_hest_generic_data *gdata, schedule_work(&entry->work); } +static int ghes_serialize_estatus(struct acpi_hest_generic_data *gdata, u8 notify_type) +{ + void *err = acpi_hest_get_payload(gdata); + int data_len = gdata->error_data_length; + struct cper_pstore_record *rcd; + int record_len = data_len + sizeof(*rcd); + + rcd = kmalloc(record_len, GFP_KERNEL); + memset(rcd, 0, sizeof(*rcd)); + + memcpy(rcd->hdr.signature, CPER_SIG_RECORD, CPER_SIG_SIZE); + rcd->hdr.revision = CPER_RECORD_REV; + rcd->hdr.signature_end = CPER_SIG_END; + rcd->hdr.section_count = 1; + rcd->hdr.error_severity = CPER_SEV_FATAL; + /* timestamp, platform_id, partition_id are all invalid */ + rcd->hdr.validation_bits = 0; + rcd->hdr.record_length = record_len; + rcd->hdr.creator_id = CPER_CREATOR_PSTORE; + rcd->hdr.notification_type = CPER_NOTIFY_MCE; + rcd->hdr.record_id = cper_next_record_id(); + rcd->hdr.flags = CPER_HW_ERROR_FLAGS_PREVERR; + + rcd->sec_hdr.section_offset = (void *)&rcd->data - (void *)&rcd; + rcd->sec_hdr.section_length = data_len; + rcd->sec_hdr.revision = CPER_SEC_REV; + /* ->ru_id and fru_text is invalid */ + rcd->sec_hdr.validation_bits = 0; + rcd->sec_hdr.flags = CPER_SEC_PRIMARY; + rcd->sec_hdr.section_type = gdata->section_type; + rcd->sec_hdr.section_severity = gdata->error_severity; + + memcpy(&rcd->data, err, data_len); + + return erst_write(&rcd->hdr); +} + static bool ghes_do_proc(struct ghes *ghes, const struct acpi_hest_generic_status *estatus) { @@ -861,10 +899,16 @@ static void __ghes_panic(struct ghes *ghes, struct acpi_hest_generic_status *estatus, u64 buf_paddr, enum fixed_addresses fixmap_idx) { + struct acpi_hest_generic_data *gdata; + u8 notify_type = ghes->generic->notify.type; + __ghes_print_estatus(KERN_EMERG, ghes->generic, estatus); ghes_clear_estatus(ghes, estatus, buf_paddr, fixmap_idx); + apei_estatus_for_each_section(estatus, gdata) + ghes_serialize_estatus(gdata, notify_type); + /* reboot to log the error! */ if (!panic_timeout) panic_timeout = ghes_panic_timeout; From patchwork Mon Sep 25 07:44:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144253 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1045020vqu; Mon, 25 Sep 2023 00:58:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEAvigXv+FKS0mcHzFrmHM+IPeJ3+fcNnVCp9sDPEujjwr1L/8nxeqTyYLwNKddUa6gqWII X-Received: by 2002:a05:6a00:1505:b0:686:6e90:a99b with SMTP id q5-20020a056a00150500b006866e90a99bmr5245557pfu.25.1695628735825; Mon, 25 Sep 2023 00:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695628735; cv=none; d=google.com; s=arc-20160816; b=RWwfu4iePfGMHWsxX22g0DMxmQ7mUNx+qwA4iHEHJ4snEDO67uZKUlFu7K95xhhNd/ xQuU7Nm/+w/5XYt5DUu8wCtkUvTG4zv3zn9N1yo1aRZEAYSz9jbQtwrrHH3u+abGp2Mu prkxGz6PH2yOHDLF18KxilE8sXxfE34qYsB1L7SpNYtqpsS5fVncYwhbtL8wDsmFIumE 2hr0b/kGgDwEIpeB3WVhEpzj+9sXAvBrQASgA3Ry2LIycotijbiWmYuv3sMkFSe9My+K uYp6K2qYI7gadTcv2cBMi6lLhAVopPhjj18yXhk5UhiVitOoBJ1yf+FORw40fISvI1X6 wUpA== 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=TSCC7sBHUUkWNT42neO6W7GplSGMhDrW9OglNk18Kaw=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=FV33zMWC3QE+FfZMrQt38BSxCVY82O8AlHHDtqofEr0J5uLMPyRnMP7IA6KiVKNBSY GYUgrd8EsNf1Spj24cbR4DT2w3lKC2lXN1kNgFM9lAKFdAbfq8RUJ5Yk8x8854YKzrdP FZDLtShsE1zcz9uA/aP2gtwgveL+ipGy24Wlj1qFFdmoWa5vppPcwZwZ+bLVlEj86ZSD lU6QAln/AiVkcWC587QGf9M832cZNPbfMXUjkhJSPjB8umtL12z2SED7+p8gWkGbZJpV uAV11v4e6M0+392/wgCNttZy/F/z4MBt7Pvhk5M+l2mqo8padOybQGjIdJ/SjU/dnUy9 bSww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id cu4-20020a056a00448400b0068a6f6d9f85si9515070pfb.140.2023.09.25.00.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 00:58:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 605D98050025; Mon, 25 Sep 2023 00:45:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232558AbjIYHpS (ORCPT + 30 others); Mon, 25 Sep 2023 03:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232520AbjIYHpC (ORCPT ); Mon, 25 Sep 2023 03:45:02 -0400 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A0AC112; Mon, 25 Sep 2023 00:44:46 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;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_---0Vsmvt0t_1695627882; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvt0t_1695627882) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:43 +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 6/9] ACPI: APEI: GHES: export ghes_report_chain Date: Mon, 25 Sep 2023 15:44:23 +0800 Message-Id: <20230925074426.97856-7-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 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:45:31 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777995597260200604 X-GMAIL-MSGID: 1777995597260200604 Export ghes_report_chain so that it can be kicked by other drivers. Signed-off-by: Shuai Xue --- drivers/acpi/apei/ghes.c | 2 +- include/acpi/ghes.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 306bced16884..8acd3d56719a 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -95,7 +95,7 @@ #define FIX_APEI_GHES_SDEI_CRITICAL __end_of_fixed_addresses #endif -static ATOMIC_NOTIFIER_HEAD(ghes_report_chain); +ATOMIC_NOTIFIER_HEAD(ghes_report_chain); static inline bool is_hest_type_generic_v2(struct ghes *ghes) { diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h index 3c8bba9f1114..151567353e33 100644 --- a/include/acpi/ghes.h +++ b/include/acpi/ghes.h @@ -126,7 +126,7 @@ int ghes_notify_sea(void); static inline int ghes_notify_sea(void) { return -ENOENT; } #endif -struct notifier_block; +extern struct atomic_notifier_head ghes_report_chain; extern void ghes_register_report_chain(struct notifier_block *nb); extern void ghes_unregister_report_chain(struct notifier_block *nb); #endif /* GHES_H */ From patchwork Mon Sep 25 07:44:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144252 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1045021vqu; Mon, 25 Sep 2023 00:58:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGoczeTc9GDsGC61OXdbAk062s8Dj99e4jTdQ5HXLjgfOHDPYtF6ErY8zF30ARtcdMeUAyK X-Received: by 2002:a05:6a00:14cc:b0:68f:cbd3:5b01 with SMTP id w12-20020a056a0014cc00b0068fcbd35b01mr16169006pfu.13.1695628735800; Mon, 25 Sep 2023 00:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695628735; cv=none; d=google.com; s=arc-20160816; b=zYgBGZrZO6mVV5zv/l3slRVdjBVfsAyn2V6OwGmVGQmcFlbhRaN1t0vW71UCNz8NPF nriHXzNyg2Uy+QKEvENDa2qHTKU5jAdmENWCvigfQAScajbTeI6egyxdnQRyHP4DQdYH 8AUzlBniUjAQTjDD41DJVkc6doBmI3wc0s1l3JYJeWLm3wD894oedFOnajX7Gf5wgndd uHdPJE+V9VQ0FWmfRDTfm+Dfem789/MMM7b84r9x/azgRgMX2XFHnpqP09Ih4pGKvgXR +4t0jVoGi8HIqiRUne1B6dl6Uol01BPzz2k51HclILds8qc/Hq1WUy8gTF0ZhP0HHThh a/ZQ== 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=luepcWIOq11Tj83EMNBB7SiwW/Igtjbae4eTlbz6RvE=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=JSsCreXFsnFvY8yQ6f5CB5zrtf5Am52HvdcffUN1Jv99KJu6PusWISFNFK5fHcb1r0 S1vWvjfn29xwpSVxHCZHqkdpu2GCSKbdFckt6pfhzecfCEYsaFtt9aGlE4oEuoTKB2qS DNMGvnAmm2XMM8GaLHbhfzw8U7qVbsCOEnHjiEe9iJMjJfIwl9ChW+DQbHW55C+vN3l9 lrc2+k0B3mZnkOfI9bnQTgwhdWSkPwVMZQ4vVcGYBfP/ur+ASIIAjKknvD45XVQepjFh DldWpSZPVff88NxSvx4v+5fnNgKfH3Qd9DpdnyUQV1j42fFK4r74tVJDd0vKJ1xhTMZb DfiQ== 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:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id cf4-20020a056a02084400b00578b2728aa4si9037409pgb.129.2023.09.25.00.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 00:58:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (Postfix) with ESMTP id 906DC805F2F4; Mon, 25 Sep 2023 00:45:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232615AbjIYHpV (ORCPT + 30 others); Mon, 25 Sep 2023 03:45:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232518AbjIYHpQ (ORCPT ); Mon, 25 Sep 2023 03:45:16 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E69EB196; Mon, 25 Sep 2023 00:44:49 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R451e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vsmvt1q_1695627884; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvt1q_1695627884) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:45 +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 7/9] ACPI: APEI: ESRT: kick ghes_report_chain notifier to report serialized memory errors Date: Mon, 25 Sep 2023 15:44:24 +0800 Message-Id: <20230925074426.97856-8-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 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:45:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777995597213188930 X-GMAIL-MSGID: 1777995597213188930 Introduce a new pstore_record type, PSTORE_TYPE_CPER_MEM, so that serialized memory errors can be retrieved and saved as a file in pstore file system. While the serialized errors is retrieved from ERST backend, kick ghes_report_chain notifier. Signed-off-by: Shuai Xue --- drivers/acpi/apei/erst.c | 5 +++++ fs/pstore/platform.c | 1 + include/linux/pstore.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index 82f57aaf89ad..786d46c767ee 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -26,6 +26,7 @@ #include #include /* kvfree() */ #include +#include #ifdef CONFIG_X86_MCE /* only define CREATE_TRACE_POINTS once */ #include @@ -1072,6 +1073,10 @@ static ssize_t erst_reader(struct pstore_record *record) trace_mce_record((struct mce *)rcd->data); #endif record->type = PSTORE_TYPE_MCE; + } else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SEC_PLATFORM_MEM)) { + 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 record->type = PSTORE_TYPE_MAX; diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index e5bca9a004cc..4e63ac8be755 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -51,6 +51,7 @@ static const char * const pstore_type_names[] = { "powerpc-common", "pmsg", "powerpc-opal", + "cper-mem", }; static int pstore_new_entry; diff --git a/include/linux/pstore.h b/include/linux/pstore.h index ad44b3baf10e..d18ecaacd1b5 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -40,6 +40,9 @@ enum pstore_type_id { PSTORE_TYPE_PMSG = 7, PSTORE_TYPE_PPC_OPAL = 8, + /* APEI section */ + PSTORE_TYPE_CPER_MEM = 9, + /* End of the list */ PSTORE_TYPE_MAX }; From patchwork Mon Sep 25 07:44:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144274 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1054384vqu; Mon, 25 Sep 2023 01:21:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAiP2dvtwvGoJ/dLom9mvlI64E6pX8kQ9QthVXdA1v64EEdVC1t08ix9ZW/InN1qnAgZS/ X-Received: by 2002:a17:90a:fa08:b0:273:e64c:f22e with SMTP id cm8-20020a17090afa0800b00273e64cf22emr3401423pjb.29.1695630061400; Mon, 25 Sep 2023 01:21:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695630061; cv=none; d=google.com; s=arc-20160816; b=Kg5G7vUmziJezvj6WprzecG4AEDRXevd4sehs9LaLvRUpZIRrSsDTE5tDFMhxaC2qv khrBRLlkjVZl6PptmlJoitgW9P0DuEx8Zxb5uw9+6xrENzD2zfzvEYDr4MaSgMVoObfl W0Eb2KC3O4aozrAxlmY65NlyF7O8RjnyQ7SpI8/uLu78QqTv5fqDyjiZ/LSyLMZrCNrD zJGqaS5i8Gy6D+xT9yaRijRdDQ/LqOp8KTXu530JKBufdsVKr7eggIXl4X04reY9n2Ed 6P3Bc+SAQvTv/0k4Lw0irDxLxrB3I/pW83I/V06PTx0Xdp1BHKKbRt2k8ccJ5HJWLa4t yv8Q== 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 Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id n9-20020a17090a928900b002749971d84dsi11370080pjo.15.2023.09.25.01.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:21:01 -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 074D58031F1C; Mon, 25 Sep 2023 00:45:36 -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 S232528AbjIYHpY (ORCPT + 30 others); Mon, 25 Sep 2023 03:45:24 -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 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:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777996986912122981 X-GMAIL-MSGID: 1777996986912122981 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 From patchwork Mon Sep 25 07:44:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 144255 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1049494vqu; Mon, 25 Sep 2023 01:08:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGuRmMzIoZI6GGoONEedptY/u6/RUYxhfpGxbsJnUcAFb4uh7pe0b7Os/7ktHecgqc/Rd2b X-Received: by 2002:a05:6870:8452:b0:1d6:564d:cfbd with SMTP id n18-20020a056870845200b001d6564dcfbdmr8332229oak.14.1695629296984; Mon, 25 Sep 2023 01:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695629296; cv=none; d=google.com; s=arc-20160816; b=y8hHgeuEW9bRHOg2OEoKaGJvwfudRsNRQLRljkrDB6m3y2SJJ/Hd361wmzTTnrV1SU vzvU0ezdqPIJN47uVWfGTsQCEq5C1ELElsuzaULrADebPGpqPUaZ5LiIYRHOR2BpKByb X+sFK+nxVglwU03dV2gHzv5stPzt3YN6CoYwhHuIaMOXdPOkE9P9WOsXDUA1lRJf8GI/ EkBaQJLyuEtTOEx/U1kNBRkODtClnU9c9gZgnl1Kd4ZQC3nQe2IJBoWiHq8N7YX1lGas fhqdcXdrow6lI3l5pHvwwyW9JwXcBNbBeptnwnw8hYTwhxx+f89i0WGm9xzanHO6aEL8 3vcQ== 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=vsdPBur5VT6S/O686cCIpjhlt8QnoI7PIa/U13O7rIE=; fh=FxxuQyV5zt5uOZlISi71Gibj4pONM7+jzC8ls2GxgWY=; b=AjA0UkdoVZAF2tMriScIyWMIcn8Yl+mUbksncz2eCoF9rhdCi9vcCh7y2vZxTCSxgg 6wv+ddMkVoSz3E09LvK0eAMlsYX/sIv15Til+5TLUEw8yHX33K7KrL4WCbpaf3XeU4kd 5RWFONVojN4BTYlpdsTjVhl+s8wu/Fq4ESvPyRSj8nYDSSABamTMuaInw3JMoMzKD4YE 3X7jtu2SCRsonJI8yRxE98IYaMZ05aD7OsiByELTqGuKZW82df5dI1V6dVzVYDGWnPs2 YGxgYFsbuJUTvPg1Yk7eJkGORJaINMfEt6PBaXimEehxW/Tn9j4cGmjnvJVBTNqEZ8qr Olag== 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:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id r27-20020a63441b000000b005775c819f23si9622727pga.336.2023.09.25.01.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 01:08:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 610928080C6D; Mon, 25 Sep 2023 00:46:05 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232638AbjIYHpb (ORCPT + 30 others); Mon, 25 Sep 2023 03:45:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232496AbjIYHpS (ORCPT ); Mon, 25 Sep 2023 03:45:18 -0400 Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95DABCC4; Mon, 25 Sep 2023 00:44:53 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0Vsmvt44_1695627888; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0Vsmvt44_1695627888) by smtp.aliyun-inc.com; Mon, 25 Sep 2023 15:44:49 +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 9/9] ACPI: APEI: ESRT: log ARM processor error Date: Mon, 25 Sep 2023 15:44:26 +0800 Message-Id: <20230925074426.97856-10-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 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Mon, 25 Sep 2023 00:46:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777996185771220890 X-GMAIL-MSGID: 1777996185771220890 Introduce a new pstore_record type, PSTORE_TYPE_CPER_PROC_ARM, so that serialized ARM processor errors can be retrieved and saved as a file in pstore file system. While the serialized errors is retrieved from ERST backend, log it. Signed-off-by: Shuai Xue --- drivers/acpi/apei/erst.c | 6 ++++++ fs/pstore/platform.c | 1 + include/linux/pstore.h | 1 + 3 files changed, 8 insertions(+) diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index e0c44ea46acc..2b99573d1d5d 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -29,6 +29,7 @@ #include #include #include +#include #ifdef CONFIG_X86_MCE /* only define CREATE_TRACE_POINTS once */ #include @@ -1092,6 +1093,11 @@ static ssize_t erst_reader(struct pstore_record *record) cper_print_aer( pdev, AER_FATAL, (struct aer_capability_regs *)pcie_err->aer_info); + } else if (guid_equal(&rcd->sec_hdr.section_type, &CPER_SEC_PROC_ARM)) { + struct cper_sec_proc_arm *err = (struct cper_sec_proc_arm *)rcd->data; + + record->type = PSTORE_TYPE_CPER_PROC_ARM; + log_arm_hw_error(err); } else record->type = PSTORE_TYPE_MAX; diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 40a062546fe4..48ad3202284c 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -53,6 +53,7 @@ static const char * const pstore_type_names[] = { "powerpc-opal", "cper-mem", "cper-pcie", + "cper-proc-arm", }; static int pstore_new_entry; diff --git a/include/linux/pstore.h b/include/linux/pstore.h index e63f51e9c22e..83edff5aab0b 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -43,6 +43,7 @@ enum pstore_type_id { /* APEI section */ PSTORE_TYPE_CPER_MEM = 9, PSTORE_TYPE_CPER_PCIE = 10, + PSTORE_TYPE_CPER_PROC_ARM = 11, /* End of the list */ PSTORE_TYPE_MAX