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 to copy CPER CXL protocol error info to work struct

Make a helper out of cxl_cper_post_prot_err() that checks the CXL agent
type and copy the CPER CXL protocol errors information to a work data
structure.

Export the new symbol for reuse by ELOG.

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Reviewed-by: Hanjun Guo <guohanjun@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-5-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
ba8af8e1 70205869

+44 -21
+1 -21
drivers/acpi/apei/ghes.c
··· 739 739 { 740 740 #ifdef CONFIG_ACPI_APEI_PCIEAER 741 741 struct cxl_cper_prot_err_work_data wd; 742 - u8 *dvsec_start, *cap_start; 743 742 744 743 if (cxl_cper_sec_prot_err_valid(prot_err)) 745 744 return; ··· 748 749 if (!cxl_cper_prot_err_work) 749 750 return; 750 751 751 - switch (prot_err->agent_type) { 752 - case RCD: 753 - case DEVICE: 754 - case LD: 755 - case FMLD: 756 - case RP: 757 - case DSP: 758 - case USP: 759 - memcpy(&wd.prot_err, prot_err, sizeof(wd.prot_err)); 760 - 761 - dvsec_start = (u8 *)(prot_err + 1); 762 - cap_start = dvsec_start + prot_err->dvsec_len; 763 - 764 - memcpy(&wd.ras_cap, cap_start, sizeof(wd.ras_cap)); 765 - wd.severity = cper_severity_to_aer(severity); 766 - break; 767 - default: 768 - pr_err_ratelimited("CXL CPER invalid agent type: %d\n", 769 - prot_err->agent_type); 752 + if (cxl_cper_setup_prot_err_work_data(&wd, prot_err, severity)) 770 753 return; 771 - } 772 754 773 755 if (!kfifo_put(&cxl_cper_prot_err_fifo, wd)) { 774 756 pr_err_ratelimited("CXL CPER kfifo overflow\n");
+33
drivers/acpi/apei/ghes_helpers.c
··· 2 2 // Copyright(c) 2025 Intel Corporation. All rights reserved 3 3 4 4 #include <linux/printk.h> 5 + #include <linux/aer.h> 5 6 #include <cxl/event.h> 6 7 7 8 int cxl_cper_sec_prot_err_valid(struct cxl_cper_sec_prot_err *prot_err) ··· 32 31 return 0; 33 32 } 34 33 EXPORT_SYMBOL_GPL(cxl_cper_sec_prot_err_valid); 34 + 35 + int cxl_cper_setup_prot_err_work_data(struct cxl_cper_prot_err_work_data *wd, 36 + struct cxl_cper_sec_prot_err *prot_err, 37 + int severity) 38 + { 39 + u8 *dvsec_start, *cap_start; 40 + 41 + switch (prot_err->agent_type) { 42 + case RCD: 43 + case DEVICE: 44 + case LD: 45 + case FMLD: 46 + case RP: 47 + case DSP: 48 + case USP: 49 + memcpy(&wd->prot_err, prot_err, sizeof(wd->prot_err)); 50 + 51 + dvsec_start = (u8 *)(prot_err + 1); 52 + cap_start = dvsec_start + prot_err->dvsec_len; 53 + 54 + memcpy(&wd->ras_cap, cap_start, sizeof(wd->ras_cap)); 55 + wd->severity = cper_severity_to_aer(severity); 56 + break; 57 + default: 58 + pr_err_ratelimited("CXL CPER invalid agent type: %d\n", 59 + prot_err->agent_type); 60 + return -EINVAL; 61 + } 62 + 63 + return 0; 64 + } 65 + EXPORT_SYMBOL_GPL(cxl_cper_setup_prot_err_work_data);
+10
include/cxl/event.h
··· 322 322 323 323 #ifdef CONFIG_ACPI_APEI_PCIEAER 324 324 int cxl_cper_sec_prot_err_valid(struct cxl_cper_sec_prot_err *prot_err); 325 + int cxl_cper_setup_prot_err_work_data(struct cxl_cper_prot_err_work_data *wd, 326 + struct cxl_cper_sec_prot_err *prot_err, 327 + int severity); 325 328 #else 326 329 static inline int 327 330 cxl_cper_sec_prot_err_valid(struct cxl_cper_sec_prot_err *prot_err) 331 + { 332 + return -EOPNOTSUPP; 333 + } 334 + static inline int 335 + cxl_cper_setup_prot_err_work_data(struct cxl_cper_prot_err_work_data *wd, 336 + struct cxl_cper_sec_prot_err *prot_err, 337 + int severity) 328 338 { 329 339 return -EOPNOTSUPP; 330 340 }