Lines Matching +full:needs +full:- +full:reset +full:- +full:on +full:- +full:resume

1 // SPDX-License-Identifier: GPL-2.0
69 mutex_lock(&zdev->kzdev_lock); in is_passed_through()
70 ret = !!zdev->kzdev; in is_passed_through()
71 mutex_unlock(&zdev->kzdev_lock); in is_passed_through()
78 if (!driver || !driver->err_handler) in is_driver_supported()
80 if (!driver->err_handler->error_detected) in is_driver_supported()
90 ers_res = driver->err_handler->error_detected(pdev, pdev->error_state); in zpci_event_notify_error_detected()
95 pr_debug("%s: Driver needs reset to recover\n", pci_name(pdev)); in zpci_event_notify_error_detected()
115 /* Let's try a full reset instead */ in zpci_event_do_error_state_clear()
119 if (driver->err_handler->mmio_enabled) in zpci_event_do_error_state_clear()
120 ers_res = driver->err_handler->mmio_enabled(pdev); in zpci_event_do_error_state_clear()
125 pr_info("%s: Automatic recovery failed after MMIO re-enable\n", in zpci_event_do_error_state_clear()
129 pr_debug("%s: Driver needs reset to recover\n", pci_name(pdev)); in zpci_event_do_error_state_clear()
136 pdev->error_state = pci_channel_io_normal; in zpci_event_do_error_state_clear()
139 /* Let's try a full reset instead */ in zpci_event_do_error_state_clear()
151 pr_info("%s: Initiating reset\n", pci_name(pdev)); in zpci_event_do_reset()
153 pr_err("%s: The reset request failed\n", pci_name(pdev)); in zpci_event_do_reset()
156 pdev->error_state = pci_channel_io_normal; in zpci_event_do_reset()
158 if (driver->err_handler->slot_reset) in zpci_event_do_reset()
159 ers_res = driver->err_handler->slot_reset(pdev); in zpci_event_do_reset()
164 pr_info("%s: Automatic recovery failed after slot reset\n", pci_name(pdev)); in zpci_event_do_reset()
171 /* zpci_event_attempt_error_recovery - Try to recover the given PCI function
174 * We follow the scheme outlined in Documentation/PCI/pci-error-recovery.rst.
177 * multi-function devices.
192 if (pdev->error_state == pci_channel_io_perm_failure) { in zpci_event_attempt_error_recovery()
196 pdev->error_state = pci_channel_io_frozen; in zpci_event_attempt_error_recovery()
199 pr_info("%s: Cannot be recovered in the host because it is a pass-through device\n", in zpci_event_attempt_error_recovery()
201 status_str = "failed (pass-through)"; in zpci_event_attempt_error_recovery()
205 driver = to_pci_driver(pdev->dev.driver); in zpci_event_attempt_error_recovery()
214 driver->name); in zpci_event_attempt_error_recovery()
222 status_str = "failed (abort on detection)"; in zpci_event_attempt_error_recovery()
229 status_str = "failed (abort on MMIO enable)"; in zpci_event_attempt_error_recovery()
240 * on how to recover, or because it didn't implement the callback. in zpci_event_attempt_error_recovery()
255 pr_info("%s: The device is ready to resume operations\n", pci_name(pdev)); in zpci_event_attempt_error_recovery()
256 if (driver->err_handler->resume) in zpci_event_attempt_error_recovery()
257 driver->err_handler->resume(pdev); in zpci_event_attempt_error_recovery()
266 /* zpci_event_io_failure - Report PCI channel failure state to driver
275 pdev->error_state = es; in zpci_event_io_failure()
277 * While vfio-pci's error_detected callback notifies user-space QEMU in zpci_event_io_failure()
285 driver = to_pci_driver(pdev->dev.driver); in zpci_event_io_failure()
286 if (driver && driver->err_handler && driver->err_handler->error_detected) in zpci_event_io_failure()
287 driver->err_handler->error_detected(pdev, pdev->error_state); in zpci_event_io_failure()
294 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); in __zpci_event_error()
301 ccdf->fid, ccdf->fh, ccdf->pec); in __zpci_event_error()
306 mutex_lock(&zdev->state_lock); in __zpci_event_error()
307 rc = clp_refresh_fh(zdev->fid, &fh); in __zpci_event_error()
310 if (!fh || ccdf->fh != fh) { in __zpci_event_error()
313 ccdf->fid, fh, ccdf->fh); in __zpci_event_error()
316 zpci_update_fh(zdev, ccdf->fh); in __zpci_event_error()
317 if (zdev->zbus->bus) in __zpci_event_error()
318 pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); in __zpci_event_error()
322 pdev ? pci_name(pdev) : "n/a", ccdf->pec, ccdf->fid); in __zpci_event_error()
327 switch (ccdf->pec) { in __zpci_event_error()
345 mutex_unlock(&zdev->state_lock); in __zpci_event_error()
367 zdev->state = ZPCI_FN_STATE_STANDBY; in zpci_event_hard_deconfigured()
372 lockdep_assert_held(&zdev->state_lock); in zpci_event_reappear()
378 * now so that it won't go away. Account for the re-appearance of the in zpci_event_reappear()
381 zdev->state = ZPCI_FN_STATE_STANDBY; in zpci_event_reappear()
383 zpci_dbg(1, "rea fid:%x, fh:%x\n", zdev->fid, zdev->fh); in zpci_event_reappear()
388 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); in __zpci_event_availability()
393 ccdf->fid, ccdf->fh, ccdf->pec); in __zpci_event_availability()
396 mutex_lock(&zdev->state_lock); in __zpci_event_availability()
398 switch (ccdf->pec) { in __zpci_event_availability()
399 case 0x0301: /* Reserved|Standby -> Configured */ in __zpci_event_availability()
401 zdev = zpci_create_device(ccdf->fid, ccdf->fh, ZPCI_FN_STATE_CONFIGURED); in __zpci_event_availability()
409 if (zdev->state == ZPCI_FN_STATE_RESERVED) in __zpci_event_availability()
412 else if (zdev->state != ZPCI_FN_STATE_STANDBY) in __zpci_event_availability()
414 zdev->state = ZPCI_FN_STATE_CONFIGURED; in __zpci_event_availability()
416 zpci_scan_configured_device(zdev, ccdf->fh); in __zpci_event_availability()
418 case 0x0302: /* Reserved -> Standby */ in __zpci_event_availability()
420 zdev = zpci_create_device(ccdf->fid, ccdf->fh, ZPCI_FN_STATE_STANDBY); in __zpci_event_availability()
428 if (zdev->state == ZPCI_FN_STATE_RESERVED) in __zpci_event_availability()
430 zpci_update_fh(zdev, ccdf->fh); in __zpci_event_availability()
438 if (zdev->state != ZPCI_FN_STATE_CONFIGURED) in __zpci_event_availability()
440 zpci_update_fh(zdev, ccdf->fh); in __zpci_event_availability()
444 case 0x0304: /* Configured -> Standby|Reserved */ in __zpci_event_availability()
449 if (zdev->state == ZPCI_FN_STATE_CONFIGURED) in __zpci_event_availability()
450 zpci_event_hard_deconfigured(zdev, ccdf->fh); in __zpci_event_availability()
452 if (!clp_get_state(zdev->fid, &state) && in __zpci_event_availability()
462 case 0x0308: /* Standby -> Reserved */ in __zpci_event_availability()
471 mutex_unlock(&zdev->state_lock); in __zpci_event_availability()