From patchwork Sat Sep 16 13:03:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 141043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1648122vqi; Sat, 16 Sep 2023 06:05:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNtBeJptR5Dj2R/Nu7JYji58YpHACumWinJ/ARzCgYbBVzjOIvif8gg6xcu6HHqKpLV9E8 X-Received: by 2002:a05:6a00:39a5:b0:68b:a137:373d with SMTP id fi37-20020a056a0039a500b0068ba137373dmr5135056pfb.17.1694869542767; Sat, 16 Sep 2023 06:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694869542; cv=none; d=google.com; s=arc-20160816; b=nsq4CTTp8NtdMvQtjBhVuSPIb3z1pipcEpA5PwDHQCjdme8/rp0Ny/OpViwv8c7m2c 0d2djhjmSOqhuyQiAeIViBMq0Ly8KSmgtkDJBRh2ibp12zc1oSFu8slBSb/k0xUgDnuC LU+TxuDVnO0wu5YHfU/WoY9as1USocSYX6Fbu9uqCRExphKF4CFSlEQ98Vh+3Ag1W/D3 FzPKiuVGGuqH5t0TtCANhI2IJaFevXkMQmI1JStJhJxSz5JgeLYkt7etsoLRO8TXj9X3 WXX39zPA64tbr/wd5Bpg5PaekrpxLSAKuK3VvC0pw2XeP6rbQrEvzMIRHfVwsNkKOxC+ R5Xg== 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=nvEt1vclSAhis9i62M4294k6B5Rh/3KxgdP/obp3WLExE+ct4PZRc8PHAxGIfhl7ls ZlveeW0updIuAtvu+6MWzFhdDz+Pe7ulxQqrMOMzWTGCA+XlHwTRfLavTmwPg/Pf+wqg +JbrSlhMjpv8ZeCmSnn9TVvfS54eISis5CD5ZincGVKZkVJqxX5MjIVF+XVRLwcD5/c/ UwnLLx0CXN2jOTztUug5RAmRAKvQEoNXUf8xAdLfSTkCfHSDMKOWKIx7g8I1ew3BM5D1 Ooejb6LyVibGvxqaK9Vc+EeoHE3zBq69+fBscqD1ejfLEAQtx5WDWdXsj5pW100jBBHg wbjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id q12-20020a056a00150c00b0068e405d9217si5245305pfu.302.2023.09.16.06.05.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 06:05:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id C72C181C4A8D; Sat, 16 Sep 2023 06:04:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239303AbjIPNDx (ORCPT + 29 others); Sat, 16 Sep 2023 09:03:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231487AbjIPNDd (ORCPT ); Sat, 16 Sep 2023 09:03:33 -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 7ACA4DD; Sat, 16 Sep 2023 06:03:26 -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=ay29a033018046050;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0VsA36tW_1694869400; Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VsA36tW_1694869400) by smtp.aliyun-inc.com; Sat, 16 Sep 2023 21:03:21 +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 1/9] pstore: move pstore creator id, section type and record struct to common header Date: Sat, 16 Sep 2023 21:03:08 +0800 Message-Id: <20230916130316.65815-2-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230916130316.65815-1-xueshuai@linux.alibaba.com> References: <20230916130316.65815-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 pete.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 (pete.vger.email [0.0.0.0]); Sat, 16 Sep 2023 06:04:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777199525816443137 X-GMAIL-MSGID: 1777199525816443137 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;