Lines Matching +full:reset +full:- +full:n +full:- +full:io
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright 2001-2012 IBM Corporation.
29 #include <asm/io.h>
32 #include <asm/ppc-pci.h>
34 #include <asm/pte-walk.h>
40 * usual PCI framework, except by check-stopping the CPU. Systems
41 * that are designed for high-availability/reliability cannot afford
43 * An EEH-capable bridge operates by converting a detected error
44 * into a "slot freeze", taking the PCI adapter off-line, making
50 * vibration, humidity, radioactivity or plain-old failed hardware.
55 * device to bus-master data to a memory address that is not
57 * is to prevent devices-gone-wild from corrupting system memory).
58 * Buggy hardware/drivers will have a miserable time co-existing
64 * reset the PCI slot, the PCI device, and then resume operations.
137 u64 slot_resets; /* PE reset */
156 pr_info("EEH: Recovery disabled by kernel parameter.\n"); in eeh_show_enabled()
158 pr_info("EEH: Capable adapter found: recovery enabled.\n"); in eeh_show_enabled()
160 pr_info("EEH: No capable adapters found: recovery disabled.\n"); in eeh_show_enabled()
172 int n = 0, l = 0; in eeh_dump_dev_log() local
175 n += scnprintf(buf+n, len-n, "%04x:%02x:%02x.%01x\n", in eeh_dump_dev_log()
176 edev->pe->phb->global_number, edev->bdfn >> 8, in eeh_dump_dev_log()
177 PCI_SLOT(edev->bdfn), PCI_FUNC(edev->bdfn)); in eeh_dump_dev_log()
178 pr_warn("EEH: of node=%04x:%02x:%02x.%01x\n", in eeh_dump_dev_log()
179 edev->pe->phb->global_number, edev->bdfn >> 8, in eeh_dump_dev_log()
180 PCI_SLOT(edev->bdfn), PCI_FUNC(edev->bdfn)); in eeh_dump_dev_log()
182 eeh_ops->read_config(edev, PCI_VENDOR_ID, 4, &cfg); in eeh_dump_dev_log()
183 n += scnprintf(buf+n, len-n, "dev/vend:%08x\n", cfg); in eeh_dump_dev_log()
184 pr_warn("EEH: PCI device/vendor: %08x\n", cfg); in eeh_dump_dev_log()
186 eeh_ops->read_config(edev, PCI_COMMAND, 4, &cfg); in eeh_dump_dev_log()
187 n += scnprintf(buf+n, len-n, "cmd/stat:%x\n", cfg); in eeh_dump_dev_log()
188 pr_warn("EEH: PCI cmd/status register: %08x\n", cfg); in eeh_dump_dev_log()
190 /* Gather bridge-specific registers */ in eeh_dump_dev_log()
191 if (edev->mode & EEH_DEV_BRIDGE) { in eeh_dump_dev_log()
192 eeh_ops->read_config(edev, PCI_SEC_STATUS, 2, &cfg); in eeh_dump_dev_log()
193 n += scnprintf(buf+n, len-n, "sec stat:%x\n", cfg); in eeh_dump_dev_log()
194 pr_warn("EEH: Bridge secondary status: %04x\n", cfg); in eeh_dump_dev_log()
196 eeh_ops->read_config(edev, PCI_BRIDGE_CONTROL, 2, &cfg); in eeh_dump_dev_log()
197 n += scnprintf(buf+n, len-n, "brdg ctl:%x\n", cfg); in eeh_dump_dev_log()
198 pr_warn("EEH: Bridge control: %04x\n", cfg); in eeh_dump_dev_log()
201 /* Dump out the PCI-X command and status regs */ in eeh_dump_dev_log()
202 cap = edev->pcix_cap; in eeh_dump_dev_log()
204 eeh_ops->read_config(edev, cap, 4, &cfg); in eeh_dump_dev_log()
205 n += scnprintf(buf+n, len-n, "pcix-cmd:%x\n", cfg); in eeh_dump_dev_log()
206 pr_warn("EEH: PCI-X cmd: %08x\n", cfg); in eeh_dump_dev_log()
208 eeh_ops->read_config(edev, cap+4, 4, &cfg); in eeh_dump_dev_log()
209 n += scnprintf(buf+n, len-n, "pcix-stat:%x\n", cfg); in eeh_dump_dev_log()
210 pr_warn("EEH: PCI-X status: %08x\n", cfg); in eeh_dump_dev_log()
213 /* If PCI-E capable, dump PCI-E cap 10 */ in eeh_dump_dev_log()
214 cap = edev->pcie_cap; in eeh_dump_dev_log()
216 n += scnprintf(buf+n, len-n, "pci-e cap10:\n"); in eeh_dump_dev_log()
217 pr_warn("EEH: PCI-E capabilities and status follow:\n"); in eeh_dump_dev_log()
220 eeh_ops->read_config(edev, cap+4*i, 4, &cfg); in eeh_dump_dev_log()
221 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg); in eeh_dump_dev_log()
225 pr_warn("%s\n", buffer); in eeh_dump_dev_log()
228 "EEH: PCI-E %02x: %08x ", in eeh_dump_dev_log()
231 l += scnprintf(buffer+l, sizeof(buffer)-l, in eeh_dump_dev_log()
237 pr_warn("%s\n", buffer); in eeh_dump_dev_log()
241 cap = edev->aer_cap; in eeh_dump_dev_log()
243 n += scnprintf(buf+n, len-n, "pci-e AER:\n"); in eeh_dump_dev_log()
244 pr_warn("EEH: PCI-E AER capability register set follows:\n"); in eeh_dump_dev_log()
247 eeh_ops->read_config(edev, cap+4*i, 4, &cfg); in eeh_dump_dev_log()
248 n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg); in eeh_dump_dev_log()
252 pr_warn("%s\n", buffer); in eeh_dump_dev_log()
255 "EEH: PCI-E AER %02x: %08x ", in eeh_dump_dev_log()
258 l += scnprintf(buffer+l, sizeof(buffer)-l, in eeh_dump_dev_log()
263 pr_warn("%s\n", buffer); in eeh_dump_dev_log()
266 return n; in eeh_dump_dev_log()
276 EEH_PCI_REGS_LOG_LEN - *plen); in eeh_dump_pe_log()
282 * eeh_slot_error_detail - Generate combined log including driver log and error log
301 * For pHyp, we have to enable IO for log retrieval. Otherwise, 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()
328 eeh_ops->configure_bridge(pe); in eeh_slot_error_detail()
329 if (!(pe->state & EEH_PE_CFG_BLOCKED)) { in eeh_slot_error_detail()
337 eeh_ops->get_log(pe, severity, pci_regs_buf, loglen); in eeh_slot_error_detail()
341 * eeh_token_to_phys - Convert EEH address token to phys address
364 return -EPERM; in eeh_phb_check_failure()
367 phb_pe = eeh_phb_pe_get(pe->phb); in eeh_phb_check_failure()
369 pr_warn("%s Can't find PE for PHB#%x\n", in eeh_phb_check_failure()
370 __func__, pe->phb->global_number); in eeh_phb_check_failure()
371 return -EEXIST; in eeh_phb_check_failure()
376 if (phb_pe->state & EEH_PE_ISOLATED) { in eeh_phb_check_failure()
382 ret = eeh_ops->get_state(phb_pe, NULL); in eeh_phb_check_failure()
393 pr_debug("EEH: PHB#%x failure detected, location: %s\n", in eeh_phb_check_failure()
394 phb_pe->phb->global_number, eeh_pe_loc_get(phb_pe)); in eeh_phb_check_failure()
405 return dev_driver_string(&pdev->dev); in eeh_driver_name()
411 * eeh_dev_check_failure - Check if all 1's data is due to EEH slot freeze
420 * a non-zero value and queues up a slot isolation event notification.
446 /* Access to IO BARs might get this far and still not want checking. */ in eeh_dev_check_failure()
449 eeh_edev_dbg(edev, "Ignored check\n"); in eeh_dev_check_failure()
477 if (pe->state & EEH_PE_ISOLATED) { in eeh_dev_check_failure()
478 pe->check_count++; in eeh_dev_check_failure()
479 if (pe->check_count == EEH_MAX_FAILS) { in eeh_dev_check_failure()
482 location = of_get_property(dn, "ibm,loc-code", in eeh_dev_check_failure()
484 eeh_edev_err(edev, "%d reads ignored for recovering device at location=%s driver=%s\n", in eeh_dev_check_failure()
485 pe->check_count, in eeh_dev_check_failure()
488 eeh_edev_err(edev, "Might be infinite loop in %s driver\n", in eeh_dev_check_failure()
499 * function zero of a multi-function device. in eeh_dev_check_failure()
502 ret = eeh_ops->get_state(pe, NULL); in eeh_dev_check_failure()
504 /* Note that config-io to empty slots may fail; in eeh_dev_check_failure()
513 pe->false_positives++; in eeh_dev_check_failure()
523 parent_pe = pe->parent; in eeh_dev_check_failure()
526 if (parent_pe->type & EEH_PE_PHB) in eeh_dev_check_failure()
530 ret = eeh_ops->get_state(parent_pe, NULL); in eeh_dev_check_failure()
533 pr_err("EEH: Failure of PHB#%x-PE#%x will be handled at parent PHB#%x-PE#%x.\n", in eeh_dev_check_failure()
534 pe->phb->global_number, pe->addr, in eeh_dev_check_failure()
535 pe->phb->global_number, parent_pe->addr); in eeh_dev_check_failure()
539 parent_pe = parent_pe->parent; in eeh_dev_check_failure()
552 * a stack trace will help the device-driver authors figure in eeh_dev_check_failure()
555 pr_debug("EEH: %s: Frozen PHB#%x-PE#%x detected\n", in eeh_dev_check_failure()
556 __func__, pe->phb->global_number, pe->addr); in eeh_dev_check_failure()
569 * eeh_check_failure - Check if all 1's data is due to EEH slot freeze
598 * eeh_pci_enable - Enable MMIO or DMA transfers for this slot
611 * pHyp doesn't allow to enable IO or DMA on unfrozen PE. in eeh_pci_enable()
613 * we have to check before enabling IO or DMA. in eeh_pci_enable()
628 pr_warn("%s: Invalid function %d\n", in eeh_pci_enable()
630 return -EINVAL; in eeh_pci_enable()
634 * Check if IO or DMA has been enabled before in eeh_pci_enable()
638 rc = eeh_ops->get_state(pe, NULL); in eeh_pci_enable()
653 rc = eeh_ops->set_option(pe, function); in eeh_pci_enable()
656 "PHB#%x-PE#%x, err=%d\n", in eeh_pci_enable()
657 __func__, function, pe->phb->global_number, in eeh_pci_enable()
658 pe->addr, rc); in eeh_pci_enable()
669 return -EIO; in eeh_pci_enable()
710 if (eeh_ops->restore_config) in eeh_restore_dev_state()
711 eeh_ops->restore_config(edev); in eeh_restore_dev_state()
719 * pcibios_set_pcie_reset_state - Set PCI-E reset state
721 * @state: reset state to enter
732 pr_err("%s: No PE found on PCI device %s\n", in pcibios_set_pcie_reset_state()
734 return -EINVAL; in pcibios_set_pcie_reset_state()
739 eeh_ops->reset(pe, EEH_RESET_DEACTIVATE); in pcibios_set_pcie_reset_state()
741 if (!(pe->type & EEH_PE_VF)) in pcibios_set_pcie_reset_state()
749 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE); in pcibios_set_pcie_reset_state()
751 if (!(pe->type & EEH_PE_VF)) in pcibios_set_pcie_reset_state()
753 eeh_ops->reset(pe, EEH_RESET_HOT); in pcibios_set_pcie_reset_state()
758 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE); in pcibios_set_pcie_reset_state()
760 if (!(pe->type & EEH_PE_VF)) in pcibios_set_pcie_reset_state()
762 eeh_ops->reset(pe, EEH_RESET_FUNDAMENTAL); in pcibios_set_pcie_reset_state()
766 return -EINVAL; in pcibios_set_pcie_reset_state()
773 * eeh_set_dev_freset - Check the required reset for the indicated device
777 * Each device might have its preferred reset type: fundamental or
778 * hot reset. The routine is used to collected the information for
780 * devices could be reset properly.
789 *freset |= dev->needs_freset; in eeh_set_dev_freset()
799 state = eeh_ops->get_state(pe, NULL); in eeh_pe_refreeze_passed()
802 pr_info("EEH: Passed-through PE PHB#%x-PE#%x was thawed by reset, re-freezing for safety.\n", in eeh_pe_refreeze_passed()
803 pe->phb->global_number, pe->addr); in eeh_pe_refreeze_passed()
811 * eeh_pe_reset_full - Complete a full reset process on the indicated PE
813 * @include_passed: include passed-through devices?
815 * This function executes a full reset procedure on a PE, including setting
816 * the appropriate flags, performing a fundamental or hot reset, and then
817 * deactivating the reset status. It is designed to be used within the EEH
821 * This function will attempt to reset a PE three times before failing.
831 * Determine the type of reset to perform - hot or fundamental. in eeh_pe_reset_full()
832 * Hot reset is the default operation, unless any device under the in eeh_pe_reset_full()
833 * PE requires a fundamental reset. in eeh_pe_reset_full()
840 /* Mark the PE as in reset state and block config space accesses */ in eeh_pe_reset_full()
850 ret = -EIO; in eeh_pe_reset_full()
851 pr_warn("EEH: Failure %d resetting PHB#%x-PE#%x (attempt %d)\n\n", in eeh_pe_reset_full()
852 state, pe->phb->global_number, pe->addr, i + 1); in eeh_pe_reset_full()
856 pr_warn("EEH: PHB#%x-PE#%x: Successful reset (attempt %d)\n", in eeh_pe_reset_full()
857 pe->phb->global_number, pe->addr, i + 1); in eeh_pe_reset_full()
862 pr_warn("EEH: Unrecoverable slot failure on PHB#%x-PE#%x", in eeh_pe_reset_full()
863 pe->phb->global_number, pe->addr); in eeh_pe_reset_full()
864 ret = -ENOTRECOVERABLE; in eeh_pe_reset_full()
870 pr_warn("EEH: PHB#%x-PE#%x: Slot inactive after reset: 0x%x (attempt %d)\n", in eeh_pe_reset_full()
871 pe->phb->global_number, pe->addr, state, i + 1); in eeh_pe_reset_full()
875 * (potentially) passed through to a guest, re-freeze them: in eeh_pe_reset_full()
885 * eeh_save_bars - Save device bars
891 * an entire slot is reset at a time.
901 eeh_ops->read_config(edev, i * 4, 4, &edev->config_space[i]); in eeh_save_bars()
907 * we can restore it after reset, either PHB range or PE range. in eeh_save_bars()
909 if (edev->mode & EEH_DEV_BRIDGE) in eeh_save_bars()
910 edev->config_space[1] |= PCI_COMMAND_MASTER; in eeh_save_bars()
949 * eeh_init - System wide EEH initialization
961 return -EEXIST; in eeh_init()
963 return -ENOENT; in eeh_init()
969 pr_warn("%s: Failed to register reboot notifier (%d)\n", in eeh_init()
976 pr_warn("%s: Failed to register bus notifier (%d)\n", in eeh_init()
992 * eeh_probe_device() - Perform EEH initialization for the indicated pci device
1002 pr_debug("EEH: Adding device %s\n", pci_name(dev)); in eeh_probe_device()
1009 pci_dbg(dev, "Already bound to an eeh_dev!\n"); in eeh_probe_device()
1013 edev = eeh_ops->probe(dev); in eeh_probe_device()
1015 pr_debug("EEH: Adding device failed\n"); in eeh_probe_device()
1028 if (edev->pdev && edev->pdev != dev) { in eeh_probe_device()
1030 eeh_addr_cache_rmv_dev(edev->pdev); in eeh_probe_device()
1031 eeh_sysfs_remove_device(edev->pdev); in eeh_probe_device()
1038 edev->mode |= EEH_DEV_NO_HANDLER; in eeh_probe_device()
1042 edev->pdev = dev; in eeh_probe_device()
1043 dev->dev.archdata.edev = edev; in eeh_probe_device()
1049 * eeh_remove_device - Undo EEH setup for the indicated pci device
1067 dev_dbg(&dev->dev, "EEH: Removing device\n"); in eeh_remove_device()
1069 if (!edev || !edev->pdev || !edev->pe) { in eeh_remove_device()
1070 dev_dbg(&dev->dev, "EEH: Device not referenced!\n"); in eeh_remove_device()
1080 edev->pdev = NULL; in eeh_remove_device()
1086 if (edev->mode & EEH_DEV_SYSFS) in eeh_remove_device()
1095 edev->mode |= EEH_DEV_NO_HANDLER; in eeh_remove_device()
1102 * it's not set, eeh_report_{reset,resume}() won't be called in eeh_remove_device()
1105 edev->in_error = false; in eeh_remove_device()
1106 dev->dev.archdata.edev = NULL; in eeh_remove_device()
1107 if (!(edev->pe->state & EEH_PE_KEEP)) in eeh_remove_device()
1110 edev->mode |= EEH_DEV_DISCONNECTED; in eeh_remove_device()
1119 pr_warn("%s: Failure %d enabling IO on PHB#%x-PE#%x\n", in eeh_unfreeze_pe()
1120 __func__, ret, pe->phb->global_number, pe->addr); in eeh_unfreeze_pe()
1126 pr_warn("%s: Failure %d enabling DMA on PHB#%x-PE#%x\n", in eeh_unfreeze_pe()
1127 __func__, ret, pe->phb->global_number, pe->addr); in eeh_unfreeze_pe()
1150 ret = eeh_ops->get_state(pe, NULL); in eeh_pe_change_owner()
1158 /* Frozen PE, check if it needs PE level reset */ in eeh_pe_change_owner()
1164 for (id = &eeh_reset_ids[0]; id->vendor != 0; id++) { in eeh_pe_change_owner()
1165 if (id->vendor != PCI_ANY_ID && in eeh_pe_change_owner()
1166 id->vendor != pdev->vendor) in eeh_pe_change_owner()
1168 if (id->device != PCI_ANY_ID && in eeh_pe_change_owner()
1169 id->device != pdev->device) in eeh_pe_change_owner()
1171 if (id->subvendor != PCI_ANY_ID && in eeh_pe_change_owner()
1172 id->subvendor != pdev->subsystem_vendor) in eeh_pe_change_owner()
1174 if (id->subdevice != PCI_ANY_ID && in eeh_pe_change_owner()
1175 id->subdevice != pdev->subsystem_device) in eeh_pe_change_owner()
1189 * eeh_dev_open - Increase count of pass through devices for PE
1200 int ret = -ENODEV; in eeh_dev_open()
1210 if (!edev || !edev->pe) in eeh_dev_open()
1219 ret = eeh_pe_change_owner(edev->pe); in eeh_dev_open()
1224 atomic_inc(&edev->pe->pass_dev_cnt); in eeh_dev_open()
1235 * eeh_dev_release - Decrease count of pass through devices for PE
1254 if (!edev || !edev->pe || !eeh_pe_passed(edev->pe)) in eeh_dev_release()
1258 WARN_ON(atomic_dec_if_positive(&edev->pe->pass_dev_cnt) < 0); in eeh_dev_release()
1259 eeh_pe_change_owner(edev->pe); in eeh_dev_release()
1284 * eeh_iommu_group_to_pe - Convert IOMMU group to EEH PE
1305 if (!edev || !edev->pe) in eeh_iommu_group_to_pe()
1308 return edev->pe; in eeh_iommu_group_to_pe()
1315 * eeh_pe_set_option - Set options for the indicated PE
1320 * on the indicated PE, to enable IO or DMA for the frozen PE.
1328 return -ENODEV; in eeh_pe_set_option()
1341 ret = -EIO; in eeh_pe_set_option()
1348 if (!eeh_ops || !eeh_ops->set_option) { in eeh_pe_set_option()
1349 ret = -ENOENT; in eeh_pe_set_option()
1356 pr_debug("%s: Option %d out of range (%d, %d)\n", in eeh_pe_set_option()
1358 ret = -EINVAL; in eeh_pe_set_option()
1366 * eeh_pe_get_state - Retrieve PE's state
1370 * DMA, enabled IO and asserted reset.
1379 return -ENODEV; in eeh_pe_get_state()
1381 if (!eeh_ops || !eeh_ops->get_state) in eeh_pe_get_state()
1382 return -ENOENT; in eeh_pe_get_state()
1390 if (pe->parent && in eeh_pe_get_state()
1391 !(pe->state & EEH_PE_REMOVED) && in eeh_pe_get_state()
1392 (pe->parent->state & (EEH_PE_ISOLATED | EEH_PE_RECOVERING))) in eeh_pe_get_state()
1395 result = eeh_ops->get_state(pe, NULL); in eeh_pe_get_state()
1425 * through are always enabled before the reset. in eeh_pe_reenable_devices()
1434 pr_warn("%s: Failure %d reenabling %s\n", in eeh_pe_reenable_devices()
1444 pr_info("EEH: Note: Leaving passthrough PHB#%x-PE#%x frozen.\n", in eeh_pe_reenable_devices()
1445 pe->phb->global_number, pe->addr); in eeh_pe_reenable_devices()
1453 * eeh_pe_reset - Issue PE reset according to specified type
1455 * @option: reset type
1456 * @include_passed: include passed-through devices?
1458 * The routine is called to reset the specified PE with the
1459 * indicated type, either fundamental reset or hot reset.
1460 * PE reset is the most important part for error recovery.
1468 return -ENODEV; in eeh_pe_reset()
1470 if (!eeh_ops || !eeh_ops->set_option || !eeh_ops->reset) in eeh_pe_reset()
1471 return -ENOENT; in eeh_pe_reset()
1475 ret = eeh_ops->reset(pe, option); in eeh_pe_reset()
1486 * during reset, which should be banned as it's always in eeh_pe_reset()
1489 eeh_ops->set_option(pe, EEH_OPT_FREEZE_PE); in eeh_pe_reset()
1492 ret = eeh_ops->reset(pe, option); in eeh_pe_reset()
1495 pr_debug("%s: Unsupported option %d\n", in eeh_pe_reset()
1497 ret = -EINVAL; in eeh_pe_reset()
1505 * eeh_pe_configure - Configure PCI bridges after PE reset
1510 * reset issued previously.
1518 return -ENODEV; in eeh_pe_configure()
1525 * eeh_pe_inject_err - Injecting the specified PCI error to the indicated PE
1541 return -ENODEV; in eeh_pe_inject_err()
1544 if (!eeh_ops || !eeh_ops->err_inject) in eeh_pe_inject_err()
1545 return -ENOENT; in eeh_pe_inject_err()
1549 return -EINVAL; in eeh_pe_inject_err()
1553 return -EINVAL; in eeh_pe_inject_err()
1555 return eeh_ops->err_inject(pe, type, func, addr, mask); in eeh_pe_inject_err()
1563 seq_printf(m, "EEH Subsystem is globally disabled\n"); in proc_eeh_show()
1564 seq_printf(m, "eeh_total_mmio_ffs=%llu\n", eeh_stats.total_mmio_ffs); in proc_eeh_show()
1566 seq_printf(m, "EEH Subsystem is enabled\n"); in proc_eeh_show()
1568 "no device=%llu\n" in proc_eeh_show()
1569 "no device node=%llu\n" in proc_eeh_show()
1570 "no config address=%llu\n" in proc_eeh_show()
1571 "check not wanted=%llu\n" in proc_eeh_show()
1572 "eeh_total_mmio_ffs=%llu\n" in proc_eeh_show()
1573 "eeh_false_positives=%llu\n" in proc_eeh_show()
1574 "eeh_slot_resets=%llu\n", in proc_eeh_show()
1601 ret = simple_write_to_buffer(buf, sizeof(buf)-1, ppos, user_buf, count); in eeh_debug_lookup_pdev()
1603 return ERR_PTR(-EFAULT); in eeh_debug_lookup_pdev()
1607 pr_err("%s: expected 4 args, got %d\n", __func__, ret); in eeh_debug_lookup_pdev()
1608 return ERR_PTR(-EINVAL); in eeh_debug_lookup_pdev()
1613 return ERR_PTR(-ENODEV); in eeh_debug_lookup_pdev()
1638 eeh_enable_dbgfs_set, "0x%llx\n");
1652 return -EFAULT; in eeh_force_recover_write()
1667 return -EINVAL; in eeh_force_recover_write()
1671 return -ENODEV; in eeh_force_recover_write()
1676 return -ENODEV; in eeh_force_recover_write()
1683 * non-isolated PE) in eeh_force_recover_write()
1700 static const char usage[] = "input format: <domain>:<bus>:<dev>.<fn>\n"; in eeh_debugfs_dev_usage()
1703 usage, sizeof(usage) - 1); in eeh_debugfs_dev_usage()
1720 pci_err(pdev, "No eeh_dev for this device!\n"); in eeh_dev_check_write()
1722 return -ENODEV; in eeh_dev_check_write()
1726 pci_info(pdev, "eeh_dev_check_failure(%s) = %d\n", in eeh_dev_check_write()
1750 struct resource *r = &pdev->resource[i]; in eeh_debugfs_break_device()
1752 if (!r->flags || !r->start) in eeh_debugfs_break_device()
1754 if (r->flags & IORESOURCE_IO) in eeh_debugfs_break_device()
1756 if (r->flags & IORESOURCE_UNSET) in eeh_debugfs_break_device()
1764 pci_err(pdev, "Unable to find Memory BAR to cause EEH with\n"); in eeh_debugfs_break_device()
1765 return -ENXIO; in eeh_debugfs_break_device()
1768 pci_err(pdev, "Going to break: %pR\n", bar); in eeh_debugfs_break_device()
1770 if (pdev->is_virtfn) { in eeh_debugfs_break_device()
1772 return -ENXIO; in eeh_debugfs_break_device()
1775 * VFs don't have a per-function COMMAND register, so the best in eeh_debugfs_break_device()
1780 * work for a passed-through VF) and it has the potential side in eeh_debugfs_break_device()
1784 pdev = pdev->physfn; in eeh_debugfs_break_device()
1786 return -ENXIO; /* passed through VFs have no PF */ in eeh_debugfs_break_device()
1812 * the COMMAND register is reset as a part of re-initialising in eeh_debugfs_break_device()
1819 mapped = ioremap(bar->start, PAGE_SIZE); in eeh_debugfs_break_device()
1821 pci_err(pdev, "Unable to map MMIO BAR %pR\n", bar); in eeh_debugfs_break_device()
1822 return -ENXIO; in eeh_debugfs_break_device()
1875 * .error_detected(), so it can quiesce IO to the device, and in eeh_dev_can_recover()
1876 * .slot_reset() so it can re-initialise the device after a reset. in eeh_dev_can_recover()
1882 * .mmio_enabled() is mostly there as a work-around for devices which in eeh_dev_can_recover()
1883 * take forever to re-init after a hot reset. Implementing that is in eeh_dev_can_recover()
1888 drv->err_handler && in eeh_dev_can_recover()
1889 drv->err_handler->error_detected && in eeh_dev_can_recover()
1890 drv->err_handler->slot_reset) { in eeh_dev_can_recover()
1893 ret = -EOPNOTSUPP; in eeh_dev_can_recover()