qib_pcie.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. /*
  2. * Copyright (c) 2010 - 2017 Intel Corporation. All rights reserved.
  3. * Copyright (c) 2008, 2009 QLogic Corporation. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the
  9. * OpenIB.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. */
  33. #include <linux/pci.h>
  34. #include <linux/io.h>
  35. #include <linux/delay.h>
  36. #include <linux/vmalloc.h>
  37. #include <linux/aer.h>
  38. #include <linux/module.h>
  39. #include "qib.h"
  40. /*
  41. * This file contains PCIe utility routines that are common to the
  42. * various QLogic InfiniPath adapters
  43. */
  44. /*
  45. * Code to adjust PCIe capabilities.
  46. * To minimize the change footprint, we call it
  47. * from qib_pcie_params, which every chip-specific
  48. * file calls, even though this violates some
  49. * expectations of harmlessness.
  50. */
  51. static void qib_tune_pcie_caps(struct qib_devdata *);
  52. static void qib_tune_pcie_coalesce(struct qib_devdata *);
  53. /*
  54. * Do all the common PCIe setup and initialization.
  55. * devdata is not yet allocated, and is not allocated until after this
  56. * routine returns success. Therefore qib_dev_err() can't be used for error
  57. * printing.
  58. */
  59. int qib_pcie_init(struct pci_dev *pdev, const struct pci_device_id *ent)
  60. {
  61. int ret;
  62. ret = pci_enable_device(pdev);
  63. if (ret) {
  64. /*
  65. * This can happen (in theory) iff:
  66. * We did a chip reset, and then failed to reprogram the
  67. * BAR, or the chip reset due to an internal error. We then
  68. * unloaded the driver and reloaded it.
  69. *
  70. * Both reset cases set the BAR back to initial state. For
  71. * the latter case, the AER sticky error bit at offset 0x718
  72. * should be set, but the Linux kernel doesn't yet know
  73. * about that, it appears. If the original BAR was retained
  74. * in the kernel data structures, this may be OK.
  75. */
  76. qib_early_err(&pdev->dev, "pci enable failed: error %d\n",
  77. -ret);
  78. goto done;
  79. }
  80. ret = pci_request_regions(pdev, QIB_DRV_NAME);
  81. if (ret) {
  82. qib_devinfo(pdev, "pci_request_regions fails: err %d\n", -ret);
  83. goto bail;
  84. }
  85. ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
  86. if (ret) {
  87. /*
  88. * If the 64 bit setup fails, try 32 bit. Some systems
  89. * do not setup 64 bit maps on systems with 2GB or less
  90. * memory installed.
  91. */
  92. ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
  93. if (ret) {
  94. qib_devinfo(pdev, "Unable to set DMA mask: %d\n", ret);
  95. goto bail;
  96. }
  97. }
  98. pci_set_master(pdev);
  99. ret = pci_enable_pcie_error_reporting(pdev);
  100. if (ret) {
  101. qib_early_err(&pdev->dev,
  102. "Unable to enable pcie error reporting: %d\n",
  103. ret);
  104. ret = 0;
  105. }
  106. goto done;
  107. bail:
  108. pci_disable_device(pdev);
  109. pci_release_regions(pdev);
  110. done:
  111. return ret;
  112. }
  113. /*
  114. * Do remaining PCIe setup, once dd is allocated, and save away
  115. * fields required to re-initialize after a chip reset, or for
  116. * various other purposes
  117. */
  118. int qib_pcie_ddinit(struct qib_devdata *dd, struct pci_dev *pdev,
  119. const struct pci_device_id *ent)
  120. {
  121. unsigned long len;
  122. resource_size_t addr;
  123. dd->pcidev = pdev;
  124. pci_set_drvdata(pdev, dd);
  125. addr = pci_resource_start(pdev, 0);
  126. len = pci_resource_len(pdev, 0);
  127. dd->kregbase = ioremap(addr, len);
  128. if (!dd->kregbase)
  129. return -ENOMEM;
  130. dd->kregend = (u64 __iomem *)((void __iomem *) dd->kregbase + len);
  131. dd->physaddr = addr; /* used for io_remap, etc. */
  132. /*
  133. * Save BARs to rewrite after device reset. Save all 64 bits of
  134. * BAR, just in case.
  135. */
  136. dd->pcibar0 = addr;
  137. dd->pcibar1 = addr >> 32;
  138. dd->deviceid = ent->device; /* save for later use */
  139. dd->vendorid = ent->vendor;
  140. return 0;
  141. }
  142. /*
  143. * Do PCIe cleanup, after chip-specific cleanup, etc. Just prior
  144. * to releasing the dd memory.
  145. * void because none of the core pcie cleanup returns are void
  146. */
  147. void qib_pcie_ddcleanup(struct qib_devdata *dd)
  148. {
  149. u64 __iomem *base = (void __iomem *) dd->kregbase;
  150. dd->kregbase = NULL;
  151. iounmap(base);
  152. if (dd->piobase)
  153. iounmap(dd->piobase);
  154. if (dd->userbase)
  155. iounmap(dd->userbase);
  156. if (dd->piovl15base)
  157. iounmap(dd->piovl15base);
  158. pci_disable_device(dd->pcidev);
  159. pci_release_regions(dd->pcidev);
  160. pci_set_drvdata(dd->pcidev, NULL);
  161. }
  162. /*
  163. * We save the msi lo and hi values, so we can restore them after
  164. * chip reset (the kernel PCI infrastructure doesn't yet handle that
  165. * correctly.
  166. */
  167. static void qib_cache_msi_info(struct qib_devdata *dd, int pos)
  168. {
  169. struct pci_dev *pdev = dd->pcidev;
  170. u16 control;
  171. pci_read_config_dword(pdev, pos + PCI_MSI_ADDRESS_LO, &dd->msi_lo);
  172. pci_read_config_dword(pdev, pos + PCI_MSI_ADDRESS_HI, &dd->msi_hi);
  173. pci_read_config_word(pdev, pos + PCI_MSI_FLAGS, &control);
  174. /* now save the data (vector) info */
  175. pci_read_config_word(pdev,
  176. pos + ((control & PCI_MSI_FLAGS_64BIT) ? 12 : 8),
  177. &dd->msi_data);
  178. }
  179. int qib_pcie_params(struct qib_devdata *dd, u32 minw, u32 *nent)
  180. {
  181. u16 linkstat, speed;
  182. int nvec;
  183. int maxvec;
  184. unsigned int flags = PCI_IRQ_MSIX | PCI_IRQ_MSI;
  185. if (!pci_is_pcie(dd->pcidev)) {
  186. qib_dev_err(dd, "Can't find PCI Express capability!\n");
  187. /* set up something... */
  188. dd->lbus_width = 1;
  189. dd->lbus_speed = 2500; /* Gen1, 2.5GHz */
  190. nvec = -1;
  191. goto bail;
  192. }
  193. if (dd->flags & QIB_HAS_INTX)
  194. flags |= PCI_IRQ_LEGACY;
  195. maxvec = (nent && *nent) ? *nent : 1;
  196. nvec = pci_alloc_irq_vectors(dd->pcidev, 1, maxvec, flags);
  197. if (nvec < 0)
  198. goto bail;
  199. /*
  200. * If nent exists, make sure to record how many vectors were allocated.
  201. * If msix_enabled is false, return 0 so the fallback code works
  202. * correctly.
  203. */
  204. if (nent)
  205. *nent = !dd->pcidev->msix_enabled ? 0 : nvec;
  206. if (dd->pcidev->msi_enabled)
  207. qib_cache_msi_info(dd, dd->pcidev->msi_cap);
  208. pcie_capability_read_word(dd->pcidev, PCI_EXP_LNKSTA, &linkstat);
  209. /*
  210. * speed is bits 0-3, linkwidth is bits 4-8
  211. * no defines for them in headers
  212. */
  213. speed = linkstat & 0xf;
  214. linkstat >>= 4;
  215. linkstat &= 0x1f;
  216. dd->lbus_width = linkstat;
  217. switch (speed) {
  218. case 1:
  219. dd->lbus_speed = 2500; /* Gen1, 2.5GHz */
  220. break;
  221. case 2:
  222. dd->lbus_speed = 5000; /* Gen1, 5GHz */
  223. break;
  224. default: /* not defined, assume gen1 */
  225. dd->lbus_speed = 2500;
  226. break;
  227. }
  228. /*
  229. * Check against expected pcie width and complain if "wrong"
  230. * on first initialization, not afterwards (i.e., reset).
  231. */
  232. if (minw && linkstat < minw)
  233. qib_dev_err(dd,
  234. "PCIe width %u (x%u HCA), performance reduced\n",
  235. linkstat, minw);
  236. qib_tune_pcie_caps(dd);
  237. qib_tune_pcie_coalesce(dd);
  238. bail:
  239. /* fill in string, even on errors */
  240. snprintf(dd->lbus_info, sizeof(dd->lbus_info),
  241. "PCIe,%uMHz,x%u\n", dd->lbus_speed, dd->lbus_width);
  242. return nvec < 0 ? nvec : 0;
  243. }
  244. /**
  245. * qib_free_irq - Cleanup INTx and MSI interrupts
  246. * @dd: valid pointer to qib dev data
  247. *
  248. * Since cleanup for INTx and MSI interrupts is trivial, have a common
  249. * routine.
  250. *
  251. */
  252. void qib_free_irq(struct qib_devdata *dd)
  253. {
  254. pci_free_irq(dd->pcidev, 0, dd);
  255. pci_free_irq_vectors(dd->pcidev);
  256. }
  257. /*
  258. * Setup pcie interrupt stuff again after a reset. I'd like to just call
  259. * pci_enable_msi() again for msi, but when I do that,
  260. * the MSI enable bit doesn't get set in the command word, and
  261. * we switch to a different interrupt vector, which is confusing,
  262. * so I instead just do it all inline. Perhaps somehow can tie this
  263. * into the PCIe hotplug support at some point
  264. */
  265. int qib_reinit_intr(struct qib_devdata *dd)
  266. {
  267. int pos;
  268. u16 control;
  269. int ret = 0;
  270. /* If we aren't using MSI, don't restore it */
  271. if (!dd->msi_lo)
  272. goto bail;
  273. pos = dd->pcidev->msi_cap;
  274. if (!pos) {
  275. qib_dev_err(dd,
  276. "Can't find MSI capability, can't restore MSI settings\n");
  277. ret = 0;
  278. /* nothing special for MSIx, just MSI */
  279. goto bail;
  280. }
  281. pci_write_config_dword(dd->pcidev, pos + PCI_MSI_ADDRESS_LO,
  282. dd->msi_lo);
  283. pci_write_config_dword(dd->pcidev, pos + PCI_MSI_ADDRESS_HI,
  284. dd->msi_hi);
  285. pci_read_config_word(dd->pcidev, pos + PCI_MSI_FLAGS, &control);
  286. if (!(control & PCI_MSI_FLAGS_ENABLE)) {
  287. control |= PCI_MSI_FLAGS_ENABLE;
  288. pci_write_config_word(dd->pcidev, pos + PCI_MSI_FLAGS,
  289. control);
  290. }
  291. /* now rewrite the data (vector) info */
  292. pci_write_config_word(dd->pcidev, pos +
  293. ((control & PCI_MSI_FLAGS_64BIT) ? 12 : 8),
  294. dd->msi_data);
  295. ret = 1;
  296. bail:
  297. qib_free_irq(dd);
  298. if (!ret && (dd->flags & QIB_HAS_INTX))
  299. ret = 1;
  300. /* and now set the pci master bit again */
  301. pci_set_master(dd->pcidev);
  302. return ret;
  303. }
  304. /*
  305. * These two routines are helper routines for the device reset code
  306. * to move all the pcie code out of the chip-specific driver code.
  307. */
  308. void qib_pcie_getcmd(struct qib_devdata *dd, u16 *cmd, u8 *iline, u8 *cline)
  309. {
  310. pci_read_config_word(dd->pcidev, PCI_COMMAND, cmd);
  311. pci_read_config_byte(dd->pcidev, PCI_INTERRUPT_LINE, iline);
  312. pci_read_config_byte(dd->pcidev, PCI_CACHE_LINE_SIZE, cline);
  313. }
  314. void qib_pcie_reenable(struct qib_devdata *dd, u16 cmd, u8 iline, u8 cline)
  315. {
  316. int r;
  317. r = pci_write_config_dword(dd->pcidev, PCI_BASE_ADDRESS_0,
  318. dd->pcibar0);
  319. if (r)
  320. qib_dev_err(dd, "rewrite of BAR0 failed: %d\n", r);
  321. r = pci_write_config_dword(dd->pcidev, PCI_BASE_ADDRESS_1,
  322. dd->pcibar1);
  323. if (r)
  324. qib_dev_err(dd, "rewrite of BAR1 failed: %d\n", r);
  325. /* now re-enable memory access, and restore cosmetic settings */
  326. pci_write_config_word(dd->pcidev, PCI_COMMAND, cmd);
  327. pci_write_config_byte(dd->pcidev, PCI_INTERRUPT_LINE, iline);
  328. pci_write_config_byte(dd->pcidev, PCI_CACHE_LINE_SIZE, cline);
  329. r = pci_enable_device(dd->pcidev);
  330. if (r)
  331. qib_dev_err(dd,
  332. "pci_enable_device failed after reset: %d\n", r);
  333. }
  334. static int qib_pcie_coalesce;
  335. module_param_named(pcie_coalesce, qib_pcie_coalesce, int, S_IRUGO);
  336. MODULE_PARM_DESC(pcie_coalesce, "tune PCIe coalescing on some Intel chipsets");
  337. /*
  338. * Enable PCIe completion and data coalescing, on Intel 5x00 and 7300
  339. * chipsets. This is known to be unsafe for some revisions of some
  340. * of these chipsets, with some BIOS settings, and enabling it on those
  341. * systems may result in the system crashing, and/or data corruption.
  342. */
  343. static void qib_tune_pcie_coalesce(struct qib_devdata *dd)
  344. {
  345. struct pci_dev *parent;
  346. u16 devid;
  347. u32 mask, bits, val;
  348. if (!qib_pcie_coalesce)
  349. return;
  350. /* Find out supported and configured values for parent (root) */
  351. parent = dd->pcidev->bus->self;
  352. if (parent->bus->parent) {
  353. qib_devinfo(dd->pcidev, "Parent not root\n");
  354. return;
  355. }
  356. if (!pci_is_pcie(parent))
  357. return;
  358. if (parent->vendor != 0x8086)
  359. return;
  360. /*
  361. * - bit 12: Max_rdcmp_Imt_EN: need to set to 1
  362. * - bit 11: COALESCE_FORCE: need to set to 0
  363. * - bit 10: COALESCE_EN: need to set to 1
  364. * (but limitations on some on some chipsets)
  365. *
  366. * On the Intel 5000, 5100, and 7300 chipsets, there is
  367. * also: - bit 25:24: COALESCE_MODE, need to set to 0
  368. */
  369. devid = parent->device;
  370. if (devid >= 0x25e2 && devid <= 0x25fa) {
  371. /* 5000 P/V/X/Z */
  372. if (parent->revision <= 0xb2)
  373. bits = 1U << 10;
  374. else
  375. bits = 7U << 10;
  376. mask = (3U << 24) | (7U << 10);
  377. } else if (devid >= 0x65e2 && devid <= 0x65fa) {
  378. /* 5100 */
  379. bits = 1U << 10;
  380. mask = (3U << 24) | (7U << 10);
  381. } else if (devid >= 0x4021 && devid <= 0x402e) {
  382. /* 5400 */
  383. bits = 7U << 10;
  384. mask = 7U << 10;
  385. } else if (devid >= 0x3604 && devid <= 0x360a) {
  386. /* 7300 */
  387. bits = 7U << 10;
  388. mask = (3U << 24) | (7U << 10);
  389. } else {
  390. /* not one of the chipsets that we know about */
  391. return;
  392. }
  393. pci_read_config_dword(parent, 0x48, &val);
  394. val &= ~mask;
  395. val |= bits;
  396. pci_write_config_dword(parent, 0x48, val);
  397. }
  398. /*
  399. * BIOS may not set PCIe bus-utilization parameters for best performance.
  400. * Check and optionally adjust them to maximize our throughput.
  401. */
  402. static int qib_pcie_caps;
  403. module_param_named(pcie_caps, qib_pcie_caps, int, S_IRUGO);
  404. MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (0..3), ReadReq (4..7)");
  405. static void qib_tune_pcie_caps(struct qib_devdata *dd)
  406. {
  407. struct pci_dev *parent;
  408. u16 rc_mpss, rc_mps, ep_mpss, ep_mps;
  409. u16 rc_mrrs, ep_mrrs, max_mrrs;
  410. /* Find out supported and configured values for parent (root) */
  411. parent = dd->pcidev->bus->self;
  412. if (!pci_is_root_bus(parent->bus)) {
  413. qib_devinfo(dd->pcidev, "Parent not root\n");
  414. return;
  415. }
  416. if (!pci_is_pcie(parent) || !pci_is_pcie(dd->pcidev))
  417. return;
  418. rc_mpss = parent->pcie_mpss;
  419. rc_mps = ffs(pcie_get_mps(parent)) - 8;
  420. /* Find out supported and configured values for endpoint (us) */
  421. ep_mpss = dd->pcidev->pcie_mpss;
  422. ep_mps = ffs(pcie_get_mps(dd->pcidev)) - 8;
  423. /* Find max payload supported by root, endpoint */
  424. if (rc_mpss > ep_mpss)
  425. rc_mpss = ep_mpss;
  426. /* If Supported greater than limit in module param, limit it */
  427. if (rc_mpss > (qib_pcie_caps & 7))
  428. rc_mpss = qib_pcie_caps & 7;
  429. /* If less than (allowed, supported), bump root payload */
  430. if (rc_mpss > rc_mps) {
  431. rc_mps = rc_mpss;
  432. pcie_set_mps(parent, 128 << rc_mps);
  433. }
  434. /* If less than (allowed, supported), bump endpoint payload */
  435. if (rc_mpss > ep_mps) {
  436. ep_mps = rc_mpss;
  437. pcie_set_mps(dd->pcidev, 128 << ep_mps);
  438. }
  439. /*
  440. * Now the Read Request size.
  441. * No field for max supported, but PCIe spec limits it to 4096,
  442. * which is code '5' (log2(4096) - 7)
  443. */
  444. max_mrrs = 5;
  445. if (max_mrrs > ((qib_pcie_caps >> 4) & 7))
  446. max_mrrs = (qib_pcie_caps >> 4) & 7;
  447. max_mrrs = 128 << max_mrrs;
  448. rc_mrrs = pcie_get_readrq(parent);
  449. ep_mrrs = pcie_get_readrq(dd->pcidev);
  450. if (max_mrrs > rc_mrrs) {
  451. rc_mrrs = max_mrrs;
  452. pcie_set_readrq(parent, rc_mrrs);
  453. }
  454. if (max_mrrs > ep_mrrs) {
  455. ep_mrrs = max_mrrs;
  456. pcie_set_readrq(dd->pcidev, ep_mrrs);
  457. }
  458. }
  459. /* End of PCIe capability tuning */
  460. /*
  461. * From here through qib_pci_err_handler definition is invoked via
  462. * PCI error infrastructure, registered via pci
  463. */
  464. static pci_ers_result_t
  465. qib_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
  466. {
  467. struct qib_devdata *dd = pci_get_drvdata(pdev);
  468. pci_ers_result_t ret = PCI_ERS_RESULT_RECOVERED;
  469. switch (state) {
  470. case pci_channel_io_normal:
  471. qib_devinfo(pdev, "State Normal, ignoring\n");
  472. break;
  473. case pci_channel_io_frozen:
  474. qib_devinfo(pdev, "State Frozen, requesting reset\n");
  475. pci_disable_device(pdev);
  476. ret = PCI_ERS_RESULT_NEED_RESET;
  477. break;
  478. case pci_channel_io_perm_failure:
  479. qib_devinfo(pdev, "State Permanent Failure, disabling\n");
  480. if (dd) {
  481. /* no more register accesses! */
  482. dd->flags &= ~QIB_PRESENT;
  483. qib_disable_after_error(dd);
  484. }
  485. /* else early, or other problem */
  486. ret = PCI_ERS_RESULT_DISCONNECT;
  487. break;
  488. default: /* shouldn't happen */
  489. qib_devinfo(pdev, "QIB PCI errors detected (state %d)\n",
  490. state);
  491. break;
  492. }
  493. return ret;
  494. }
  495. static pci_ers_result_t
  496. qib_pci_mmio_enabled(struct pci_dev *pdev)
  497. {
  498. u64 words = 0U;
  499. struct qib_devdata *dd = pci_get_drvdata(pdev);
  500. pci_ers_result_t ret = PCI_ERS_RESULT_RECOVERED;
  501. if (dd && dd->pport) {
  502. words = dd->f_portcntr(dd->pport, QIBPORTCNTR_WORDRCV);
  503. if (words == ~0ULL)
  504. ret = PCI_ERS_RESULT_NEED_RESET;
  505. }
  506. qib_devinfo(pdev,
  507. "QIB mmio_enabled function called, read wordscntr %Lx, returning %d\n",
  508. words, ret);
  509. return ret;
  510. }
  511. static pci_ers_result_t
  512. qib_pci_slot_reset(struct pci_dev *pdev)
  513. {
  514. qib_devinfo(pdev, "QIB slot_reset function called, ignored\n");
  515. return PCI_ERS_RESULT_CAN_RECOVER;
  516. }
  517. static void
  518. qib_pci_resume(struct pci_dev *pdev)
  519. {
  520. struct qib_devdata *dd = pci_get_drvdata(pdev);
  521. qib_devinfo(pdev, "QIB resume function called\n");
  522. /*
  523. * Running jobs will fail, since it's asynchronous
  524. * unlike sysfs-requested reset. Better than
  525. * doing nothing.
  526. */
  527. qib_init(dd, 1); /* same as re-init after reset */
  528. }
  529. const struct pci_error_handlers qib_pci_err_handler = {
  530. .error_detected = qib_pci_error_detected,
  531. .mmio_enabled = qib_pci_mmio_enabled,
  532. .slot_reset = qib_pci_slot_reset,
  533. .resume = qib_pci_resume,
  534. };