Loading...
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Arch-specific APEI-related functions.
4 */
5
6#include <acpi/apei.h>
7
8#include <asm/mce.h>
9#include <asm/tlbflush.h>
10
11int arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data)
12{
13#ifdef CONFIG_X86_MCE
14 int i;
15 struct acpi_hest_ia_corrected *cmc;
16 struct acpi_hest_ia_error_bank *mc_bank;
17
18 cmc = (struct acpi_hest_ia_corrected *)hest_hdr;
19 if (!cmc->enabled)
20 return 0;
21
22 /*
23 * We expect HEST to provide a list of MC banks that report errors
24 * in firmware first mode. Otherwise, return non-zero value to
25 * indicate that we are done parsing HEST.
26 */
27 if (!(cmc->flags & ACPI_HEST_FIRMWARE_FIRST) ||
28 !cmc->num_hardware_banks)
29 return 1;
30
31 pr_info("HEST: Enabling Firmware First mode for corrected errors.\n");
32
33 mc_bank = (struct acpi_hest_ia_error_bank *)(cmc + 1);
34 for (i = 0; i < cmc->num_hardware_banks; i++, mc_bank++)
35 mce_disable_bank(mc_bank->bank_number);
36#endif
37 return 1;
38}
39
40void arch_apei_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
41{
42#ifdef CONFIG_X86_MCE
43 apei_mce_report_mem_error(sev, mem_err);
44#endif
45}
1/*
2 * Arch-specific APEI-related functions.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <acpi/apei.h>
16
17#include <asm/mce.h>
18#include <asm/tlbflush.h>
19
20int arch_apei_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data)
21{
22#ifdef CONFIG_X86_MCE
23 int i;
24 struct acpi_hest_ia_corrected *cmc;
25 struct acpi_hest_ia_error_bank *mc_bank;
26
27 if (hest_hdr->type != ACPI_HEST_TYPE_IA32_CORRECTED_CHECK)
28 return 0;
29
30 cmc = (struct acpi_hest_ia_corrected *)hest_hdr;
31 if (!cmc->enabled)
32 return 0;
33
34 /*
35 * We expect HEST to provide a list of MC banks that report errors
36 * in firmware first mode. Otherwise, return non-zero value to
37 * indicate that we are done parsing HEST.
38 */
39 if (!(cmc->flags & ACPI_HEST_FIRMWARE_FIRST) ||
40 !cmc->num_hardware_banks)
41 return 1;
42
43 pr_info("HEST: Enabling Firmware First mode for corrected errors.\n");
44
45 mc_bank = (struct acpi_hest_ia_error_bank *)(cmc + 1);
46 for (i = 0; i < cmc->num_hardware_banks; i++, mc_bank++)
47 mce_disable_bank(mc_bank->bank_number);
48#endif
49 return 1;
50}
51
52void arch_apei_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
53{
54#ifdef CONFIG_X86_MCE
55 apei_mce_report_mem_error(sev, mem_err);
56#endif
57}
58
59void arch_apei_flush_tlb_one(unsigned long addr)
60{
61 __flush_tlb_one(addr);
62}