Lines Matching full:pe
90 if (eeh_pe_passed(edev->pe)) in eeh_edev_actionable()
207 if (edev->pe && (edev->pe->state & EEH_PE_CFG_RESTRICTED)) in eeh_dev_save_state()
219 struct eeh_pe *pe; in eeh_set_channel_state() local
222 eeh_for_each_pe(root, pe) in eeh_set_channel_state()
223 eeh_pe_for_each_dev(pe, edev, tmp) in eeh_set_channel_state()
230 struct eeh_pe *pe; in eeh_set_irq_state() local
233 eeh_for_each_pe(root, pe) { in eeh_set_irq_state()
234 eeh_pe_for_each_dev(pe, edev, tmp) { in eeh_set_irq_state()
293 !eeh_dev_removed(edev), !eeh_pe_passed(edev->pe)); in eeh_pe_report_edev()
304 struct eeh_pe *pe; in eeh_pe_report() local
308 eeh_for_each_pe(root, pe) eeh_pe_for_each_dev(pe, edev, tmp) in eeh_pe_report()
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()
536 static void *eeh_pe_detach_dev(struct eeh_pe *pe, void *userdata) in eeh_pe_detach_dev() argument
540 eeh_pe_for_each_dev(pe, edev, tmp) { in eeh_pe_detach_dev()
552 * Explicitly clear PE's frozen state for PowerNV where
553 * we have frozen PE until BAR restore is completed. It's
555 * PE reset (for 3 times), we try to clear the frozen state
560 struct eeh_pe *pe; in eeh_clear_pe_frozen_state() local
563 eeh_for_each_pe(root, pe) { in eeh_clear_pe_frozen_state()
564 if (include_passed || !eeh_pe_passed(pe)) { in eeh_clear_pe_frozen_state()
566 if (!eeh_unfreeze_pe(pe)) in eeh_clear_pe_frozen_state()
576 int eeh_pe_reset_and_recover(struct eeh_pe *pe) in eeh_pe_reset_and_recover() argument
580 /* Bail if the PE is being recovered */ in eeh_pe_reset_and_recover()
581 if (pe->state & EEH_PE_RECOVERING) in eeh_pe_reset_and_recover()
584 /* Put the PE into recovery mode */ in eeh_pe_reset_and_recover()
585 eeh_pe_state_mark(pe, EEH_PE_RECOVERING); in eeh_pe_reset_and_recover()
588 eeh_pe_dev_traverse(pe, eeh_dev_save_state, NULL); in eeh_pe_reset_and_recover()
591 ret = eeh_pe_reset_full(pe, true); in eeh_pe_reset_and_recover()
593 eeh_pe_state_clear(pe, EEH_PE_RECOVERING, true); in eeh_pe_reset_and_recover()
597 /* Unfreeze the PE */ in eeh_pe_reset_and_recover()
598 ret = eeh_clear_pe_frozen_state(pe, true); in eeh_pe_reset_and_recover()
600 eeh_pe_state_clear(pe, EEH_PE_RECOVERING, true); in eeh_pe_reset_and_recover()
605 eeh_pe_dev_traverse(pe, eeh_dev_restore_state, NULL); in eeh_pe_reset_and_recover()
608 eeh_pe_state_clear(pe, EEH_PE_RECOVERING, true); in eeh_pe_reset_and_recover()
616 * @pe: EEH PE
620 * This routine must be called to do reset on the indicated PE.
624 static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus, in eeh_reset_device() argument
634 eeh_for_each_pe(pe, tmp_pe) in eeh_reset_device()
638 cnt = pe->freeze_count; in eeh_reset_device()
639 tstamp = pe->tstamp; in eeh_reset_device()
642 * We don't remove the corresponding PE instances because in eeh_reset_device()
647 eeh_pe_state_mark(pe, EEH_PE_KEEP); in eeh_reset_device()
648 if (any_passed || driver_eeh_aware || (pe->type & EEH_PE_VF)) { in eeh_reset_device()
649 eeh_pe_dev_traverse(pe, eeh_rmv_device, rmv_data); in eeh_reset_device()
665 rc = eeh_pe_reset_full(pe, false); in eeh_reset_device()
671 /* Restore PE */ in eeh_reset_device()
672 eeh_ops->configure_bridge(pe); in eeh_reset_device()
673 eeh_pe_restore_bars(pe); in eeh_reset_device()
676 rc = eeh_clear_pe_frozen_state(pe, false); in eeh_reset_device()
695 * PE. We should disconnect it so the binding can be in eeh_reset_device()
698 edev = list_first_entry(&pe->edevs, struct eeh_dev, entry); in eeh_reset_device()
699 eeh_pe_traverse(pe, eeh_pe_detach_dev, NULL); in eeh_reset_device()
700 if (pe->type & EEH_PE_VF) { in eeh_reset_device()
704 eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true); in eeh_reset_device()
708 eeh_pe_state_clear(pe, EEH_PE_KEEP, true); in eeh_reset_device()
710 pe->tstamp = tstamp; in eeh_reset_device()
711 pe->freeze_count = cnt; in eeh_reset_device()
723 /* Walks the PE tree after processing an event to remove any stale PEs.
730 static void eeh_pe_cleanup(struct eeh_pe *pe) in eeh_pe_cleanup() argument
734 list_for_each_entry_safe(child_pe, tmp, &pe->child_list, child) in eeh_pe_cleanup()
737 if (pe->state & EEH_PE_KEEP) in eeh_pe_cleanup()
740 if (!(pe->state & EEH_PE_INVALID)) in eeh_pe_cleanup()
743 if (list_empty(&pe->edevs) && list_empty(&pe->child_list)) { in eeh_pe_cleanup()
744 list_del(&pe->child); in eeh_pe_cleanup()
745 kfree(pe); in eeh_pe_cleanup()
754 * presence state. This might happen for for PCIe slots if the PE containing
755 * the upstream bridge is also frozen, or the bridge is part of the same PE
816 * eeh_handle_normal_event - Handle EEH events on a specific PE
817 * @pe: EEH PE - which should not be used after we return, as it may
820 * Attempts to recover the given PE. If recovery fails or the PE has failed
821 * too many times, remove the PE.
824 * slot, the associated PE will be frozen. Besides, DMA's occurring
836 void eeh_handle_normal_event(struct eeh_pe *pe) in eeh_handle_normal_event() argument
847 bus = eeh_pe_bus_get(pe); in eeh_handle_normal_event()
849 pr_err("%s: Cannot find PCI bus for PHB#%x-PE#%x\n", in eeh_handle_normal_event()
850 __func__, pe->phb->global_number, pe->addr); in eeh_handle_normal_event()
863 eeh_for_each_pe(pe, tmp_pe) in eeh_handle_normal_event()
869 pr_debug("EEH: Frozen PHB#%x-PE#%x is empty!\n", in eeh_handle_normal_event()
870 pe->phb->global_number, pe->addr); in eeh_handle_normal_event()
875 if (pe->type & EEH_PE_PHB) { in eeh_handle_normal_event()
877 pe->phb->global_number, eeh_pe_loc_get(pe)); in eeh_handle_normal_event()
879 struct eeh_pe *phb_pe = eeh_phb_pe_get(pe->phb); in eeh_handle_normal_event()
881 pr_err("EEH: Recovering PHB#%x-PE#%x\n", in eeh_handle_normal_event()
882 pe->phb->global_number, pe->addr); in eeh_handle_normal_event()
883 pr_err("EEH: PE location: %s, PHB location: %s\n", in eeh_handle_normal_event()
884 eeh_pe_loc_get(pe), eeh_pe_loc_get(phb_pe)); in eeh_handle_normal_event()
892 if (pe->trace_entries) { in eeh_handle_normal_event()
893 void **ptrs = (void **) pe->stack_trace; in eeh_handle_normal_event()
896 pr_err("EEH: Frozen PHB#%x-PE#%x detected\n", in eeh_handle_normal_event()
897 pe->phb->global_number, pe->addr); in eeh_handle_normal_event()
901 for (i = 0; i < pe->trace_entries; i++) in eeh_handle_normal_event()
904 pe->trace_entries = 0; in eeh_handle_normal_event()
908 eeh_pe_update_time_stamp(pe); in eeh_handle_normal_event()
909 pe->freeze_count++; in eeh_handle_normal_event()
910 if (pe->freeze_count > eeh_max_freezes) { in eeh_handle_normal_event()
911 …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()
912 pe->phb->global_number, pe->addr, in eeh_handle_normal_event()
913 pe->freeze_count); in eeh_handle_normal_event()
917 eeh_for_each_pe(pe, tmp_pe) in eeh_handle_normal_event()
933 pe->freeze_count, eeh_max_freezes); in eeh_handle_normal_event()
935 eeh_set_channel_state(pe, pci_channel_io_frozen); in eeh_handle_normal_event()
936 eeh_set_irq_state(pe, false); in eeh_handle_normal_event()
937 eeh_pe_report("error_detected(IO frozen)", pe, in eeh_handle_normal_event()
939 if ((pe->type & EEH_PE_PHB) && in eeh_handle_normal_event()
949 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()
971 rc = eeh_reset_device(pe, bus, NULL, false); in eeh_handle_normal_event()
982 rc = eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); in eeh_handle_normal_event()
990 eeh_pe_report("mmio_enabled", pe, in eeh_handle_normal_event()
998 rc = eeh_pci_enable(pe, EEH_OPT_THAW_DMA); in eeh_handle_normal_event()
1006 * We didn't do PE reset for the case. The PE in eeh_handle_normal_event()
1008 * resuming the PE. in eeh_handle_normal_event()
1010 eeh_pe_state_clear(pe, EEH_PE_ISOLATED, true); in eeh_handle_normal_event()
1018 rc = eeh_reset_device(pe, bus, &rmv_data, true); in eeh_handle_normal_event()
1025 eeh_set_channel_state(pe, pci_channel_io_normal); in eeh_handle_normal_event()
1026 eeh_set_irq_state(pe, true); in eeh_handle_normal_event()
1027 eeh_pe_report("slot_reset", pe, eeh_report_reset, in eeh_handle_normal_event()
1046 eeh_set_channel_state(pe, pci_channel_io_normal); in eeh_handle_normal_event()
1047 eeh_set_irq_state(pe, true); in eeh_handle_normal_event()
1048 eeh_pe_report("resume", pe, eeh_report_resume, NULL); in eeh_handle_normal_event()
1049 eeh_for_each_pe(pe, tmp_pe) { in eeh_handle_normal_event()
1063 pr_err("EEH: Unable to recover from failure from PHB#%x-PE#%x.\n" in eeh_handle_normal_event()
1065 pe->phb->global_number, pe->addr); in eeh_handle_normal_event()
1067 eeh_slot_error_detail(pe, EEH_LOG_PERM); in eeh_handle_normal_event()
1070 eeh_set_channel_state(pe, pci_channel_io_perm_failure); in eeh_handle_normal_event()
1071 eeh_set_irq_state(pe, false); in eeh_handle_normal_event()
1072 eeh_pe_report("error_detected(permanent failure)", pe, in eeh_handle_normal_event()
1075 /* Mark the PE to be removed permanently */ in eeh_handle_normal_event()
1076 eeh_pe_state_mark(pe, EEH_PE_REMOVED); in eeh_handle_normal_event()
1083 if (pe->type & EEH_PE_VF) { in eeh_handle_normal_event()
1084 eeh_pe_dev_traverse(pe, eeh_rmv_device, NULL); in eeh_handle_normal_event()
1085 eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED); in eeh_handle_normal_event()
1087 eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true); in eeh_handle_normal_event()
1088 eeh_pe_dev_mode_mark(pe, EEH_DEV_REMOVED); in eeh_handle_normal_event()
1093 /* The passed PE should no longer be used */ in eeh_handle_normal_event()
1101 * we don't want to modify the PE tree structure so we do it here. in eeh_handle_normal_event()
1103 eeh_pe_cleanup(pe); in eeh_handle_normal_event()
1106 eeh_for_each_pe(pe, tmp_pe) in eeh_handle_normal_event()
1110 eeh_pe_state_clear(pe, EEH_PE_RECOVERING, true); in eeh_handle_normal_event()
1114 * eeh_handle_special_event - Handle EEH events without a specific failing PE
1117 * specific PE. Iterates through possible failures and handles them as
1122 struct eeh_pe *pe, *phb_pe, *tmp_pe; in eeh_handle_special_event() local
1131 rc = eeh_ops->next_error(&pe); in eeh_handle_special_event()
1154 /* Mark the PE in fenced state */ in eeh_handle_special_event()
1158 eeh_remove_event(pe, true); in eeh_handle_special_event()
1161 eeh_pe_state_mark(pe, EEH_PE_RECOVERING); in eeh_handle_special_event()
1162 eeh_pe_mark_isolated(pe); in eeh_handle_special_event()
1176 * For fenced PHB and frozen PE, it's handled as normal in eeh_handle_special_event()
1182 eeh_pe_state_mark(pe, EEH_PE_RECOVERING); in eeh_handle_special_event()
1183 eeh_handle_normal_event(pe); in eeh_handle_special_event()
1185 eeh_for_each_pe(pe, tmp_pe) in eeh_handle_special_event()
1190 eeh_pe_state_clear(pe, EEH_PE_PRI_BUS, true); in eeh_handle_special_event()
1191 eeh_set_channel_state(pe, pci_channel_io_perm_failure); in eeh_handle_special_event()
1193 "error_detected(permanent failure)", pe, in eeh_handle_special_event()
1207 "PHB#%x-PE#%x\n", in eeh_handle_special_event()
1209 pe->phb->global_number, in eeh_handle_special_event()
1210 pe->addr); in eeh_handle_special_event()