mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
s390/pci: Allow automatic recovery with minimal driver support
According to Documentation/PCI/pci-error-recovery.rst only the error_detected() callback in the err_handler struct is mandatory for a driver to support error recovery. So far s390's error recovery chose a stricter approach also requiring slot_reset() and resume(). Relax this requirement and only require error_detected(). If a callback is not implemented EEH and AER treat this as PCI_ERS_RESULT_NONE. This return value is otherwise used by drivers abstaining from their vote on how to proceed with recovery and currently also not supported by s390's recovery code. So to support missing callbacks in-line with other implementors of the recovery flow, also handle PCI_ERS_RESULT_NONE. Since s390 only does per PCI function recovery and does not do voting, treat PCI_ERS_RESULT_NONE optimistically and proceed through recovery unless other failures prevent this. Reviewed-by: Farhan Ali <alifm@linux.ibm.com> Reviewed-by: Julian Ruess <julianr@linux.ibm.com> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
parent
b97a7972b1
commit
62355f1f87
1 changed files with 29 additions and 15 deletions
|
@ -54,6 +54,7 @@ static inline bool ers_result_indicates_abort(pci_ers_result_t ers_res)
|
|||
case PCI_ERS_RESULT_CAN_RECOVER:
|
||||
case PCI_ERS_RESULT_RECOVERED:
|
||||
case PCI_ERS_RESULT_NEED_RESET:
|
||||
case PCI_ERS_RESULT_NONE:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
|
@ -78,10 +79,6 @@ static bool is_driver_supported(struct pci_driver *driver)
|
|||
return false;
|
||||
if (!driver->err_handler->error_detected)
|
||||
return false;
|
||||
if (!driver->err_handler->slot_reset)
|
||||
return false;
|
||||
if (!driver->err_handler->resume)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -118,16 +115,18 @@ static pci_ers_result_t zpci_event_do_error_state_clear(struct pci_dev *pdev,
|
|||
return PCI_ERS_RESULT_NEED_RESET;
|
||||
}
|
||||
|
||||
if (driver->err_handler->mmio_enabled) {
|
||||
if (driver->err_handler->mmio_enabled)
|
||||
ers_res = driver->err_handler->mmio_enabled(pdev);
|
||||
if (ers_result_indicates_abort(ers_res)) {
|
||||
pr_info("%s: Automatic recovery failed after MMIO re-enable\n",
|
||||
pci_name(pdev));
|
||||
return ers_res;
|
||||
} else if (ers_res == PCI_ERS_RESULT_NEED_RESET) {
|
||||
pr_debug("%s: Driver needs reset to recover\n", pci_name(pdev));
|
||||
return ers_res;
|
||||
}
|
||||
else
|
||||
ers_res = PCI_ERS_RESULT_NONE;
|
||||
|
||||
if (ers_result_indicates_abort(ers_res)) {
|
||||
pr_info("%s: Automatic recovery failed after MMIO re-enable\n",
|
||||
pci_name(pdev));
|
||||
return ers_res;
|
||||
} else if (ers_res == PCI_ERS_RESULT_NEED_RESET) {
|
||||
pr_debug("%s: Driver needs reset to recover\n", pci_name(pdev));
|
||||
return ers_res;
|
||||
}
|
||||
|
||||
pr_debug("%s: Unblocking DMA\n", pci_name(pdev));
|
||||
|
@ -154,7 +153,12 @@ static pci_ers_result_t zpci_event_do_reset(struct pci_dev *pdev,
|
|||
return ers_res;
|
||||
}
|
||||
pdev->error_state = pci_channel_io_normal;
|
||||
ers_res = driver->err_handler->slot_reset(pdev);
|
||||
|
||||
if (driver->err_handler->slot_reset)
|
||||
ers_res = driver->err_handler->slot_reset(pdev);
|
||||
else
|
||||
ers_res = PCI_ERS_RESULT_NONE;
|
||||
|
||||
if (ers_result_indicates_abort(ers_res)) {
|
||||
pr_info("%s: Automatic recovery failed after slot reset\n", pci_name(pdev));
|
||||
return ers_res;
|
||||
|
@ -218,7 +222,7 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)
|
|||
goto out_unlock;
|
||||
}
|
||||
|
||||
if (ers_res == PCI_ERS_RESULT_CAN_RECOVER) {
|
||||
if (ers_res != PCI_ERS_RESULT_NEED_RESET) {
|
||||
ers_res = zpci_event_do_error_state_clear(pdev, driver);
|
||||
if (ers_result_indicates_abort(ers_res)) {
|
||||
status_str = "failed (abort on MMIO enable)";
|
||||
|
@ -229,6 +233,16 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev)
|
|||
if (ers_res == PCI_ERS_RESULT_NEED_RESET)
|
||||
ers_res = zpci_event_do_reset(pdev, driver);
|
||||
|
||||
/*
|
||||
* ers_res can be PCI_ERS_RESULT_NONE either because the driver
|
||||
* decided to return it, indicating that it abstains from voting
|
||||
* on how to recover, or because it didn't implement the callback.
|
||||
* Both cases assume, that if there is nothing else causing a
|
||||
* disconnect, we recovered successfully.
|
||||
*/
|
||||
if (ers_res == PCI_ERS_RESULT_NONE)
|
||||
ers_res = PCI_ERS_RESULT_RECOVERED;
|
||||
|
||||
if (ers_res != PCI_ERS_RESULT_RECOVERED) {
|
||||
pr_err("%s: Automatic recovery failed; operator intervention is required\n",
|
||||
pci_name(pdev));
|
||||
|
|
Loading…
Add table
Reference in a new issue