Lines Matching +full:needs +full:- +full:reset +full:- +full:on +full:- +full:resume
1 // SPDX-License-Identifier: GPL-2.0
68 mutex_lock(&zdev->kzdev_lock); in is_passed_through()
69 ret = !!zdev->kzdev; in is_passed_through()
70 mutex_unlock(&zdev->kzdev_lock); in is_passed_through()
77 if (!driver || !driver->err_handler) in is_driver_supported()
79 if (!driver->err_handler->error_detected) in is_driver_supported()
81 if (!driver->err_handler->slot_reset) in is_driver_supported()
83 if (!driver->err_handler->resume) in is_driver_supported()
93 ers_res = driver->err_handler->error_detected(pdev, pdev->error_state); in zpci_event_notify_error_detected()
97 pr_debug("%s: Driver needs reset to recover\n", pci_name(pdev)); in zpci_event_notify_error_detected()
113 /* Let's try a full reset instead */ in zpci_event_do_error_state_clear()
117 if (driver->err_handler->mmio_enabled) { in zpci_event_do_error_state_clear()
118 ers_res = driver->err_handler->mmio_enabled(pdev); in zpci_event_do_error_state_clear()
120 pr_info("%s: Automatic recovery failed after MMIO re-enable\n", in zpci_event_do_error_state_clear()
124 pr_debug("%s: Driver needs reset to recover\n", pci_name(pdev)); in zpci_event_do_error_state_clear()
132 pdev->error_state = pci_channel_io_normal; in zpci_event_do_error_state_clear()
135 /* Let's try a full reset instead */ in zpci_event_do_error_state_clear()
147 pr_info("%s: Initiating reset\n", pci_name(pdev)); in zpci_event_do_reset()
149 pr_err("%s: The reset request failed\n", pci_name(pdev)); in zpci_event_do_reset()
152 pdev->error_state = pci_channel_io_normal; in zpci_event_do_reset()
153 ers_res = driver->err_handler->slot_reset(pdev); in zpci_event_do_reset()
155 pr_info("%s: Automatic recovery failed after slot reset\n", pci_name(pdev)); in zpci_event_do_reset()
162 /* zpci_event_attempt_error_recovery - Try to recover the given PCI function
165 * We follow the scheme outlined in Documentation/PCI/pci-error-recovery.rst.
168 * multi-function devices.
183 if (pdev->error_state == pci_channel_io_perm_failure) { in zpci_event_attempt_error_recovery()
187 pdev->error_state = pci_channel_io_frozen; in zpci_event_attempt_error_recovery()
190 pr_info("%s: Cannot be recovered in the host because it is a pass-through device\n", in zpci_event_attempt_error_recovery()
192 status_str = "failed (pass-through)"; in zpci_event_attempt_error_recovery()
196 driver = to_pci_driver(pdev->dev.driver); in zpci_event_attempt_error_recovery()
205 driver->name); in zpci_event_attempt_error_recovery()
213 status_str = "failed (abort on detection)"; in zpci_event_attempt_error_recovery()
220 status_str = "failed (abort on MMIO enable)"; in zpci_event_attempt_error_recovery()
235 pr_info("%s: The device is ready to resume operations\n", pci_name(pdev)); in zpci_event_attempt_error_recovery()
236 if (driver->err_handler->resume) in zpci_event_attempt_error_recovery()
237 driver->err_handler->resume(pdev); in zpci_event_attempt_error_recovery()
245 /* zpci_event_io_failure - Report PCI channel failure state to driver
254 pdev->error_state = es; in zpci_event_io_failure()
256 * While vfio-pci's error_detected callback notifies user-space QEMU in zpci_event_io_failure()
264 driver = to_pci_driver(pdev->dev.driver); in zpci_event_io_failure()
265 if (driver && driver->err_handler && driver->err_handler->error_detected) in zpci_event_io_failure()
266 driver->err_handler->error_detected(pdev, pdev->error_state); in zpci_event_io_failure()
273 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); in __zpci_event_error()
278 ccdf->fid, ccdf->fh, ccdf->pec); in __zpci_event_error()
283 mutex_lock(&zdev->state_lock); in __zpci_event_error()
284 zpci_update_fh(zdev, ccdf->fh); in __zpci_event_error()
285 if (zdev->zbus->bus) in __zpci_event_error()
286 pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); in __zpci_event_error()
290 pdev ? pci_name(pdev) : "n/a", ccdf->pec, ccdf->fid); in __zpci_event_error()
295 switch (ccdf->pec) { in __zpci_event_error()
313 mutex_unlock(&zdev->state_lock); in __zpci_event_error()
335 zdev->state = ZPCI_FN_STATE_STANDBY; in zpci_event_hard_deconfigured()
340 struct zpci_dev *zdev = get_zdev_by_fid(ccdf->fid); in __zpci_event_availability()
345 ccdf->fid, ccdf->fh, ccdf->pec); in __zpci_event_availability()
348 mutex_lock(&zdev->state_lock); in __zpci_event_availability()
350 switch (ccdf->pec) { in __zpci_event_availability()
351 case 0x0301: /* Reserved|Standby -> Configured */ in __zpci_event_availability()
353 zdev = zpci_create_device(ccdf->fid, ccdf->fh, ZPCI_FN_STATE_CONFIGURED); in __zpci_event_availability()
362 if (zdev->state != ZPCI_FN_STATE_STANDBY) in __zpci_event_availability()
364 zdev->state = ZPCI_FN_STATE_CONFIGURED; in __zpci_event_availability()
366 zpci_scan_configured_device(zdev, ccdf->fh); in __zpci_event_availability()
368 case 0x0302: /* Reserved -> Standby */ in __zpci_event_availability()
370 zdev = zpci_create_device(ccdf->fid, ccdf->fh, ZPCI_FN_STATE_STANDBY); in __zpci_event_availability()
378 zpci_update_fh(zdev, ccdf->fh); in __zpci_event_availability()
386 if (zdev->state != ZPCI_FN_STATE_CONFIGURED) in __zpci_event_availability()
388 zpci_update_fh(zdev, ccdf->fh); in __zpci_event_availability()
392 case 0x0304: /* Configured -> Standby|Reserved */ in __zpci_event_availability()
397 if (zdev->state == ZPCI_FN_STATE_CONFIGURED) in __zpci_event_availability()
398 zpci_event_hard_deconfigured(zdev, ccdf->fh); in __zpci_event_availability()
400 if (!clp_get_state(zdev->fid, &state) && in __zpci_event_availability()
410 case 0x0308: /* Standby -> Reserved */ in __zpci_event_availability()
419 mutex_unlock(&zdev->state_lock); in __zpci_event_availability()