Report APEI GHES error information via printk
cover Report APEI GHES error information via printk
Although we have no consensus on whether we need a hardware error specific reporting interface. We have the consensus that we need to report hardware error information via printk. This patchset adds that to APEI GHES.
[RFC][PATCH 1/3] Add CPER PCIe error section structure and constants definition [RFC][PATCH 2/3] ACPI, APEI, Add APEI generic error status print support [RFC][PATCH 3/3] ACPI, APEI, report GHES error information via printk
RFC PATCH 1/3 Add CPER PCIe error section structure and constants definition
On some machine, PCIe error is reported via APEI (ACPI Platform Error Interface). The error data is passed from firmware to Linux via CPER PCIe error section structure.
This patch adds CPER PCIe error section structure and constants definition.
--- include/linux/cper.h | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+)
include/linux/cper.h +74 -0
@@ -201,6 +201,67 @@UUID_LE (0x036F84E1 ,0x7F37 ,0x428c ,0xA7 ,0x9E ,0x57 ,0x5F , \ 0xDF, 0xAA, 0x84, 0xEC) +#define CPER_PROC_VALID_TYPE 0x0001 +#define CPER_PROC_VALID_ISA 0x0002 +#define CPER_PROC_VALID_ERROR_TYPE 0x0004 +#define CPER_PROC_VALID_OPERATION 0x0008 +#define CPER_PROC_VALID_FLAGS 0x0010 +#define CPER_PROC_VALID_LEVEL 0x0020 +#define CPER_PROC_VALID_VERSION 0x0040 +#define CPER_PROC_VALID_BRAND_INFO 0x0080 +#define CPER_PROC_VALID_ID 0x0100 +#define CPER_PROC_VALID_TARGET_ADDRESS 0x0200 +#define CPER_PROC_VALID_REQUESTOR_ID 0x0400 +#define CPER_PROC_VALID_RESPONDER_ID 0x0800 +#define CPER_PROC_VALID_IP 0x1000 + +#define CPER_MEM_VALID_ERROR_STATUS 0x0001 +#define CPER_MEM_VALID_PHYSICAL_ADDRESS 0x0002 +#define CPER_MEM_VALID_PHYSICAL_ADDRESS_MASK 0x0004 +#define CPER_MEM_VALID_NODE 0x0008 +#define CPER_MEM_VALID_CARD 0x0010 +#define CPER_MEM_VALID_MODULE 0x0020 +#define CPER_MEM_VALID_BANK 0x0040 +#define CPER_MEM_VALID_DEVICE 0x0080 +#define CPER_MEM_VALID_ROW 0x0100 +#define CPER_MEM_VALID_COLUMN 0x0200 +#define CPER_MEM_VALID_BIT_POSITION 0x0400 +#define CPER_MEM_VALID_REQUESTOR_ID 0x0800 +#define CPER_MEM_VALID_RESPONDER_ID 0x1000 +#define CPER_MEM_VALID_TARGET_ID 0x2000 +#define CPER_MEM_VALID_ERROR_TYPE 0x4000 + +#define CPER_PCIE_VALID_PORT_TYPE 0x0001 +#define CPER_PCIE_VALID_VERSION 0x0002 +#define CPER_PCIE_VALID_COMMAND_STATUS 0x0004 +#define CPER_PCIE_VALID_DEVICE_ID 0x0008 +#define CPER_PCIE_VALID_SERIAL_NUMBER 0x0010 +#define CPER_PCIE_VALID_BRIDGE_CONTROL_STATUS 0x0020 +#define CPER_PCIE_VALID_CAPABILITY 0x0040 +#define CPER_PCIE_VALID_AER_INFO 0x0080 + +#define CPER_PCIE_VERSION_MINOR 0 +#define CPER_PCIE_VERSION_MAJOR 1 + +#define CPER_PCIE_COMMAND_REG 0 +#define CPER_PCIE_STATUS_REG 1 + +#define CPER_PCIE_DEVID_VENDOR_ID 0 +#define CPER_PCIE_DEVID_DEVICE_ID 2 +#define CPER_PCIE_DEVID_CLASS_CODE 4 +#define CPER_PCIE_DEVID_FUNC 7 +#define CPER_PCIE_DEVID_DEV 8 +#define CPER_PCIE_DEVID_SEGMENT 9 +#define CPER_PCIE_DEVID_BUS_PRIMARY 11 +#define CPER_PCIE_DEVID_BUS_SECONDARY 12 +#define CPER_PCIE_DEVID_SLOT 13 + +#define CPER_PCIE_SERIAL_NUMBER_LOW 0 +#define CPER_PCIE_SERIAL_NUMBER_HIGH 1 + +#define CPER_PCIE_BRIDGE_SECONDARY_STATUS_REG 0 +#define CPER_PCIE_BRIDGE_CONTROL_REG 1 +/* * All tables and structs must be byte-packed to match CPER * specification, since the tables are provided by the system BIOS
@@ -306,6 +367,19 @@ struct cper_sec_mem_err {__u8 error_type; }; +struct cper_sec_pcie { +__u64 validation_bits; +__u32 port_type; +__u8 version[4 ]; +__u16 command_status[2 ]; +__u32 reserved; +__u8 device_id[16 ]; +__u32 serial_number[2 ]; +__u16 bridge_control_status[2 ]; +__u8 capability[60 ]; +__u8 aer_info[96 ]; +}; +/* Reset to default packing */ #pragma pack()
RFC PATCH 2/3 ACPI, APEI, Add APEI generic error status print support
In reply to Huang Yingprintk is one of the methods to report hardware errors to user space. Hardware error information reported by firmware to Linux kernel is in the format of APEI generic error status (struct acpi_hes_generic_status). This patch adds print support for the format, so that the corresponding hardware error information can be reported to user space via printk.
PCIe AER information print is not implemented yet. Will refactor the original PCIe AER information printing code to avoid code duplicating.
--- drivers/acpi/apei/apei-internal.h | 2 drivers/acpi/apei/cper.c | 288 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 290 insertions(+)
drivers/acpi/apei/apei-internal.h +2 -0
@@ -109,6 +109,8 @@ static inline u32 apei_estatus_len(struc return sizeof(*estatus) + estatus->data_length; } +void apei_estatus_print (const char *pfx, +const struct acpi_hest_generic_status *estatus);int apei_estatus_check_header (const struct acpi_hest_generic_status *estatus);int apei_estatus_check (const struct acpi_hest_generic_status *estatus);#endif
drivers/acpi/apei/cper.c +288 -0
300 lines not on this page · raw message
RFC PATCH 3/3 ACPI, APEI, report GHES error information via printk
In reply to Huang Yingprintk is one of the methods to report hardware errors to user space. This patch implements hardware error reporting for GHES via printk.
--- drivers/acpi/apei/ghes.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/acpi/apei/ghes.c +17 -4
@@ -255,11 +255,23 @@ static void ghes_do_proc(struct ghes *gh }#endif } +} -if (!processed &&printk_ratelimit ()) -pr_warning (GHES_PFX -"Unknown error record from generic hardware error source: %d\n" , - ghes->generic->header.source_id); +static void ghes_print_estatus (const char *pfx,struct ghes *ghes) +{ +if (pfx ==NULL ) { +if (ghes_severity (ghes->estatus->error_severity) <= +GHES_SEV_CORRECTED ) + pfx = KERN_WARNING HW_ERR; +else + pfx = KERN_ERR HW_ERR; + } +if (printk_ratelimit ()) { +printk ( +"%sHardware error from Generic Hardware Error Source: %d\n" , + pfx, ghes->generic->header.source_id); +apei_estatus_print (pfx, ghes->estatus); + } }static int ghes_proc (struct ghes *ghes)
@@ -269,6 +281,7 @@ static int ghes_proc(struct ghes *ghes) rc =ghes_read_estatus (ghes,0 );if (rc) goto out; +ghes_print_estatus (NULL , ghes);ghes_do_proc (ghes); out: