Path: blob/master/drivers/infiniband/hw/qib/qib_pcie.c
15112 views
/*1* Copyright (c) 2008, 2009 QLogic Corporation. All rights reserved.2*3* This software is available to you under a choice of one of two4* licenses. You may choose to be licensed under the terms of the GNU5* General Public License (GPL) Version 2, available from the file6* COPYING in the main directory of this source tree, or the7* OpenIB.org BSD license below:8*9* Redistribution and use in source and binary forms, with or10* without modification, are permitted provided that the following11* conditions are met:12*13* - Redistributions of source code must retain the above14* copyright notice, this list of conditions and the following15* disclaimer.16*17* - Redistributions in binary form must reproduce the above18* copyright notice, this list of conditions and the following19* disclaimer in the documentation and/or other materials20* provided with the distribution.21*22* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,23* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF24* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND25* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS26* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN27* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN28* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE29* SOFTWARE.30*/3132#include <linux/pci.h>33#include <linux/io.h>34#include <linux/delay.h>35#include <linux/vmalloc.h>36#include <linux/aer.h>3738#include "qib.h"3940/*41* This file contains PCIe utility routines that are common to the42* various QLogic InfiniPath adapters43*/4445/*46* Code to adjust PCIe capabilities.47* To minimize the change footprint, we call it48* from qib_pcie_params, which every chip-specific49* file calls, even though this violates some50* expectations of harmlessness.51*/52static int qib_tune_pcie_caps(struct qib_devdata *);53static int qib_tune_pcie_coalesce(struct qib_devdata *);5455/*56* Do all the common PCIe setup and initialization.57* devdata is not yet allocated, and is not allocated until after this58* routine returns success. Therefore qib_dev_err() can't be used for error59* printing.60*/61int qib_pcie_init(struct pci_dev *pdev, const struct pci_device_id *ent)62{63int ret;6465ret = pci_enable_device(pdev);66if (ret) {67/*68* This can happen (in theory) iff:69* We did a chip reset, and then failed to reprogram the70* BAR, or the chip reset due to an internal error. We then71* unloaded the driver and reloaded it.72*73* Both reset cases set the BAR back to initial state. For74* the latter case, the AER sticky error bit at offset 0x71875* should be set, but the Linux kernel doesn't yet know76* about that, it appears. If the original BAR was retained77* in the kernel data structures, this may be OK.78*/79qib_early_err(&pdev->dev, "pci enable failed: error %d\n",80-ret);81goto done;82}8384ret = pci_request_regions(pdev, QIB_DRV_NAME);85if (ret) {86qib_devinfo(pdev, "pci_request_regions fails: err %d\n", -ret);87goto bail;88}8990ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(64));91if (ret) {92/*93* If the 64 bit setup fails, try 32 bit. Some systems94* do not setup 64 bit maps on systems with 2GB or less95* memory installed.96*/97ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));98if (ret) {99qib_devinfo(pdev, "Unable to set DMA mask: %d\n", ret);100goto bail;101}102ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));103} else104ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));105if (ret) {106qib_early_err(&pdev->dev,107"Unable to set DMA consistent mask: %d\n", ret);108goto bail;109}110111pci_set_master(pdev);112ret = pci_enable_pcie_error_reporting(pdev);113if (ret) {114qib_early_err(&pdev->dev,115"Unable to enable pcie error reporting: %d\n",116ret);117ret = 0;118}119goto done;120121bail:122pci_disable_device(pdev);123pci_release_regions(pdev);124done:125return ret;126}127128/*129* Do remaining PCIe setup, once dd is allocated, and save away130* fields required to re-initialize after a chip reset, or for131* various other purposes132*/133int qib_pcie_ddinit(struct qib_devdata *dd, struct pci_dev *pdev,134const struct pci_device_id *ent)135{136unsigned long len;137resource_size_t addr;138139dd->pcidev = pdev;140pci_set_drvdata(pdev, dd);141142addr = pci_resource_start(pdev, 0);143len = pci_resource_len(pdev, 0);144145#if defined(__powerpc__)146/* There isn't a generic way to specify writethrough mappings */147dd->kregbase = __ioremap(addr, len, _PAGE_NO_CACHE | _PAGE_WRITETHRU);148#else149dd->kregbase = ioremap_nocache(addr, len);150#endif151152if (!dd->kregbase)153return -ENOMEM;154155dd->kregend = (u64 __iomem *)((void __iomem *) dd->kregbase + len);156dd->physaddr = addr; /* used for io_remap, etc. */157158/*159* Save BARs to rewrite after device reset. Save all 64 bits of160* BAR, just in case.161*/162dd->pcibar0 = addr;163dd->pcibar1 = addr >> 32;164dd->deviceid = ent->device; /* save for later use */165dd->vendorid = ent->vendor;166167return 0;168}169170/*171* Do PCIe cleanup, after chip-specific cleanup, etc. Just prior172* to releasing the dd memory.173* void because none of the core pcie cleanup returns are void174*/175void qib_pcie_ddcleanup(struct qib_devdata *dd)176{177u64 __iomem *base = (void __iomem *) dd->kregbase;178179dd->kregbase = NULL;180iounmap(base);181if (dd->piobase)182iounmap(dd->piobase);183if (dd->userbase)184iounmap(dd->userbase);185if (dd->piovl15base)186iounmap(dd->piovl15base);187188pci_disable_device(dd->pcidev);189pci_release_regions(dd->pcidev);190191pci_set_drvdata(dd->pcidev, NULL);192}193194static void qib_msix_setup(struct qib_devdata *dd, int pos, u32 *msixcnt,195struct msix_entry *msix_entry)196{197int ret;198u32 tabsize = 0;199u16 msix_flags;200201pci_read_config_word(dd->pcidev, pos + PCI_MSIX_FLAGS, &msix_flags);202tabsize = 1 + (msix_flags & PCI_MSIX_FLAGS_QSIZE);203if (tabsize > *msixcnt)204tabsize = *msixcnt;205ret = pci_enable_msix(dd->pcidev, msix_entry, tabsize);206if (ret > 0) {207tabsize = ret;208ret = pci_enable_msix(dd->pcidev, msix_entry, tabsize);209}210if (ret) {211qib_dev_err(dd, "pci_enable_msix %d vectors failed: %d, "212"falling back to INTx\n", tabsize, ret);213tabsize = 0;214}215*msixcnt = tabsize;216217if (ret)218qib_enable_intx(dd->pcidev);219220}221222/**223* We save the msi lo and hi values, so we can restore them after224* chip reset (the kernel PCI infrastructure doesn't yet handle that225* correctly.226*/227static int qib_msi_setup(struct qib_devdata *dd, int pos)228{229struct pci_dev *pdev = dd->pcidev;230u16 control;231int ret;232233ret = pci_enable_msi(pdev);234if (ret)235qib_dev_err(dd, "pci_enable_msi failed: %d, "236"interrupts may not work\n", ret);237/* continue even if it fails, we may still be OK... */238239pci_read_config_dword(pdev, pos + PCI_MSI_ADDRESS_LO,240&dd->msi_lo);241pci_read_config_dword(pdev, pos + PCI_MSI_ADDRESS_HI,242&dd->msi_hi);243pci_read_config_word(pdev, pos + PCI_MSI_FLAGS, &control);244/* now save the data (vector) info */245pci_read_config_word(pdev, pos + ((control & PCI_MSI_FLAGS_64BIT)246? 12 : 8),247&dd->msi_data);248return ret;249}250251int qib_pcie_params(struct qib_devdata *dd, u32 minw, u32 *nent,252struct msix_entry *entry)253{254u16 linkstat, speed;255int pos = 0, pose, ret = 1;256257pose = pci_find_capability(dd->pcidev, PCI_CAP_ID_EXP);258if (!pose) {259qib_dev_err(dd, "Can't find PCI Express capability!\n");260/* set up something... */261dd->lbus_width = 1;262dd->lbus_speed = 2500; /* Gen1, 2.5GHz */263goto bail;264}265266pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSIX);267if (nent && *nent && pos) {268qib_msix_setup(dd, pos, nent, entry);269ret = 0; /* did it, either MSIx or INTx */270} else {271pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI);272if (pos)273ret = qib_msi_setup(dd, pos);274else275qib_dev_err(dd, "No PCI MSI or MSIx capability!\n");276}277if (!pos)278qib_enable_intx(dd->pcidev);279280pci_read_config_word(dd->pcidev, pose + PCI_EXP_LNKSTA, &linkstat);281/*282* speed is bits 0-3, linkwidth is bits 4-8283* no defines for them in headers284*/285speed = linkstat & 0xf;286linkstat >>= 4;287linkstat &= 0x1f;288dd->lbus_width = linkstat;289290switch (speed) {291case 1:292dd->lbus_speed = 2500; /* Gen1, 2.5GHz */293break;294case 2:295dd->lbus_speed = 5000; /* Gen1, 5GHz */296break;297default: /* not defined, assume gen1 */298dd->lbus_speed = 2500;299break;300}301302/*303* Check against expected pcie width and complain if "wrong"304* on first initialization, not afterwards (i.e., reset).305*/306if (minw && linkstat < minw)307qib_dev_err(dd,308"PCIe width %u (x%u HCA), performance reduced\n",309linkstat, minw);310311qib_tune_pcie_caps(dd);312313qib_tune_pcie_coalesce(dd);314315bail:316/* fill in string, even on errors */317snprintf(dd->lbus_info, sizeof(dd->lbus_info),318"PCIe,%uMHz,x%u\n", dd->lbus_speed, dd->lbus_width);319return ret;320}321322/*323* Setup pcie interrupt stuff again after a reset. I'd like to just call324* pci_enable_msi() again for msi, but when I do that,325* the MSI enable bit doesn't get set in the command word, and326* we switch to to a different interrupt vector, which is confusing,327* so I instead just do it all inline. Perhaps somehow can tie this328* into the PCIe hotplug support at some point329*/330int qib_reinit_intr(struct qib_devdata *dd)331{332int pos;333u16 control;334int ret = 0;335336/* If we aren't using MSI, don't restore it */337if (!dd->msi_lo)338goto bail;339340pos = pci_find_capability(dd->pcidev, PCI_CAP_ID_MSI);341if (!pos) {342qib_dev_err(dd, "Can't find MSI capability, "343"can't restore MSI settings\n");344ret = 0;345/* nothing special for MSIx, just MSI */346goto bail;347}348pci_write_config_dword(dd->pcidev, pos + PCI_MSI_ADDRESS_LO,349dd->msi_lo);350pci_write_config_dword(dd->pcidev, pos + PCI_MSI_ADDRESS_HI,351dd->msi_hi);352pci_read_config_word(dd->pcidev, pos + PCI_MSI_FLAGS, &control);353if (!(control & PCI_MSI_FLAGS_ENABLE)) {354control |= PCI_MSI_FLAGS_ENABLE;355pci_write_config_word(dd->pcidev, pos + PCI_MSI_FLAGS,356control);357}358/* now rewrite the data (vector) info */359pci_write_config_word(dd->pcidev, pos +360((control & PCI_MSI_FLAGS_64BIT) ? 12 : 8),361dd->msi_data);362ret = 1;363bail:364if (!ret && (dd->flags & QIB_HAS_INTX)) {365qib_enable_intx(dd->pcidev);366ret = 1;367}368369/* and now set the pci master bit again */370pci_set_master(dd->pcidev);371372return ret;373}374375/*376* Disable msi interrupt if enabled, and clear msi_lo.377* This is used primarily for the fallback to INTx, but378* is also used in reinit after reset, and during cleanup.379*/380void qib_nomsi(struct qib_devdata *dd)381{382dd->msi_lo = 0;383pci_disable_msi(dd->pcidev);384}385386/*387* Same as qib_nosmi, but for MSIx.388*/389void qib_nomsix(struct qib_devdata *dd)390{391pci_disable_msix(dd->pcidev);392}393394/*395* Similar to pci_intx(pdev, 1), except that we make sure396* msi(x) is off.397*/398void qib_enable_intx(struct pci_dev *pdev)399{400u16 cw, new;401int pos;402403/* first, turn on INTx */404pci_read_config_word(pdev, PCI_COMMAND, &cw);405new = cw & ~PCI_COMMAND_INTX_DISABLE;406if (new != cw)407pci_write_config_word(pdev, PCI_COMMAND, new);408409pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);410if (pos) {411/* then turn off MSI */412pci_read_config_word(pdev, pos + PCI_MSI_FLAGS, &cw);413new = cw & ~PCI_MSI_FLAGS_ENABLE;414if (new != cw)415pci_write_config_word(pdev, pos + PCI_MSI_FLAGS, new);416}417pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);418if (pos) {419/* then turn off MSIx */420pci_read_config_word(pdev, pos + PCI_MSIX_FLAGS, &cw);421new = cw & ~PCI_MSIX_FLAGS_ENABLE;422if (new != cw)423pci_write_config_word(pdev, pos + PCI_MSIX_FLAGS, new);424}425}426427/*428* These two routines are helper routines for the device reset code429* to move all the pcie code out of the chip-specific driver code.430*/431void qib_pcie_getcmd(struct qib_devdata *dd, u16 *cmd, u8 *iline, u8 *cline)432{433pci_read_config_word(dd->pcidev, PCI_COMMAND, cmd);434pci_read_config_byte(dd->pcidev, PCI_INTERRUPT_LINE, iline);435pci_read_config_byte(dd->pcidev, PCI_CACHE_LINE_SIZE, cline);436}437438void qib_pcie_reenable(struct qib_devdata *dd, u16 cmd, u8 iline, u8 cline)439{440int r;441r = pci_write_config_dword(dd->pcidev, PCI_BASE_ADDRESS_0,442dd->pcibar0);443if (r)444qib_dev_err(dd, "rewrite of BAR0 failed: %d\n", r);445r = pci_write_config_dword(dd->pcidev, PCI_BASE_ADDRESS_1,446dd->pcibar1);447if (r)448qib_dev_err(dd, "rewrite of BAR1 failed: %d\n", r);449/* now re-enable memory access, and restore cosmetic settings */450pci_write_config_word(dd->pcidev, PCI_COMMAND, cmd);451pci_write_config_byte(dd->pcidev, PCI_INTERRUPT_LINE, iline);452pci_write_config_byte(dd->pcidev, PCI_CACHE_LINE_SIZE, cline);453r = pci_enable_device(dd->pcidev);454if (r)455qib_dev_err(dd, "pci_enable_device failed after "456"reset: %d\n", r);457}458459/* code to adjust PCIe capabilities. */460461static int fld2val(int wd, int mask)462{463int lsbmask;464465if (!mask)466return 0;467wd &= mask;468lsbmask = mask ^ (mask & (mask - 1));469wd /= lsbmask;470return wd;471}472473static int val2fld(int wd, int mask)474{475int lsbmask;476477if (!mask)478return 0;479lsbmask = mask ^ (mask & (mask - 1));480wd *= lsbmask;481return wd;482}483484static int qib_pcie_coalesce;485module_param_named(pcie_coalesce, qib_pcie_coalesce, int, S_IRUGO);486MODULE_PARM_DESC(pcie_coalesce, "tune PCIe colescing on some Intel chipsets");487488/*489* Enable PCIe completion and data coalescing, on Intel 5x00 and 7300490* chipsets. This is known to be unsafe for some revisions of some491* of these chipsets, with some BIOS settings, and enabling it on those492* systems may result in the system crashing, and/or data corruption.493*/494static int qib_tune_pcie_coalesce(struct qib_devdata *dd)495{496int r;497struct pci_dev *parent;498int ppos;499u16 devid;500u32 mask, bits, val;501502if (!qib_pcie_coalesce)503return 0;504505/* Find out supported and configured values for parent (root) */506parent = dd->pcidev->bus->self;507if (parent->bus->parent) {508qib_devinfo(dd->pcidev, "Parent not root\n");509return 1;510}511ppos = pci_find_capability(parent, PCI_CAP_ID_EXP);512if (!ppos)513return 1;514if (parent->vendor != 0x8086)515return 1;516517/*518* - bit 12: Max_rdcmp_Imt_EN: need to set to 1519* - bit 11: COALESCE_FORCE: need to set to 0520* - bit 10: COALESCE_EN: need to set to 1521* (but limitations on some on some chipsets)522*523* On the Intel 5000, 5100, and 7300 chipsets, there is524* also: - bit 25:24: COALESCE_MODE, need to set to 0525*/526devid = parent->device;527if (devid >= 0x25e2 && devid <= 0x25fa) {528/* 5000 P/V/X/Z */529if (parent->revision <= 0xb2)530bits = 1U << 10;531else532bits = 7U << 10;533mask = (3U << 24) | (7U << 10);534} else if (devid >= 0x65e2 && devid <= 0x65fa) {535/* 5100 */536bits = 1U << 10;537mask = (3U << 24) | (7U << 10);538} else if (devid >= 0x4021 && devid <= 0x402e) {539/* 5400 */540bits = 7U << 10;541mask = 7U << 10;542} else if (devid >= 0x3604 && devid <= 0x360a) {543/* 7300 */544bits = 7U << 10;545mask = (3U << 24) | (7U << 10);546} else {547/* not one of the chipsets that we know about */548return 1;549}550pci_read_config_dword(parent, 0x48, &val);551val &= ~mask;552val |= bits;553r = pci_write_config_dword(parent, 0x48, val);554return 0;555}556557/*558* BIOS may not set PCIe bus-utilization parameters for best performance.559* Check and optionally adjust them to maximize our throughput.560*/561static int qib_pcie_caps;562module_param_named(pcie_caps, qib_pcie_caps, int, S_IRUGO);563MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (4lsb), ReadReq (D4..7)");564565static int qib_tune_pcie_caps(struct qib_devdata *dd)566{567int ret = 1; /* Assume the worst */568struct pci_dev *parent;569int ppos, epos;570u16 pcaps, pctl, ecaps, ectl;571int rc_sup, ep_sup;572int rc_cur, ep_cur;573574/* Find out supported and configured values for parent (root) */575parent = dd->pcidev->bus->self;576if (parent->bus->parent) {577qib_devinfo(dd->pcidev, "Parent not root\n");578goto bail;579}580ppos = pci_find_capability(parent, PCI_CAP_ID_EXP);581if (ppos) {582pci_read_config_word(parent, ppos + PCI_EXP_DEVCAP, &pcaps);583pci_read_config_word(parent, ppos + PCI_EXP_DEVCTL, &pctl);584} else585goto bail;586/* Find out supported and configured values for endpoint (us) */587epos = pci_find_capability(dd->pcidev, PCI_CAP_ID_EXP);588if (epos) {589pci_read_config_word(dd->pcidev, epos + PCI_EXP_DEVCAP, &ecaps);590pci_read_config_word(dd->pcidev, epos + PCI_EXP_DEVCTL, &ectl);591} else592goto bail;593ret = 0;594/* Find max payload supported by root, endpoint */595rc_sup = fld2val(pcaps, PCI_EXP_DEVCAP_PAYLOAD);596ep_sup = fld2val(ecaps, PCI_EXP_DEVCAP_PAYLOAD);597if (rc_sup > ep_sup)598rc_sup = ep_sup;599600rc_cur = fld2val(pctl, PCI_EXP_DEVCTL_PAYLOAD);601ep_cur = fld2val(ectl, PCI_EXP_DEVCTL_PAYLOAD);602603/* If Supported greater than limit in module param, limit it */604if (rc_sup > (qib_pcie_caps & 7))605rc_sup = qib_pcie_caps & 7;606/* If less than (allowed, supported), bump root payload */607if (rc_sup > rc_cur) {608rc_cur = rc_sup;609pctl = (pctl & ~PCI_EXP_DEVCTL_PAYLOAD) |610val2fld(rc_cur, PCI_EXP_DEVCTL_PAYLOAD);611pci_write_config_word(parent, ppos + PCI_EXP_DEVCTL, pctl);612}613/* If less than (allowed, supported), bump endpoint payload */614if (rc_sup > ep_cur) {615ep_cur = rc_sup;616ectl = (ectl & ~PCI_EXP_DEVCTL_PAYLOAD) |617val2fld(ep_cur, PCI_EXP_DEVCTL_PAYLOAD);618pci_write_config_word(dd->pcidev, epos + PCI_EXP_DEVCTL, ectl);619}620621/*622* Now the Read Request size.623* No field for max supported, but PCIe spec limits it to 4096,624* which is code '5' (log2(4096) - 7)625*/626rc_sup = 5;627if (rc_sup > ((qib_pcie_caps >> 4) & 7))628rc_sup = (qib_pcie_caps >> 4) & 7;629rc_cur = fld2val(pctl, PCI_EXP_DEVCTL_READRQ);630ep_cur = fld2val(ectl, PCI_EXP_DEVCTL_READRQ);631632if (rc_sup > rc_cur) {633rc_cur = rc_sup;634pctl = (pctl & ~PCI_EXP_DEVCTL_READRQ) |635val2fld(rc_cur, PCI_EXP_DEVCTL_READRQ);636pci_write_config_word(parent, ppos + PCI_EXP_DEVCTL, pctl);637}638if (rc_sup > ep_cur) {639ep_cur = rc_sup;640ectl = (ectl & ~PCI_EXP_DEVCTL_READRQ) |641val2fld(ep_cur, PCI_EXP_DEVCTL_READRQ);642pci_write_config_word(dd->pcidev, epos + PCI_EXP_DEVCTL, ectl);643}644bail:645return ret;646}647/* End of PCIe capability tuning */648649/*650* From here through qib_pci_err_handler definition is invoked via651* PCI error infrastructure, registered via pci652*/653static pci_ers_result_t654qib_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)655{656struct qib_devdata *dd = pci_get_drvdata(pdev);657pci_ers_result_t ret = PCI_ERS_RESULT_RECOVERED;658659switch (state) {660case pci_channel_io_normal:661qib_devinfo(pdev, "State Normal, ignoring\n");662break;663664case pci_channel_io_frozen:665qib_devinfo(pdev, "State Frozen, requesting reset\n");666pci_disable_device(pdev);667ret = PCI_ERS_RESULT_NEED_RESET;668break;669670case pci_channel_io_perm_failure:671qib_devinfo(pdev, "State Permanent Failure, disabling\n");672if (dd) {673/* no more register accesses! */674dd->flags &= ~QIB_PRESENT;675qib_disable_after_error(dd);676}677/* else early, or other problem */678ret = PCI_ERS_RESULT_DISCONNECT;679break;680681default: /* shouldn't happen */682qib_devinfo(pdev, "QIB PCI errors detected (state %d)\n",683state);684break;685}686return ret;687}688689static pci_ers_result_t690qib_pci_mmio_enabled(struct pci_dev *pdev)691{692u64 words = 0U;693struct qib_devdata *dd = pci_get_drvdata(pdev);694pci_ers_result_t ret = PCI_ERS_RESULT_RECOVERED;695696if (dd && dd->pport) {697words = dd->f_portcntr(dd->pport, QIBPORTCNTR_WORDRCV);698if (words == ~0ULL)699ret = PCI_ERS_RESULT_NEED_RESET;700}701qib_devinfo(pdev, "QIB mmio_enabled function called, "702"read wordscntr %Lx, returning %d\n", words, ret);703return ret;704}705706static pci_ers_result_t707qib_pci_slot_reset(struct pci_dev *pdev)708{709qib_devinfo(pdev, "QIB link_reset function called, ignored\n");710return PCI_ERS_RESULT_CAN_RECOVER;711}712713static pci_ers_result_t714qib_pci_link_reset(struct pci_dev *pdev)715{716qib_devinfo(pdev, "QIB link_reset function called, ignored\n");717return PCI_ERS_RESULT_CAN_RECOVER;718}719720static void721qib_pci_resume(struct pci_dev *pdev)722{723struct qib_devdata *dd = pci_get_drvdata(pdev);724qib_devinfo(pdev, "QIB resume function called\n");725pci_cleanup_aer_uncorrect_error_status(pdev);726/*727* Running jobs will fail, since it's asynchronous728* unlike sysfs-requested reset. Better than729* doing nothing.730*/731qib_init(dd, 1); /* same as re-init after reset */732}733734struct pci_error_handlers qib_pci_err_handler = {735.error_detected = qib_pci_error_detected,736.mmio_enabled = qib_pci_mmio_enabled,737.link_reset = qib_pci_link_reset,738.slot_reset = qib_pci_slot_reset,739.resume = qib_pci_resume,740};741742743