Lines Matching full:pe
89 * PE would be created there.
95 * EEH allowed maximal frozen times. If one particular PE's
96 * frozen count in last hour exceeds this limit, the PE will
137 u64 slot_resets; /* PE reset */
176 edev->pe->phb->global_number, edev->bdfn >> 8, in eeh_dump_dev_log()
179 edev->pe->phb->global_number, edev->bdfn >> 8, in eeh_dump_dev_log()
269 static void *eeh_dump_pe_log(struct eeh_pe *pe, void *flag) in eeh_dump_pe_log() argument
274 eeh_pe_for_each_dev(pe, edev, tmp) in eeh_dump_pe_log()
283 * @pe: EEH PE
291 void eeh_slot_error_detail(struct eeh_pe *pe, int severity) in eeh_slot_error_detail() argument
304 * When the @severity is EEH_LOG_PERM, the PE is going to be in eeh_slot_error_detail()
306 * the PE will be closed. The drivers rely on working IO path in eeh_slot_error_detail()
311 if (!(pe->type & EEH_PE_PHB)) { in eeh_slot_error_detail()
314 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); in eeh_slot_error_detail()
321 * is set automatically when the PE is put to EEH_PE_ISOLATED. in eeh_slot_error_detail()
328 eeh_ops->configure_bridge(pe); in eeh_slot_error_detail()
329 if (!(pe->state & EEH_PE_CFG_BLOCKED)) { in eeh_slot_error_detail()
330 eeh_pe_restore_bars(pe); in eeh_slot_error_detail()
333 eeh_pe_traverse(pe, eeh_dump_pe_log, &loglen); in eeh_slot_error_detail()
337 eeh_ops->get_log(pe, severity, pci_regs_buf, loglen); in eeh_slot_error_detail()
378 * For that case, it's meaningless to recover frozen PE. Intead,
381 static int eeh_phb_check_failure(struct eeh_pe *pe) in eeh_phb_check_failure() argument
390 /* Find the PHB PE */ in eeh_phb_check_failure()
391 phb_pe = eeh_phb_pe_get(pe->phb); in eeh_phb_check_failure()
393 pr_warn("%s Can't find PE for PHB#%x\n", in eeh_phb_check_failure()
394 __func__, pe->phb->global_number); in eeh_phb_check_failure()
446 struct eeh_pe *pe, *parent_pe; in eeh_dev_check_failure() local
460 pe = eeh_dev_to_pe(edev); in eeh_dev_check_failure()
463 if (!pe) { in eeh_dev_check_failure()
473 ret = eeh_phb_check_failure(pe); in eeh_dev_check_failure()
478 * If the PE isn't owned by us, we shouldn't check the in eeh_dev_check_failure()
479 * state. Instead, let the owner handle it if the PE has in eeh_dev_check_failure()
482 if (eeh_pe_passed(pe)) in eeh_dev_check_failure()
493 if (pe->state & EEH_PE_ISOLATED) { in eeh_dev_check_failure()
494 pe->check_count++; in eeh_dev_check_failure()
495 if (pe->check_count == EEH_MAX_FAILS) { in eeh_dev_check_failure()
501 pe->check_count, in eeh_dev_check_failure()
518 ret = eeh_ops->get_state(pe, NULL); in eeh_dev_check_failure()
523 * PE's state, EEH not support and Permanently unavailable in eeh_dev_check_failure()
524 * state, PE is in good state. in eeh_dev_check_failure()
529 pe->false_positives++; in eeh_dev_check_failure()
535 * It should be corner case that the parent PE has been in eeh_dev_check_failure()
539 parent_pe = pe->parent; in eeh_dev_check_failure()
545 /* Frozen parent PE ? */ in eeh_dev_check_failure()
548 pe = parent_pe; in eeh_dev_check_failure()
549 pr_err("EEH: Failure of PHB#%x-PE#%x will be handled at parent PHB#%x-PE#%x.\n", in eeh_dev_check_failure()
550 pe->phb->global_number, pe->addr, in eeh_dev_check_failure()
551 pe->phb->global_number, parent_pe->addr); in eeh_dev_check_failure()
564 eeh_pe_mark_isolated(pe); in eeh_dev_check_failure()
571 pr_debug("EEH: %s: Frozen PHB#%x-PE#%x detected\n", in eeh_dev_check_failure()
572 __func__, pe->phb->global_number, pe->addr); in eeh_dev_check_failure()
573 eeh_send_failure_event(pe); in eeh_dev_check_failure()
615 * @pe: EEH PE
621 int eeh_pci_enable(struct eeh_pe *pe, int function) in eeh_pci_enable() argument
626 * pHyp doesn't allow to enable IO or DMA on unfrozen PE. in eeh_pci_enable()
627 * Also, it's pointless to enable them on unfrozen PE. So in eeh_pci_enable()
653 rc = eeh_ops->get_state(pe, NULL); in eeh_pci_enable()
668 rc = eeh_ops->set_option(pe, function); in eeh_pci_enable()
671 "PHB#%x-PE#%x, err=%d\n", in eeh_pci_enable()
672 __func__, function, pe->phb->global_number, in eeh_pci_enable()
673 pe->addr, rc); in eeh_pci_enable()
677 rc = eeh_wait_state(pe, PCI_BUS_RESET_WAIT_MSEC); in eeh_pci_enable()
744 struct eeh_pe *pe = eeh_dev_to_pe(edev); in pcibios_set_pcie_reset_state() local
746 if (!pe) { in pcibios_set_pcie_reset_state()
747 pr_err("%s: No PE found on PCI device %s\n", in pcibios_set_pcie_reset_state()
754 eeh_ops->reset(pe, EEH_RESET_DEACTIVATE); in pcibios_set_pcie_reset_state()
755 eeh_unfreeze_pe(pe); in pcibios_set_pcie_reset_state()
756 if (!(pe->type & EEH_PE_VF)) in pcibios_set_pcie_reset_state()
757 eeh_pe_state_clear(pe, EEH_PE_CFG_BLOCKED, true); in pcibios_set_pcie_reset_state()
758 eeh_pe_dev_traverse(pe, eeh_restore_dev_state, dev); in pcibios_set_pcie_reset_state()
759 eeh_pe_state_clear(pe, EEH_PE_ISOLATED, true); in pcibios_set_pcie_reset_state()
762 eeh_pe_mark_isolated(pe); in pcibios_set_pcie_reset_state()
763 eeh_pe_state_clear(pe, EEH_PE_CFG_BLOCKED, true); in pcibios_set_pcie_reset_state()
764 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE); in pcibios_set_pcie_reset_state()
765 eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev); in pcibios_set_pcie_reset_state()
766 if (!(pe->type & EEH_PE_VF)) in pcibios_set_pcie_reset_state()
767 eeh_pe_state_mark(pe, EEH_PE_CFG_BLOCKED); in pcibios_set_pcie_reset_state()
768 eeh_ops->reset(pe, EEH_RESET_HOT); in pcibios_set_pcie_reset_state()
771 eeh_pe_mark_isolated(pe); in pcibios_set_pcie_reset_state()
772 eeh_pe_state_clear(pe, EEH_PE_CFG_BLOCKED, true); in pcibios_set_pcie_reset_state()
773 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE); in pcibios_set_pcie_reset_state()
774 eeh_pe_dev_traverse(pe, eeh_disable_and_save_dev_state, dev); in pcibios_set_pcie_reset_state()
775 if (!(pe->type & EEH_PE_VF)) in pcibios_set_pcie_reset_state()
776 eeh_pe_state_mark(pe, EEH_PE_CFG_BLOCKED); in pcibios_set_pcie_reset_state()
777 eeh_ops->reset(pe, EEH_RESET_FUNDAMENTAL); in pcibios_set_pcie_reset_state()
780 eeh_pe_state_clear(pe, EEH_PE_ISOLATED | EEH_PE_CFG_BLOCKED, true); in pcibios_set_pcie_reset_state()
809 struct eeh_pe *pe; in eeh_pe_refreeze_passed() local
812 eeh_for_each_pe(root, pe) { in eeh_pe_refreeze_passed()
813 if (eeh_pe_passed(pe)) { in eeh_pe_refreeze_passed()
814 state = eeh_ops->get_state(pe, NULL); in eeh_pe_refreeze_passed()
817 pr_info("EEH: Passed-through PE PHB#%x-PE#%x was thawed by reset, re-freezing for safety.\n", in eeh_pe_refreeze_passed()
818 pe->phb->global_number, pe->addr); in eeh_pe_refreeze_passed()
819 eeh_pe_set_option(pe, EEH_OPT_FREEZE_PE); in eeh_pe_refreeze_passed()
826 * eeh_pe_reset_full - Complete a full reset process on the indicated PE
827 * @pe: EEH PE
829 * This function executes a full reset procedure on a PE, including setting
835 * This function will attempt to reset a PE three times before failing.
837 int eeh_pe_reset_full(struct eeh_pe *pe, bool include_passed) in eeh_pe_reset_full() argument
847 * PE requires a fundamental reset. in eeh_pe_reset_full()
849 eeh_pe_dev_traverse(pe, eeh_set_dev_freset, &freset); in eeh_pe_reset_full()
854 /* Mark the PE as in reset state and block config space accesses */ in eeh_pe_reset_full()
855 eeh_pe_state_mark(pe, reset_state); in eeh_pe_reset_full()
859 ret = eeh_pe_reset(pe, type, include_passed); in eeh_pe_reset_full()
861 ret = eeh_pe_reset(pe, EEH_RESET_DEACTIVATE, in eeh_pe_reset_full()
865 pr_warn("EEH: Failure %d resetting PHB#%x-PE#%x (attempt %d)\n\n", in eeh_pe_reset_full()
866 state, pe->phb->global_number, pe->addr, i + 1); in eeh_pe_reset_full()
870 pr_warn("EEH: PHB#%x-PE#%x: Successful reset (attempt %d)\n", in eeh_pe_reset_full()
871 pe->phb->global_number, pe->addr, i + 1); in eeh_pe_reset_full()
873 /* Wait until the PE is in a functioning state */ in eeh_pe_reset_full()
874 state = eeh_wait_state(pe, PCI_BUS_RESET_WAIT_MSEC); in eeh_pe_reset_full()
876 pr_warn("EEH: Unrecoverable slot failure on PHB#%x-PE#%x", in eeh_pe_reset_full()
877 pe->phb->global_number, pe->addr); in eeh_pe_reset_full()
884 pr_warn("EEH: PHB#%x-PE#%x: Slot inactive after reset: 0x%x (attempt %d)\n", in eeh_pe_reset_full()
885 pe->phb->global_number, pe->addr, state, i + 1); in eeh_pe_reset_full()
888 /* Resetting the PE may have unfrozen child PEs. If those PEs have been in eeh_pe_reset_full()
892 eeh_pe_refreeze_passed(pe); in eeh_pe_reset_full()
894 eeh_pe_state_clear(pe, reset_state, true); in eeh_pe_reset_full()
921 * we can restore it after reset, either PHB range or PE range. in eeh_save_bars()
1082 if (!edev || !edev->pdev || !edev->pe) { in eeh_remove_device()
1089 * device attached to the parent PE in order for BAR restore in eeh_remove_device()
1091 * from the parent PE during the BAR resotre. in eeh_remove_device()
1120 if (!(edev->pe->state & EEH_PE_KEEP)) in eeh_remove_device()
1126 int eeh_unfreeze_pe(struct eeh_pe *pe) in eeh_unfreeze_pe() argument
1130 ret = eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); in eeh_unfreeze_pe()
1132 pr_warn("%s: Failure %d enabling IO on PHB#%x-PE#%x\n", in eeh_unfreeze_pe()
1133 __func__, ret, pe->phb->global_number, pe->addr); in eeh_unfreeze_pe()
1137 ret = eeh_pci_enable(pe, EEH_OPT_THAW_DMA); in eeh_unfreeze_pe()
1139 pr_warn("%s: Failure %d enabling DMA on PHB#%x-PE#%x\n", in eeh_unfreeze_pe()
1140 __func__, ret, pe->phb->global_number, pe->addr); in eeh_unfreeze_pe()
1155 static int eeh_pe_change_owner(struct eeh_pe *pe) in eeh_pe_change_owner() argument
1162 /* Check PE state */ in eeh_pe_change_owner()
1163 ret = eeh_ops->get_state(pe, NULL); in eeh_pe_change_owner()
1167 /* Unfrozen PE, nothing to do */ in eeh_pe_change_owner()
1171 /* Frozen PE, check if it needs PE level reset */ in eeh_pe_change_owner()
1172 eeh_pe_for_each_dev(pe, edev, tmp) { in eeh_pe_change_owner()
1191 return eeh_pe_reset_and_recover(pe); in eeh_pe_change_owner()
1195 ret = eeh_unfreeze_pe(pe); in eeh_pe_change_owner()
1197 eeh_pe_state_clear(pe, EEH_PE_ISOLATED, true); in eeh_pe_change_owner()
1202 * eeh_dev_open - Increase count of pass through devices for PE
1206 * PE. In the result, the EEH errors detected on the PE won't be
1207 * reported. The PE owner will be responsible for detection
1221 /* No EEH device or PE ? */ in eeh_dev_open()
1223 if (!edev || !edev->pe) in eeh_dev_open()
1227 * The PE might have been put into frozen state, but we in eeh_dev_open()
1229 * in frozen PE won't work properly. Clear the frozen state in eeh_dev_open()
1232 ret = eeh_pe_change_owner(edev->pe); in eeh_dev_open()
1236 /* Increase PE's pass through count */ in eeh_dev_open()
1237 atomic_inc(&edev->pe->pass_dev_cnt); in eeh_dev_open()
1248 * eeh_dev_release - Decrease count of pass through devices for PE
1251 * Decrease count of pass through devices for the indicated PE. If
1252 * there is no passed through device in PE, the EEH errors detected
1253 * on the PE will be reported and handled as usual.
1267 if (!edev || !edev->pe || !eeh_pe_passed(edev->pe)) in eeh_dev_release()
1270 /* Decrease PE's pass through count */ in eeh_dev_release()
1271 WARN_ON(atomic_dec_if_positive(&edev->pe->pass_dev_cnt) < 0); in eeh_dev_release()
1272 eeh_pe_change_owner(edev->pe); in eeh_dev_release()
1297 * eeh_iommu_group_to_pe - Convert IOMMU group to EEH PE
1300 * The routine is called to convert IOMMU group to EEH PE.
1316 /* No EEH device or PE ? */ in eeh_iommu_group_to_pe()
1318 if (!edev || !edev->pe) in eeh_iommu_group_to_pe()
1321 return edev->pe; in eeh_iommu_group_to_pe()
1328 * eeh_pe_set_option - Set options for the indicated PE
1329 * @pe: EEH PE
1333 * on the indicated PE, to enable IO or DMA for the frozen PE.
1335 int eeh_pe_set_option(struct eeh_pe *pe, int option) in eeh_pe_set_option() argument
1339 /* Invalid PE ? */ in eeh_pe_set_option()
1340 if (!pe) in eeh_pe_set_option()
1346 * isn't expected to be disabled on one specific PE. in eeh_pe_set_option()
1351 ret = eeh_pe_change_owner(pe); in eeh_pe_set_option()
1366 ret = eeh_pci_enable(pe, option); in eeh_pe_set_option()
1379 * eeh_pe_get_state - Retrieve PE's state
1380 * @pe: EEH PE
1382 * Retrieve the PE's state, which includes 3 aspects: enabled
1385 int eeh_pe_get_state(struct eeh_pe *pe) in eeh_pe_get_state() argument
1390 /* Existing PE ? */ in eeh_pe_get_state()
1391 if (!pe) in eeh_pe_get_state()
1398 * If the parent PE is owned by the host kernel and is undergoing in eeh_pe_get_state()
1399 * error recovery, we should return the PE state as temporarily in eeh_pe_get_state()
1403 if (pe->parent && in eeh_pe_get_state()
1404 !(pe->state & EEH_PE_REMOVED) && in eeh_pe_get_state()
1405 (pe->parent->state & (EEH_PE_ISOLATED | EEH_PE_RECOVERING))) in eeh_pe_get_state()
1408 result = eeh_ops->get_state(pe, NULL); in eeh_pe_get_state()
1428 static int eeh_pe_reenable_devices(struct eeh_pe *pe, bool include_passed) in eeh_pe_reenable_devices() argument
1434 eeh_pe_restore_bars(pe); in eeh_pe_reenable_devices()
1440 eeh_pe_for_each_dev(pe, edev, tmp) { in eeh_pe_reenable_devices()
1453 /* The PE is still in frozen state */ in eeh_pe_reenable_devices()
1454 if (include_passed || !eeh_pe_passed(pe)) { in eeh_pe_reenable_devices()
1455 ret = eeh_unfreeze_pe(pe); in eeh_pe_reenable_devices()
1457 pr_info("EEH: Note: Leaving passthrough PHB#%x-PE#%x frozen.\n", in eeh_pe_reenable_devices()
1458 pe->phb->global_number, pe->addr); in eeh_pe_reenable_devices()
1460 eeh_pe_state_clear(pe, EEH_PE_ISOLATED, include_passed); in eeh_pe_reenable_devices()
1466 * eeh_pe_reset - Issue PE reset according to specified type
1467 * @pe: EEH PE
1470 * The routine is called to reset the specified PE with the
1472 * PE reset is the most important part for error recovery.
1474 int eeh_pe_reset(struct eeh_pe *pe, int option, bool include_passed) in eeh_pe_reset() argument
1478 /* Invalid PE ? */ in eeh_pe_reset()
1479 if (!pe) in eeh_pe_reset()
1487 ret = eeh_ops->reset(pe, option); in eeh_pe_reset()
1488 eeh_pe_state_clear(pe, EEH_PE_CFG_BLOCKED, include_passed); in eeh_pe_reset()
1492 ret = eeh_pe_reenable_devices(pe, include_passed); in eeh_pe_reset()
1497 * Proactively freeze the PE to drop all MMIO access in eeh_pe_reset()
1501 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE); in eeh_pe_reset()
1503 eeh_pe_state_mark(pe, EEH_PE_CFG_BLOCKED); in eeh_pe_reset()
1504 ret = eeh_ops->reset(pe, option); in eeh_pe_reset()
1517 * eeh_pe_configure - Configure PCI bridges after PE reset
1518 * @pe: EEH PE
1521 * those PCI devices, especially PCI bridges affected by PE
1524 int eeh_pe_configure(struct eeh_pe *pe) in eeh_pe_configure() argument
1528 /* Invalid PE ? */ in eeh_pe_configure()
1529 if (!pe) in eeh_pe_configure()
1537 * eeh_pe_inject_err - Injecting the specified PCI error to the indicated PE
1538 * @pe: the indicated PE
1545 * is determined by @type and @function, to the indicated PE for
1548 int eeh_pe_inject_err(struct eeh_pe *pe, int type, int func, in eeh_pe_inject_err() argument
1551 /* Invalid PE ? */ in eeh_pe_inject_err()
1552 if (!pe) in eeh_pe_inject_err()
1567 return eeh_ops->err_inject(pe, type, func, addr, mask); in eeh_pe_inject_err()
1627 struct eeh_pe *pe; in eeh_force_recover_write() local
1636 * When PE is NULL the event is a "special" event. Rather than in eeh_force_recover_write()
1637 * recovering a specific PE it forces the EEH core to scan for failed in eeh_force_recover_write()
1654 /* Retrieve PE */ in eeh_force_recover_write()
1655 pe = eeh_pe_get(hose, pe_no); in eeh_force_recover_write()
1656 if (!pe) in eeh_force_recover_write()
1663 * from an odd state (e.g. PE removed, or recovery of a in eeh_force_recover_write()
1664 * non-isolated PE) in eeh_force_recover_write()
1666 __eeh_send_failure_event(pe); in eeh_force_recover_write()
1798 * PE freeze. Using the in_8() accessor skips the eeh detection hook in eeh_debugfs_break_device()
1801 * where the HW will asyncronously freeze a PE and it's up to in eeh_debugfs_break_device()