Lines Matching refs:edev
77 static bool eeh_dev_removed(struct eeh_dev *edev) in eeh_dev_removed() argument
79 return !edev || (edev->mode & EEH_DEV_REMOVED); in eeh_dev_removed()
82 static bool eeh_edev_actionable(struct eeh_dev *edev) in eeh_edev_actionable() argument
84 if (!edev->pdev) in eeh_edev_actionable()
86 if (edev->pdev->error_state == pci_channel_io_perm_failure) in eeh_edev_actionable()
88 if (eeh_dev_removed(edev)) in eeh_edev_actionable()
90 if (eeh_pe_passed(edev->pe)) in eeh_edev_actionable()
141 static void eeh_disable_irq(struct eeh_dev *edev) in eeh_disable_irq() argument
147 if (edev->pdev->msi_enabled || edev->pdev->msix_enabled) in eeh_disable_irq()
150 if (!irq_has_action(edev->pdev->irq)) in eeh_disable_irq()
153 edev->mode |= EEH_DEV_IRQ_DISABLED; in eeh_disable_irq()
154 disable_irq_nosync(edev->pdev->irq); in eeh_disable_irq()
164 static void eeh_enable_irq(struct eeh_dev *edev) in eeh_enable_irq() argument
166 if ((edev->mode) & EEH_DEV_IRQ_DISABLED) { in eeh_enable_irq()
167 edev->mode &= ~EEH_DEV_IRQ_DISABLED; in eeh_enable_irq()
188 if (irqd_irq_disabled(irq_get_irq_data(edev->pdev->irq))) in eeh_enable_irq()
189 enable_irq(edev->pdev->irq); in eeh_enable_irq()
193 static void eeh_dev_save_state(struct eeh_dev *edev, void *userdata) in eeh_dev_save_state() argument
197 if (!edev) in eeh_dev_save_state()
207 if (edev->pe && (edev->pe->state & EEH_PE_CFG_RESTRICTED)) in eeh_dev_save_state()
210 pdev = eeh_dev_to_pci_dev(edev); in eeh_dev_save_state()
220 struct eeh_dev *edev, *tmp; in eeh_set_channel_state() local
223 eeh_pe_for_each_dev(pe, edev, tmp) in eeh_set_channel_state()
224 if (eeh_edev_actionable(edev)) in eeh_set_channel_state()
225 edev->pdev->error_state = s; in eeh_set_channel_state()
231 struct eeh_dev *edev, *tmp; in eeh_set_irq_state() local
234 eeh_pe_for_each_dev(pe, edev, tmp) { in eeh_set_irq_state()
235 if (!eeh_edev_actionable(edev)) in eeh_set_irq_state()
238 if (!eeh_pcid_get(edev->pdev)) in eeh_set_irq_state()
242 eeh_enable_irq(edev); in eeh_set_irq_state()
244 eeh_disable_irq(edev); in eeh_set_irq_state()
246 eeh_pcid_put(edev->pdev); in eeh_set_irq_state()
254 static void eeh_pe_report_edev(struct eeh_dev *edev, eeh_report_fn fn, in eeh_pe_report_edev() argument
262 pdev = edev->pdev; in eeh_pe_report_edev()
267 eeh_edev_info(edev, "no device"); in eeh_pe_report_edev()
271 if (eeh_edev_actionable(edev)) { in eeh_pe_report_edev()
275 eeh_edev_info(edev, "no driver"); in eeh_pe_report_edev()
277 eeh_edev_info(edev, "driver not EEH aware"); in eeh_pe_report_edev()
278 else if (edev->mode & EEH_DEV_NO_HANDLER) in eeh_pe_report_edev()
279 eeh_edev_info(edev, "driver bound too late"); in eeh_pe_report_edev()
281 new_result = fn(edev, pdev, driver); in eeh_pe_report_edev()
282 eeh_edev_info(edev, "%s driver reports: '%s'", in eeh_pe_report_edev()
292 eeh_edev_info(edev, "not actionable (%d,%d,%d)", !!pdev, in eeh_pe_report_edev()
293 !eeh_dev_removed(edev), !eeh_pe_passed(edev->pe)); in eeh_pe_report_edev()
296 if (edev->pdev != pdev) in eeh_pe_report_edev()
297 eeh_edev_warn(edev, "Device changed during processing!\n"); in eeh_pe_report_edev()
305 struct eeh_dev *edev, *tmp; in eeh_pe_report() local
308 eeh_for_each_pe(root, pe) eeh_pe_for_each_dev(pe, edev, tmp) in eeh_pe_report()
309 eeh_pe_report_edev(edev, fn, result); in eeh_pe_report()
324 static enum pci_ers_result eeh_report_error(struct eeh_dev *edev, in eeh_report_error() argument
333 eeh_edev_info(edev, "Invoking %s->error_detected(IO frozen)", in eeh_report_error()
337 edev->in_error = true; in eeh_report_error()
350 static enum pci_ers_result eeh_report_mmio_enabled(struct eeh_dev *edev, in eeh_report_mmio_enabled() argument
356 eeh_edev_info(edev, "Invoking %s->mmio_enabled()", driver->name); in eeh_report_mmio_enabled()
370 static enum pci_ers_result eeh_report_reset(struct eeh_dev *edev, in eeh_report_reset() argument
374 if (!driver->err_handler->slot_reset || !edev->in_error) in eeh_report_reset()
376 eeh_edev_info(edev, "Invoking %s->slot_reset()", driver->name); in eeh_report_reset()
380 static void eeh_dev_restore_state(struct eeh_dev *edev, void *userdata) in eeh_dev_restore_state() argument
384 if (!edev) in eeh_dev_restore_state()
393 if (edev->pe && (edev->pe->state & EEH_PE_CFG_RESTRICTED)) { in eeh_dev_restore_state()
394 if (list_is_last(&edev->entry, &edev->pe->edevs)) in eeh_dev_restore_state()
395 eeh_pe_restore_bars(edev->pe); in eeh_dev_restore_state()
400 pdev = eeh_dev_to_pci_dev(edev); in eeh_dev_restore_state()
416 static enum pci_ers_result eeh_report_resume(struct eeh_dev *edev, in eeh_report_resume() argument
420 if (!driver->err_handler->resume || !edev->in_error) in eeh_report_resume()
423 eeh_edev_info(edev, "Invoking %s->resume()", driver->name); in eeh_report_resume()
426 pci_uevent_ers(edev->pdev, PCI_ERS_RESULT_RECOVERED); in eeh_report_resume()
429 eeh_ops->notify_resume(edev); in eeh_report_resume()
442 static enum pci_ers_result eeh_report_failure(struct eeh_dev *edev, in eeh_report_failure() argument
451 eeh_edev_info(edev, "Invoking %s->error_detected(permanent failure)", in eeh_report_failure()
460 static void *eeh_add_virt_device(struct eeh_dev *edev) in eeh_add_virt_device() argument
463 struct pci_dev *dev = eeh_dev_to_pci_dev(edev); in eeh_add_virt_device()
465 if (!(edev->physfn)) { in eeh_add_virt_device()
466 eeh_edev_warn(edev, "Not for VF\n"); in eeh_add_virt_device()
480 pci_iov_add_virtfn(edev->physfn, edev->vf_index); in eeh_add_virt_device()
485 static void eeh_rmv_device(struct eeh_dev *edev, void *userdata) in eeh_rmv_device() argument
488 struct pci_dev *dev = eeh_dev_to_pci_dev(edev); in eeh_rmv_device()
498 if (!eeh_edev_actionable(edev) || in eeh_rmv_device()
518 edev->mode |= EEH_DEV_DISCONNECTED; in eeh_rmv_device()
522 if (edev->physfn) { in eeh_rmv_device()
524 pci_iov_remove_virtfn(edev->physfn, edev->vf_index); in eeh_rmv_device()
525 edev->pdev = NULL; in eeh_rmv_device()
528 list_add(&edev->rmv_entry, &rmv_data->removed_vf_list); in eeh_rmv_device()
538 struct eeh_dev *edev, *tmp; in eeh_pe_detach_dev() local
540 eeh_pe_for_each_dev(pe, edev, tmp) { in eeh_pe_detach_dev()
541 if (!(edev->mode & EEH_DEV_DISCONNECTED)) in eeh_pe_detach_dev()
544 edev->mode &= ~(EEH_DEV_DISCONNECTED | EEH_DEV_IRQ_DISABLED); in eeh_pe_detach_dev()
545 eeh_pe_tree_remove(edev); in eeh_pe_detach_dev()
630 struct eeh_dev *edev; in eeh_reset_device() local
698 edev = list_first_entry(&pe->edevs, struct eeh_dev, entry); in eeh_reset_device()
701 eeh_add_virt_device(edev); in eeh_reset_device()
839 struct eeh_dev *edev, *tmp; in eeh_handle_normal_event() local
864 eeh_pe_for_each_dev(tmp_pe, edev, tmp) in eeh_handle_normal_event()
865 if (eeh_slot_presence_check(edev->pdev)) in eeh_handle_normal_event()
918 eeh_pe_for_each_dev(tmp_pe, edev, tmp) in eeh_handle_normal_event()
919 edev->mode &= ~EEH_DEV_NO_HANDLER; in eeh_handle_normal_event()
1038 list_for_each_entry_safe(edev, tmp, &rmv_data.removed_vf_list, in eeh_handle_normal_event()
1040 eeh_add_virt_device(edev); in eeh_handle_normal_event()
1041 list_del(&edev->rmv_entry); in eeh_handle_normal_event()
1050 eeh_pe_for_each_dev(tmp_pe, edev, tmp) { in eeh_handle_normal_event()
1051 edev->mode &= ~EEH_DEV_NO_HANDLER; in eeh_handle_normal_event()
1052 edev->in_error = false; in eeh_handle_normal_event()
1108 eeh_pe_for_each_dev(tmp_pe, edev, tmp) in eeh_handle_normal_event()
1109 eeh_clear_slot_attention(edev->pdev); in eeh_handle_normal_event()
1124 struct eeh_dev *edev, *tmp_edev; in eeh_handle_special_event() local
1187 eeh_pe_for_each_dev(tmp_pe, edev, tmp_edev) in eeh_handle_special_event()
1188 edev->mode &= ~EEH_DEV_NO_HANDLER; in eeh_handle_special_event()