// SPDX-License-Identifier: GPL-2.0-only /* * Bridge between MCE and APEI * * On some machine, corrected memory errors are reported via APEI * generic hardware error source (GHES) instead of corrected Machine * Check. These corrected memory errors can be reported to user space * through /dev/mcelog via faking a corrected Machine Check, so that * the error memory page can be offlined by /sbin/mcelog if the error * count for one page is beyond the threshold. * * For fatal MCE, save MCE record into persistent storage via ERST, so * that the MCE record can be logged after reboot via ERST. * * Copyright 2010 Intel Corp. * Author: Huang Ying <[email protected]> */ #include <linux/export.h> #include <linux/kernel.h> #include <linux/acpi.h> #include <linux/cper.h> #include <acpi/apei.h> #include <acpi/ghes.h> #include <asm/mce.h> #include "internal.h" void apei_mce_report_mem_error(int severity, struct cper_sec_mem_err *mem_err) { … } EXPORT_SYMBOL_GPL(…); int apei_smca_report_x86_error(struct cper_ia_proc_ctx *ctx_info, u64 lapic_id) { … } #define CPER_CREATOR_MCE … #define CPER_SECTION_TYPE_MCE … /* * CPER specification (in UEFI specification 2.3 appendix N) requires * byte-packed. */ struct cper_mce_record { … } __packed; int apei_write_mce(struct mce *m) { … } ssize_t apei_read_mce(struct mce *m, u64 *record_id) { … } /* Check whether there is record in ERST */ int apei_check_mce(void) { … } int apei_clear_mce(u64 record_id) { … }