Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ACPI: APEI: GHES: Add helper for CPER CXL protocol errors checks

Move the CPER CXL protocol errors validity check out of
cxl_cper_post_prot_err() to new cxl_cper_sec_prot_err_valid() and limit
the serial number check only to CXL agents that are CXL devices (UEFI
v2.10, Appendix N.2.13).

Export the new symbol for reuse by ELOG.

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Signed-off-by: Fabio M. De Francesco <fabio.m.de.francesco@linux.intel.com>
[ rjw: Subject tweak ]
Link: https://patch.msgid.link/20260114101543.85926-4-fabio.m.de.francesco@linux.intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Fabio M. De Francesco and committed by
Rafael J. Wysocki
70205869 e778ffef

+45 -17
+1
drivers/acpi/apei/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 obj-$(CONFIG_ACPI_APEI) += apei.o 3 3 obj-$(CONFIG_ACPI_APEI_GHES) += ghes.o 4 + obj-$(CONFIG_ACPI_APEI_PCIEAER) += ghes_helpers.o 4 5 obj-$(CONFIG_ACPI_APEI_EINJ) += einj.o 5 6 einj-y := einj-core.o 6 7 einj-$(CONFIG_ACPI_APEI_EINJ_CXL) += einj-cxl.o
+1 -17
drivers/acpi/apei/ghes.c
··· 741 741 struct cxl_cper_prot_err_work_data wd; 742 742 u8 *dvsec_start, *cap_start; 743 743 744 - if (!(prot_err->valid_bits & PROT_ERR_VALID_AGENT_ADDRESS)) { 745 - pr_err_ratelimited("CXL CPER invalid agent type\n"); 744 + if (cxl_cper_sec_prot_err_valid(prot_err)) 746 745 return; 747 - } 748 - 749 - if (!(prot_err->valid_bits & PROT_ERR_VALID_ERROR_LOG)) { 750 - pr_err_ratelimited("CXL CPER invalid protocol error log\n"); 751 - return; 752 - } 753 - 754 - if (prot_err->err_len != sizeof(struct cxl_ras_capability_regs)) { 755 - pr_err_ratelimited("CXL CPER invalid RAS Cap size (%u)\n", 756 - prot_err->err_len); 757 - return; 758 - } 759 - 760 - if (!(prot_err->valid_bits & PROT_ERR_VALID_SERIAL_NUMBER)) 761 - pr_warn(FW_WARN "CXL CPER no device serial number\n"); 762 746 763 747 guard(spinlock_irqsave)(&cxl_cper_prot_err_work_lock); 764 748
+33
drivers/acpi/apei/ghes_helpers.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + // Copyright(c) 2025 Intel Corporation. All rights reserved 3 + 4 + #include <linux/printk.h> 5 + #include <cxl/event.h> 6 + 7 + int cxl_cper_sec_prot_err_valid(struct cxl_cper_sec_prot_err *prot_err) 8 + { 9 + if (!(prot_err->valid_bits & PROT_ERR_VALID_AGENT_ADDRESS)) { 10 + pr_err_ratelimited("CXL CPER invalid agent type\n"); 11 + return -EINVAL; 12 + } 13 + 14 + if (!(prot_err->valid_bits & PROT_ERR_VALID_ERROR_LOG)) { 15 + pr_err_ratelimited("CXL CPER invalid protocol error log\n"); 16 + return -EINVAL; 17 + } 18 + 19 + if (prot_err->err_len != sizeof(struct cxl_ras_capability_regs)) { 20 + pr_err_ratelimited("CXL CPER invalid RAS Cap size (%u)\n", 21 + prot_err->err_len); 22 + return -EINVAL; 23 + } 24 + 25 + if ((prot_err->agent_type == RCD || prot_err->agent_type == DEVICE || 26 + prot_err->agent_type == LD || prot_err->agent_type == FMLD) && 27 + !(prot_err->valid_bits & PROT_ERR_VALID_SERIAL_NUMBER)) 28 + pr_warn_ratelimited(FW_WARN 29 + "CXL CPER no device serial number\n"); 30 + 31 + return 0; 32 + } 33 + EXPORT_SYMBOL_GPL(cxl_cper_sec_prot_err_valid);
+10
include/cxl/event.h
··· 320 320 } 321 321 #endif 322 322 323 + #ifdef CONFIG_ACPI_APEI_PCIEAER 324 + int cxl_cper_sec_prot_err_valid(struct cxl_cper_sec_prot_err *prot_err); 325 + #else 326 + static inline int 327 + cxl_cper_sec_prot_err_valid(struct cxl_cper_sec_prot_err *prot_err) 328 + { 329 + return -EOPNOTSUPP; 330 + } 331 + #endif 332 + 323 333 #endif /* _LINUX_CXL_EVENT_H */