Lines Matching full:pe

89 	if (eeh_pe_passed(edev->pe))  in eeh_edev_actionable()
206 if (edev->pe && (edev->pe->state & EEH_PE_CFG_RESTRICTED)) in eeh_dev_save_state()
218 struct eeh_pe *pe; in eeh_set_channel_state() local
221 eeh_for_each_pe(root, pe) in eeh_set_channel_state()
222 eeh_pe_for_each_dev(pe, edev, tmp) in eeh_set_channel_state()
229 struct eeh_pe *pe; in eeh_set_irq_state() local
232 eeh_for_each_pe(root, pe) { in eeh_set_irq_state()
233 eeh_pe_for_each_dev(pe, edev, tmp) { in eeh_set_irq_state()
292 !eeh_dev_removed(edev), !eeh_pe_passed(edev->pe));
303 struct eeh_pe *pe; in eeh_pe_report() local
307 eeh_for_each_pe(root, pe) eeh_pe_for_each_dev(pe, edev, tmp) in eeh_pe_report()
392 if (edev->pe && (edev->pe->state & EEH_PE_CFG_RESTRICTED)) { in eeh_dev_restore_state()
393 if (list_is_last(&edev->entry, &edev->pe->edevs)) in eeh_dev_restore_state()
394 eeh_pe_restore_bars(edev->pe); in eeh_dev_restore_state()
535 static void *eeh_pe_detach_dev(struct eeh_pe *pe, void *userdata) in eeh_pe_detach_dev() argument
539 eeh_pe_for_each_dev(pe, edev, tmp) { in eeh_pe_detach_dev()
551 * Explicitly clear PE's frozen state for PowerNV where
552 * we have frozen PE until BAR restore is completed. It's
554 * PE reset (for 3 times), we try to clear the frozen state
559 struct eeh_pe *pe; in eeh_clear_pe_frozen_state() local
562 eeh_for_each_pe(root, pe) { in eeh_clear_pe_frozen_state()
563 if (include_passed || !eeh_pe_passed(pe)) { in eeh_clear_pe_frozen_state()
565 if (!eeh_unfreeze_pe(pe)) in eeh_clear_pe_frozen_state()
575 int eeh_pe_reset_and_recover(struct eeh_pe *pe) in eeh_pe_reset_and_recover() argument
579 /* Bail if the PE is being recovered */ in eeh_pe_reset_and_recover()
580 if (pe->state & EEH_PE_RECOVERING) in eeh_pe_reset_and_recover()
583 /* Put the PE into recovery mode */ in eeh_pe_reset_and_recover()
584 eeh_pe_state_mark(pe, EEH_PE_RECOVERING); in eeh_pe_reset_and_recover()
587 eeh_pe_dev_traverse(pe, eeh_dev_save_state, NULL); in eeh_pe_reset_and_recover()
590 ret = eeh_pe_reset_full(pe, true); in eeh_pe_reset_and_recover()
592 eeh_pe_state_clear(pe, EEH_PE_RECOVERING, true); in eeh_pe_reset_and_recover()
596 /* Unfreeze the PE */ in eeh_pe_reset_and_recover()
597 ret = eeh_clear_pe_frozen_state(pe, true); in eeh_pe_reset_and_recover()
599 eeh_pe_state_clear(pe, EEH_PE_RECOVERING, true); in eeh_pe_reset_and_recover()
604 eeh_pe_dev_traverse(pe, eeh_dev_restore_state, NULL); in eeh_pe_reset_and_recover()
607 eeh_pe_state_clear(pe, EEH_PE_RECOVERING, true); in eeh_pe_reset_and_recover()
615 * @pe: EEH PE
619 * This routine must be called to do reset on the indicated PE.
623 static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus, in eeh_reset_device() argument
633 eeh_for_each_pe(pe, tmp_pe) in eeh_reset_device()
637 cnt = pe->freeze_count; in eeh_reset_device()
638 tstamp = pe->tstamp; in eeh_reset_device()
641 * We don't remove the corresponding PE instances because in eeh_reset_device()
646 eeh_pe_state_mark(pe, EEH_PE_KEEP); in eeh_reset_device()
647 if (any_passed || driver_eeh_aware || (pe->type & EEH_PE_VF)) { in eeh_reset_device()
648 eeh_pe_dev_traverse(pe, eeh_rmv_device, rmv_data); in eeh_reset_device()
664 rc = eeh_pe_reset_full(pe, false); in eeh_reset_device()
670 /* Restore PE */ in eeh_reset_device()
671 eeh_ops->configure_bridge(pe); in eeh_reset_device()
672 eeh_pe_restore_bars(pe); in eeh_reset_device()
675 rc = eeh_clear_pe_frozen_state(pe, false); in eeh_reset_device()
694 * PE. We should disconnect it so the binding can be in eeh_reset_device()
697 edev = list_first_entry(&pe->edevs, struct eeh_dev, entry); in eeh_reset_device()
698 eeh_pe_traverse(pe, eeh_pe_detach_dev, NULL); in eeh_reset_device()
699 if (pe->type & EEH_PE_VF) { in eeh_reset_device()
703 eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true); in eeh_reset_device()
707 eeh_pe_state_clear(pe, EEH_PE_KEEP, true); in eeh_reset_device()
709 pe->tstamp = tstamp; in eeh_reset_device()
710 pe->freeze_count = cnt; in eeh_reset_device()
722 /* Walks the PE tree after processing an event to remove any stale PEs.
729 static void eeh_pe_cleanup(struct eeh_pe *pe) in eeh_pe_cleanup() argument
733 list_for_each_entry_safe(child_pe, tmp, &pe->child_list, child) in eeh_pe_cleanup()
736 if (pe->state & EEH_PE_KEEP) in eeh_pe_cleanup()
739 if (!(pe->state & EEH_PE_INVALID)) in eeh_pe_cleanup()
742 if (list_empty(&pe->edevs) && list_empty(&pe->child_list)) { in eeh_pe_cleanup()
743 list_del(&pe->child); in eeh_pe_cleanup()
744 kfree(pe); in eeh_pe_cleanup()
753 * presence state. This might happen for PCIe slots if the PE containing
754 * the upstream bridge is also frozen, or the bridge is part of the same PE
815 * eeh_handle_normal_event - Handle EEH events on a specific PE
816 * @pe: EEH PE - which should not be used after we return, as it may
819 * Attempts to recover the given PE. If recovery fails or the PE has failed
820 * too many times, remove the PE.
823 * slot, the associated PE will be frozen. Besides, DMA's occurring
835 void eeh_handle_normal_event(struct eeh_pe *pe) in eeh_handle_normal_event() argument
846 bus = eeh_pe_bus_get(pe); in eeh_handle_normal_event()
848 pr_err("%s: Cannot find PCI bus for PHB#%x-PE#%x\n", in eeh_handle_normal_event()
849 __func__, pe->phb->global_number, pe->addr); in eeh_handle_normal_event()
862 eeh_for_each_pe(pe, tmp_pe) in eeh_handle_normal_event()
868 pr_debug("EEH: Frozen PHB#%x-PE#%x is empty!\n", in eeh_handle_normal_event()
869 pe->phb->global_number, pe->addr); in eeh_handle_normal_event()
874 if (pe->type & EEH_PE_PHB) { in eeh_handle_normal_event()
876 pe->phb->global_number, eeh_pe_loc_get(pe)); in eeh_handle_normal_event()
878 struct eeh_pe *phb_pe = eeh_phb_pe_get(pe->phb); in eeh_handle_normal_event()
880 pr_err("EEH: Recovering PHB#%x-PE#%x\n", in eeh_handle_normal_event()
881 pe->phb->global_number, pe->addr); in eeh_handle_normal_event()
882 pr_err("EEH: PE location: %s, PHB location: %s\n", in eeh_handle_normal_event()
883 eeh_pe_loc_get(pe), eeh_pe_loc_get(phb_pe)); in eeh_handle_normal_event()
891 if (pe->trace_entries) { in eeh_handle_normal_event()
892 void **ptrs = (void **) pe->stack_trace; in eeh_handle_normal_event()
895 pr_err("EEH: Frozen PHB#%x-PE#%x detected\n", in eeh_handle_normal_event()
896 pe->phb->global_number, pe->addr); in eeh_handle_normal_event()
900 for (i = 0; i < pe->trace_entries; i++) in eeh_handle_normal_event()
903 pe->trace_entries = 0; in eeh_handle_normal_event()
907 eeh_for_each_pe(pe, tmp_pe) in eeh_handle_normal_event()
911 eeh_pe_update_time_stamp(pe); in eeh_handle_normal_event()
912 pe->freeze_count++; in eeh_handle_normal_event()
913 if (pe->freeze_count > eeh_max_freezes) { in eeh_handle_normal_event()
914 …pr_err("EEH: PHB#%x-PE#%x has failed %d times in the last hour and has been permanently disabled.\… in eeh_handle_normal_event()
915 pe->phb->global_number, pe->addr, in eeh_handle_normal_event()
916 pe->freeze_count); in eeh_handle_normal_event()
932 pe->freeze_count, eeh_max_freezes); in eeh_handle_normal_event()
934 eeh_set_channel_state(pe, pci_channel_io_frozen); in eeh_handle_normal_event()
935 eeh_set_irq_state(pe, false); in eeh_handle_normal_event()
936 eeh_pe_report("error_detected(IO frozen)", pe, in eeh_handle_normal_event()
945 if ((pe->type & EEH_PE_PHB) && result != PCI_ERS_RESULT_NONE) in eeh_handle_normal_event()
951 rc = eeh_wait_state(pe, MAX_WAIT_FOR_RECOVERY * 1000); in eeh_handle_normal_event()
962 eeh_slot_error_detail(pe, EEH_LOG_TEMP); in eeh_handle_normal_event()
970 rc = eeh_reset_device(pe, bus, NULL, false); in eeh_handle_normal_event()
980 rc = eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); in eeh_handle_normal_event()
988 eeh_pe_report("mmio_enabled", pe, in eeh_handle_normal_event()
994 rc = eeh_pci_enable(pe, EEH_OPT_THAW_DMA); in eeh_handle_normal_event()
1002 * We didn't do PE reset for the case. The PE in eeh_handle_normal_event()
1004 * resuming the PE. in eeh_handle_normal_event()
1006 eeh_pe_state_clear(pe, EEH_PE_ISOLATED, true); in eeh_handle_normal_event()
1014 rc = eeh_reset_device(pe, bus, &rmv_data, true); in eeh_handle_normal_event()
1021 eeh_set_channel_state(pe, pci_channel_io_normal); in eeh_handle_normal_event()
1022 eeh_set_irq_state(pe, true); in eeh_handle_normal_event()
1023 eeh_pe_report("slot_reset", pe, eeh_report_reset, in eeh_handle_normal_event()
1041 eeh_set_channel_state(pe, pci_channel_io_normal); in eeh_handle_normal_event()
1042 eeh_set_irq_state(pe, true); in eeh_handle_normal_event()
1043 eeh_pe_report("resume", pe, eeh_report_resume, NULL); in eeh_handle_normal_event()
1044 eeh_for_each_pe(pe, tmp_pe) { in eeh_handle_normal_event()
1061 pr_err("EEH: Unable to recover from failure from PHB#%x-PE#%x.\n" in eeh_handle_normal_event()
1063 pe->phb->global_number, pe->addr); in eeh_handle_normal_event()
1065 eeh_slot_error_detail(pe, EEH_LOG_PERM); in eeh_handle_normal_event()
1068 eeh_set_irq_state(pe, false); in eeh_handle_normal_event()
1069 eeh_pe_report("error_detected(permanent failure)", pe, in eeh_handle_normal_event()
1071 eeh_set_channel_state(pe, pci_channel_io_perm_failure); in eeh_handle_normal_event()
1073 /* Mark the PE to be removed permanently */ in eeh_handle_normal_event()
1074 eeh_pe_state_mark(pe, EEH_PE_REMOVED); in eeh_handle_normal_event()
1081 if (pe->type & EEH_PE_VF) { in eeh_handle_normal_event()
1082 eeh_pe_dev_traverse(pe, eeh_rmv_device, NULL); in eeh_handle_normal_event()
1083 eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED); in eeh_handle_normal_event()
1085 eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true); in eeh_handle_normal_event()
1086 eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED); in eeh_handle_normal_event()
1091 /* The passed PE should no longer be used */ in eeh_handle_normal_event()
1098 * we don't want to modify the PE tree structure so we do it here. in eeh_handle_normal_event()
1100 eeh_pe_cleanup(pe); in eeh_handle_normal_event()
1103 eeh_for_each_pe(pe, tmp_pe) in eeh_handle_normal_event()
1107 eeh_pe_state_clear(pe, EEH_PE_RECOVERING, true); in eeh_handle_normal_event()
1111 * eeh_handle_special_event - Handle EEH events without a specific failing PE
1114 * specific PE. Iterates through possible failures and handles them as
1119 struct eeh_pe *pe, *phb_pe, *tmp_pe; in eeh_handle_special_event() local
1128 rc = eeh_ops->next_error(&pe); in eeh_handle_special_event()
1151 /* Mark the PE in fenced state */ in eeh_handle_special_event()
1155 eeh_remove_event(pe, true); in eeh_handle_special_event()
1158 eeh_pe_state_mark(pe, EEH_PE_RECOVERING); in eeh_handle_special_event()
1159 eeh_pe_mark_isolated(pe); in eeh_handle_special_event()
1173 * For fenced PHB and frozen PE, it's handled as normal in eeh_handle_special_event()
1179 eeh_pe_state_mark(pe, EEH_PE_RECOVERING); in eeh_handle_special_event()
1180 eeh_handle_normal_event(pe); in eeh_handle_special_event()
1182 eeh_for_each_pe(pe, tmp_pe) in eeh_handle_special_event()
1187 eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true); in eeh_handle_special_event()
1189 "error_detected(permanent failure)", pe, in eeh_handle_special_event()
1191 eeh_set_channel_state(pe, pci_channel_io_perm_failure); in eeh_handle_special_event()
1204 "PHB#%x-PE#%x\n", in eeh_handle_special_event()
1206 pe->phb->global_number, in eeh_handle_special_event()
1207 pe->addr); in eeh_handle_special_event()