Skip to content

Commit dfa5dc3

Browse files
committed
Merge branch 'acpi-apei'
Merge ACPI APEI support updates for 6.20-rc1/7.0-rc1: - Make read-only array non_mmio_desc[] static const (Colin Ian King) - Prevent the APEI GHES support code on ARM from accessing memory out of bounds or going past the ARM processor CPER record buffer (Mauro Carvalho Chehab) - Prevent cper_print_fw_err() from dumping the entire memory on systems with defective firmware (Mauro Carvalho Chehab) - Improve ghes_notify_nmi() status check to avoid unnecessary overhead in the NMI handler by carrying out all of the requisite preparations and the NMI registration time (Tony Luck) - Refactor the GHES driver by extracting common functionality into reusable helper functions to reduce code duplication and improve the ghes_notify_sea() status check in analogy with the previous ghes_notify_nmi() status check improvement (Shuai Xue) - Make ELOG and GHES log and trace consistently and support the CPER CXL protocol analogously (Fabio De Francesco) - Disable KASAN instrumentation in the APEI GHES driver when compile testing with clang < 18 (Nathan Chancellor) - Let ghes_edac be the preferred driver to load on __ZX__ and _BYO_ systems by extending the platform detection list in the APEI GHES driver (Tony W Wang-oc) * acpi-apei: ACPI: APEI: GHES: Add ghes_edac support for __ZX__ and _BYO_ systems ACPI: APEI: GHES: Disable KASAN instrumentation when compile testing with clang < 18 ACPI: extlog: Trace CPER CXL Protocol Error Section ACPI: APEI: GHES: Add helper to copy CPER CXL protocol error info to work struct ACPI: APEI: GHES: Add helper for CPER CXL protocol errors checks ACPI: extlog: Trace CPER PCI Express Error Section ACPI: extlog: Trace CPER Non-standard Section Body ACPI: APEI: GHES: Improve ghes_notify_sea() status check ACPI: APEI: GHES: Extract helper functions for error status handling ACPI: APEI: GHES: Improve ghes_notify_nmi() status check EFI/CPER: don't dump the entire memory region APEI/GHES: ensure that won't go past CPER allocated record EFI/CPER: don't go past the ARM processor CPER record buffer APEI/GHES: ARM processor Error: don't go past allocated memory ACPI: APEI: EINJ: make read-only array non_mmio_desc static const
2 parents 2b0181a + 57d5287 commit dfa5dc3

14 files changed

Lines changed: 325 additions & 59 deletions

File tree

drivers/acpi/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,8 @@ config ACPI_EXTLOG
494494
tristate "Extended Error Log support"
495495
depends on X86_MCE && X86_LOCAL_APIC && EDAC
496496
select UEFI_CPER
497+
select ACPI_APEI
498+
select ACPI_APEI_GHES
497499
help
498500
Certain usages such as Predictive Failure Analysis (PFA) require
499501
more information about the error than what can be described in

drivers/acpi/acpi_extlog.c

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/ratelimit.h>
1313
#include <linux/edac.h>
1414
#include <linux/ras.h>
15+
#include <cxl/event.h>
1516
#include <acpi/ghes.h>
1617
#include <asm/cpu.h>
1718
#include <asm/mce.h>
@@ -132,6 +133,53 @@ static int print_extlog_rcd(const char *pfx,
132133
return 1;
133134
}
134135

136+
static void extlog_print_pcie(struct cper_sec_pcie *pcie_err,
137+
int severity)
138+
{
139+
#ifdef ACPI_APEI_PCIEAER
140+
struct aer_capability_regs *aer;
141+
struct pci_dev *pdev;
142+
unsigned int devfn;
143+
unsigned int bus;
144+
int aer_severity;
145+
int domain;
146+
147+
if (!(pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID &&
148+
pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO))
149+
return;
150+
151+
aer_severity = cper_severity_to_aer(severity);
152+
aer = (struct aer_capability_regs *)pcie_err->aer_info;
153+
domain = pcie_err->device_id.segment;
154+
bus = pcie_err->device_id.bus;
155+
devfn = PCI_DEVFN(pcie_err->device_id.device,
156+
pcie_err->device_id.function);
157+
pdev = pci_get_domain_bus_and_slot(domain, bus, devfn);
158+
if (!pdev)
159+
return;
160+
161+
pci_print_aer(pdev, aer_severity, aer);
162+
pci_dev_put(pdev);
163+
#endif
164+
}
165+
166+
static void
167+
extlog_cxl_cper_handle_prot_err(struct cxl_cper_sec_prot_err *prot_err,
168+
int severity)
169+
{
170+
#ifdef ACPI_APEI_PCIEAER
171+
struct cxl_cper_prot_err_work_data wd;
172+
173+
if (cxl_cper_sec_prot_err_valid(prot_err))
174+
return;
175+
176+
if (cxl_cper_setup_prot_err_work_data(&wd, prot_err, severity))
177+
return;
178+
179+
cxl_cper_handle_prot_err(&wd);
180+
#endif
181+
}
182+
135183
static int extlog_print(struct notifier_block *nb, unsigned long val,
136184
void *data)
137185
{
@@ -183,6 +231,22 @@ static int extlog_print(struct notifier_block *nb, unsigned long val,
183231
if (gdata->error_data_length >= sizeof(*mem))
184232
trace_extlog_mem_event(mem, err_seq, fru_id, fru_text,
185233
(u8)gdata->error_severity);
234+
} else if (guid_equal(sec_type, &CPER_SEC_CXL_PROT_ERR)) {
235+
struct cxl_cper_sec_prot_err *prot_err =
236+
acpi_hest_get_payload(gdata);
237+
238+
extlog_cxl_cper_handle_prot_err(prot_err,
239+
gdata->error_severity);
240+
} else if (guid_equal(sec_type, &CPER_SEC_PCIE)) {
241+
struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata);
242+
243+
extlog_print_pcie(pcie_err, gdata->error_severity);
244+
} else {
245+
void *err = acpi_hest_get_payload(gdata);
246+
247+
log_non_standard_event(sec_type, fru_id, fru_text,
248+
gdata->error_severity, err,
249+
gdata->error_data_length);
186250
}
187251
}
188252

drivers/acpi/apei/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# SPDX-License-Identifier: GPL-2.0
22
obj-$(CONFIG_ACPI_APEI) += apei.o
33
obj-$(CONFIG_ACPI_APEI_GHES) += ghes.o
4+
# clang versions prior to 18 may blow out the stack with KASAN
5+
ifeq ($(CONFIG_COMPILE_TEST)_$(CONFIG_CC_IS_CLANG)_$(call clang-min-version, 180000),y_y_)
6+
KASAN_SANITIZE_ghes.o := n
7+
endif
8+
obj-$(CONFIG_ACPI_APEI_PCIEAER) += ghes_helpers.o
49
obj-$(CONFIG_ACPI_APEI_EINJ) += einj.o
510
einj-y := einj-core.o
611
einj-$(CONFIG_ACPI_APEI_EINJ_CXL) += einj-cxl.o

drivers/acpi/apei/einj-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ static bool is_allowed_range(u64 base_addr, u64 size)
679679
* region intersects with known resource. So do an allow list check for
680680
* IORES_DESCs that definitely or most likely not MMIO.
681681
*/
682-
int non_mmio_desc[] = {
682+
static const int non_mmio_desc[] = {
683683
IORES_DESC_CRASH_KERNEL,
684684
IORES_DESC_ACPI_TABLES,
685685
IORES_DESC_ACPI_NV_STORAGE,

0 commit comments

Comments
 (0)