Commit 9fb0bfe1408d5506b7b83d13d1eed573fd71d67d
Committed by
Len Brown
1 parent
eccddd32ce
Exists in
master
and in
38 other branches
ACPI, APEI, Add WHEA _OSC support
APEI firmware first mode must be turned on explicitly on some machines, otherwise there may be no GHES hardware error record for hardware error notification. APEI bit in generic _OSC call can be used to do that, but on some machine, a special WHEA _OSC call must be used. This patch adds the support to that WHEA _OSC call. Signed-off-by: Huang Ying <ying.huang@intel.com> Reviewed-by: Andi Kleen <ak@linux.intel.com> Reviewed-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Len Brown <len.brown@intel.com>
Showing 3 changed files with 38 additions and 0 deletions Side-by-side Diff
drivers/acpi/apei/apei-base.c
... | ... | @@ -604,4 +604,30 @@ |
604 | 604 | return dapei; |
605 | 605 | } |
606 | 606 | EXPORT_SYMBOL_GPL(apei_get_debugfs_dir); |
607 | + | |
608 | +int apei_osc_setup(void) | |
609 | +{ | |
610 | + static u8 whea_uuid_str[] = "ed855e0c-6c90-47bf-a62a-26de0fc5ad5c"; | |
611 | + acpi_handle handle; | |
612 | + u32 capbuf[3]; | |
613 | + struct acpi_osc_context context = { | |
614 | + .uuid_str = whea_uuid_str, | |
615 | + .rev = 1, | |
616 | + .cap.length = sizeof(capbuf), | |
617 | + .cap.pointer = capbuf, | |
618 | + }; | |
619 | + | |
620 | + capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; | |
621 | + capbuf[OSC_SUPPORT_TYPE] = 0; | |
622 | + capbuf[OSC_CONTROL_TYPE] = 0; | |
623 | + | |
624 | + if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)) | |
625 | + || ACPI_FAILURE(acpi_run_osc(handle, &context))) | |
626 | + return -EIO; | |
627 | + else { | |
628 | + kfree(context.ret.pointer); | |
629 | + return 0; | |
630 | + } | |
631 | +} | |
632 | +EXPORT_SYMBOL_GPL(apei_osc_setup); |
drivers/acpi/apei/apei-internal.h
... | ... | @@ -124,5 +124,7 @@ |
124 | 124 | const struct acpi_hest_generic_status *estatus); |
125 | 125 | int apei_estatus_check_header(const struct acpi_hest_generic_status *estatus); |
126 | 126 | int apei_estatus_check(const struct acpi_hest_generic_status *estatus); |
127 | + | |
128 | +int apei_osc_setup(void); | |
127 | 129 | #endif |
drivers/acpi/apei/ghes.c
... | ... | @@ -681,6 +681,16 @@ |
681 | 681 | if (rc) |
682 | 682 | goto err_ioremap_exit; |
683 | 683 | |
684 | + rc = apei_osc_setup(); | |
685 | + if (rc == 0 && osc_sb_apei_support_acked) | |
686 | + pr_info(GHES_PFX "APEI firmware first mode is enabled by APEI bit and WHEA _OSC.\n"); | |
687 | + else if (rc == 0 && !osc_sb_apei_support_acked) | |
688 | + pr_info(GHES_PFX "APEI firmware first mode is enabled by WHEA _OSC.\n"); | |
689 | + else if (rc && osc_sb_apei_support_acked) | |
690 | + pr_info(GHES_PFX "APEI firmware first mode is enabled by APEI bit.\n"); | |
691 | + else | |
692 | + pr_info(GHES_PFX "Failed to enable APEI firmware first mode.\n"); | |
693 | + | |
684 | 694 | return 0; |
685 | 695 | err_ioremap_exit: |
686 | 696 | ghes_ioremap_exit(); |