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;