On 28.05.14 09:39:26, Tomasz Nowicki wrote:
> This commit abstracts MCE calls and provides weak corresponding default
> implementation for those architectures which do not need arch specific
> actions. Each platform willing to do additional architectural actions
> should provides desired function definition. It allows us to avoid wrap
> code into #ifdef in generic code and prevent new platform from introducing
> dummy stub function too.
>
> Initially, there are two APEI arch-specific calls:
> - apei_arch_enable_cmcff()
> - apei_arch_report_mem_error()
> Both interact with MCE driver for X86 architecture.
>
> Signed-off-by: Tomasz Nowicki <[email protected]>
> ---
> arch/x86/kernel/acpi/Makefile | 1 +
> arch/x86/kernel/acpi/apei.c | 56 +++++++++++++++++++++++++++++++++++++++++
> drivers/acpi/apei/apei-base.c | 13 ++++++++++
> drivers/acpi/apei/ghes.c | 6 ++---
> drivers/acpi/apei/hest.c | 26 +------------------
> include/acpi/apei.h | 3 +++
> 6 files changed, 76 insertions(+), 29 deletions(-)
> create mode 100644 arch/x86/kernel/acpi/apei.c
> static int __init hest_parse_cmc(struct acpi_hest_header *hest_hdr, void *data)
> {
> -#ifdef CONFIG_X86_MCE
> - int i;
> - struct acpi_hest_ia_corrected *cmc;
> - struct acpi_hest_ia_error_bank *mc_bank;
> -
> - if (hest_hdr->type != ACPI_HEST_TYPE_IA32_CORRECTED_CHECK)
> - return 0;
> -
> - cmc = (struct acpi_hest_ia_corrected *)hest_hdr;
> - if (!cmc->enabled)
> + if (!apei_arch_enable_cmcff(hest_hdr, data))
> return 0;
This could be a tail call:
return apei_arch_enable_cmcff(...);
Otherwise the patch looks good to me.
-Robert
>
> - /*
> - * We expect HEST to provide a list of MC banks that report errors
> - * in firmware first mode. Otherwise, return non-zero value to
> - * indicate that we are done parsing HEST.
> - */
> - if (!(cmc->flags & ACPI_HEST_FIRMWARE_FIRST) || !cmc->num_hardware_banks)
> - return 1;
> -
> - pr_info(HEST_PFX "Enabling Firmware First mode for corrected errors.\n");
> -
> - mc_bank = (struct acpi_hest_ia_error_bank *)(cmc + 1);
> - for (i = 0; i < cmc->num_hardware_banks; i++, mc_bank++)
> - mce_disable_bank(mc_bank->bank_number);
> -#endif
> return 1;
> }
On 12.06.2014 12:23, Robert Richter wrote:
> On 28.05.14 09:39:26, Tomasz Nowicki wrote:
>> This commit abstracts MCE calls and provides weak corresponding default
>> implementation for those architectures which do not need arch specific
>> actions. Each platform willing to do additional architectural actions
>> should provides desired function definition. It allows us to avoid wrap
>> code into #ifdef in generic code and prevent new platform from introducing
>> dummy stub function too.
>>
>> Initially, there are two APEI arch-specific calls:
>> - apei_arch_enable_cmcff()
>> - apei_arch_report_mem_error()
>> Both interact with MCE driver for X86 architecture.
>>
>> Signed-off-by: Tomasz Nowicki <[email protected]>
>> ---
>> arch/x86/kernel/acpi/Makefile | 1 +
>> arch/x86/kernel/acpi/apei.c | 56 +++++++++++++++++++++++++++++++++++++++++
>> drivers/acpi/apei/apei-base.c | 13 ++++++++++
>> drivers/acpi/apei/ghes.c | 6 ++---
>> drivers/acpi/apei/hest.c | 26 +------------------
>> include/acpi/apei.h | 3 +++
>> 6 files changed, 76 insertions(+), 29 deletions(-)
>> create mode 100644 arch/x86/kernel/acpi/apei.c
>
>> static int __init hest_parse_cmc(struct acpi_hest_header *hest_hdr, void *data)
>> {
>> -#ifdef CONFIG_X86_MCE
>> - int i;
>> - struct acpi_hest_ia_corrected *cmc;
>> - struct acpi_hest_ia_error_bank *mc_bank;
>> -
>> - if (hest_hdr->type != ACPI_HEST_TYPE_IA32_CORRECTED_CHECK)
>> - return 0;
>> -
>> - cmc = (struct acpi_hest_ia_corrected *)hest_hdr;
>> - if (!cmc->enabled)
>> + if (!apei_arch_enable_cmcff(hest_hdr, data))
>> return 0;
>
> This could be a tail call:
>
> return apei_arch_enable_cmcff(...);
Right. Will fix that.
>
> Otherwise the patch looks good to me.
Thanks.
Tomasz