diff options
| author | Tyler Baicar <tbaicar@codeaurora.org> | 2017-11-28 16:48:08 -0500 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-12-04 20:10:13 -0500 |
| commit | 3c5b977f06b754b00a49ee7bf1595491afab7de6 (patch) | |
| tree | 38c1cf908bb44f6cc4da0b8c6646297cccaecb13 | |
| parent | ae64f9bd1d3621b5e60d7363bc20afb46aede215 (diff) | |
ACPI: APEI: handle PCIe AER errors in separate function
Move PCIe AER error handling code into a separate function.
Signed-off-by: Tyler Baicar <tbaicar@codeaurora.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| -rw-r--r-- | drivers/acpi/apei/ghes.c | 64 |
1 files changed, 34 insertions, 30 deletions
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 6402f7fad3bb..f67eb763e950 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c | |||
| @@ -414,6 +414,39 @@ static void ghes_handle_memory_failure(struct acpi_hest_generic_data *gdata, int | |||
| 414 | #endif | 414 | #endif |
| 415 | } | 415 | } |
| 416 | 416 | ||
| 417 | static void ghes_handle_aer(struct acpi_hest_generic_data *gdata, int sev, int sec_sev) | ||
| 418 | { | ||
| 419 | #ifdef CONFIG_ACPI_APEI_PCIEAER | ||
| 420 | struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata); | ||
| 421 | |||
| 422 | if (sev == GHES_SEV_RECOVERABLE && | ||
| 423 | sec_sev == GHES_SEV_RECOVERABLE && | ||
| 424 | pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID && | ||
| 425 | pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) { | ||
| 426 | unsigned int devfn; | ||
| 427 | int aer_severity; | ||
| 428 | |||
| 429 | devfn = PCI_DEVFN(pcie_err->device_id.device, | ||
| 430 | pcie_err->device_id.function); | ||
| 431 | aer_severity = cper_severity_to_aer(gdata->error_severity); | ||
| 432 | |||
| 433 | /* | ||
| 434 | * If firmware reset the component to contain | ||
| 435 | * the error, we must reinitialize it before | ||
| 436 | * use, so treat it as a fatal AER error. | ||
| 437 | */ | ||
| 438 | if (gdata->flags & CPER_SEC_RESET) | ||
| 439 | aer_severity = AER_FATAL; | ||
| 440 | |||
| 441 | aer_recover_queue(pcie_err->device_id.segment, | ||
| 442 | pcie_err->device_id.bus, | ||
| 443 | devfn, aer_severity, | ||
| 444 | (struct aer_capability_regs *) | ||
| 445 | pcie_err->aer_info); | ||
| 446 | } | ||
| 447 | #endif | ||
| 448 | } | ||
| 449 | |||
| 417 | static void ghes_do_proc(struct ghes *ghes, | 450 | static void ghes_do_proc(struct ghes *ghes, |
| 418 | const struct acpi_hest_generic_status *estatus) | 451 | const struct acpi_hest_generic_status *estatus) |
| 419 | { | 452 | { |
| @@ -441,38 +474,9 @@ static void ghes_do_proc(struct ghes *ghes, | |||
| 441 | arch_apei_report_mem_error(sev, mem_err); | 474 | arch_apei_report_mem_error(sev, mem_err); |
| 442 | ghes_handle_memory_failure(gdata, sev); | 475 | ghes_handle_memory_failure(gdata, sev); |
| 443 | } | 476 | } |
| 444 | #ifdef CONFIG_ACPI_APEI_PCIEAER | ||
| 445 | else if (guid_equal(sec_type, &CPER_SEC_PCIE)) { | 477 | else if (guid_equal(sec_type, &CPER_SEC_PCIE)) { |
| 446 | struct cper_sec_pcie *pcie_err = acpi_hest_get_payload(gdata); | 478 | ghes_handle_aer(gdata, sev, sec_sev); |
| 447 | |||
| 448 | if (sev == GHES_SEV_RECOVERABLE && | ||
| 449 | sec_sev == GHES_SEV_RECOVERABLE && | ||
| 450 | pcie_err->validation_bits & CPER_PCIE_VALID_DEVICE_ID && | ||
| 451 | pcie_err->validation_bits & CPER_PCIE_VALID_AER_INFO) { | ||
| 452 | unsigned int devfn; | ||
| 453 | int aer_severity; | ||
| 454 | |||
| 455 | devfn = PCI_DEVFN(pcie_err->device_id.device, | ||
| 456 | pcie_err->device_id.function); | ||
| 457 | aer_severity = cper_severity_to_aer(gdata->error_severity); | ||
| 458 | |||
| 459 | /* | ||
| 460 | * If firmware reset the component to contain | ||
| 461 | * the error, we must reinitialize it before | ||
| 462 | * use, so treat it as a fatal AER error. | ||
| 463 | */ | ||
| 464 | if (gdata->flags & CPER_SEC_RESET) | ||
| 465 | aer_severity = AER_FATAL; | ||
| 466 | |||
| 467 | aer_recover_queue(pcie_err->device_id.segment, | ||
| 468 | pcie_err->device_id.bus, | ||
| 469 | devfn, aer_severity, | ||
| 470 | (struct aer_capability_regs *) | ||
| 471 | pcie_err->aer_info); | ||
| 472 | } | ||
| 473 | |||
| 474 | } | 479 | } |
| 475 | #endif | ||
| 476 | else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { | 480 | else if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { |
| 477 | struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata); | 481 | struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata); |
| 478 | 482 | ||
