diff options
| -rw-r--r-- | drivers/infiniband/hw/qib/qib_pcie.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/infiniband/hw/qib/qib_pcie.c b/drivers/infiniband/hw/qib/qib_pcie.c index 24973c8b8443..c8d9c4ab142b 100644 --- a/drivers/infiniband/hw/qib/qib_pcie.c +++ b/drivers/infiniband/hw/qib/qib_pcie.c | |||
| @@ -51,8 +51,8 @@ | |||
| 51 | * file calls, even though this violates some | 51 | * file calls, even though this violates some |
| 52 | * expectations of harmlessness. | 52 | * expectations of harmlessness. |
| 53 | */ | 53 | */ |
| 54 | static int qib_tune_pcie_caps(struct qib_devdata *); | 54 | static void qib_tune_pcie_caps(struct qib_devdata *); |
| 55 | static int qib_tune_pcie_coalesce(struct qib_devdata *); | 55 | static void qib_tune_pcie_coalesce(struct qib_devdata *); |
| 56 | 56 | ||
| 57 | /* | 57 | /* |
| 58 | * Do all the common PCIe setup and initialization. | 58 | * Do all the common PCIe setup and initialization. |
| @@ -487,7 +487,7 @@ MODULE_PARM_DESC(pcie_coalesce, "tune PCIe colescing on some Intel chipsets"); | |||
| 487 | * of these chipsets, with some BIOS settings, and enabling it on those | 487 | * of these chipsets, with some BIOS settings, and enabling it on those |
| 488 | * systems may result in the system crashing, and/or data corruption. | 488 | * systems may result in the system crashing, and/or data corruption. |
| 489 | */ | 489 | */ |
| 490 | static int qib_tune_pcie_coalesce(struct qib_devdata *dd) | 490 | static void qib_tune_pcie_coalesce(struct qib_devdata *dd) |
| 491 | { | 491 | { |
| 492 | int r; | 492 | int r; |
| 493 | struct pci_dev *parent; | 493 | struct pci_dev *parent; |
| @@ -495,18 +495,18 @@ static int qib_tune_pcie_coalesce(struct qib_devdata *dd) | |||
| 495 | u32 mask, bits, val; | 495 | u32 mask, bits, val; |
| 496 | 496 | ||
| 497 | if (!qib_pcie_coalesce) | 497 | if (!qib_pcie_coalesce) |
| 498 | return 0; | 498 | return; |
| 499 | 499 | ||
| 500 | /* Find out supported and configured values for parent (root) */ | 500 | /* Find out supported and configured values for parent (root) */ |
| 501 | parent = dd->pcidev->bus->self; | 501 | parent = dd->pcidev->bus->self; |
| 502 | if (parent->bus->parent) { | 502 | if (parent->bus->parent) { |
| 503 | qib_devinfo(dd->pcidev, "Parent not root\n"); | 503 | qib_devinfo(dd->pcidev, "Parent not root\n"); |
| 504 | return 1; | 504 | return; |
| 505 | } | 505 | } |
| 506 | if (!pci_is_pcie(parent)) | 506 | if (!pci_is_pcie(parent)) |
| 507 | return 1; | 507 | return; |
| 508 | if (parent->vendor != 0x8086) | 508 | if (parent->vendor != 0x8086) |
| 509 | return 1; | 509 | return; |
| 510 | 510 | ||
| 511 | /* | 511 | /* |
| 512 | * - bit 12: Max_rdcmp_Imt_EN: need to set to 1 | 512 | * - bit 12: Max_rdcmp_Imt_EN: need to set to 1 |
| @@ -539,13 +539,12 @@ static int qib_tune_pcie_coalesce(struct qib_devdata *dd) | |||
| 539 | mask = (3U << 24) | (7U << 10); | 539 | mask = (3U << 24) | (7U << 10); |
| 540 | } else { | 540 | } else { |
| 541 | /* not one of the chipsets that we know about */ | 541 | /* not one of the chipsets that we know about */ |
| 542 | return 1; | 542 | return; |
| 543 | } | 543 | } |
| 544 | pci_read_config_dword(parent, 0x48, &val); | 544 | pci_read_config_dword(parent, 0x48, &val); |
| 545 | val &= ~mask; | 545 | val &= ~mask; |
| 546 | val |= bits; | 546 | val |= bits; |
| 547 | r = pci_write_config_dword(parent, 0x48, val); | 547 | r = pci_write_config_dword(parent, 0x48, val); |
| 548 | return 0; | ||
| 549 | } | 548 | } |
| 550 | 549 | ||
| 551 | /* | 550 | /* |
| @@ -556,9 +555,8 @@ static int qib_pcie_caps; | |||
| 556 | module_param_named(pcie_caps, qib_pcie_caps, int, S_IRUGO); | 555 | module_param_named(pcie_caps, qib_pcie_caps, int, S_IRUGO); |
| 557 | MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (0..3), ReadReq (4..7)"); | 556 | MODULE_PARM_DESC(pcie_caps, "Max PCIe tuning: Payload (0..3), ReadReq (4..7)"); |
| 558 | 557 | ||
| 559 | static int qib_tune_pcie_caps(struct qib_devdata *dd) | 558 | static void qib_tune_pcie_caps(struct qib_devdata *dd) |
| 560 | { | 559 | { |
| 561 | int ret = 1; /* Assume the worst */ | ||
| 562 | struct pci_dev *parent; | 560 | struct pci_dev *parent; |
| 563 | u16 rc_mpss, rc_mps, ep_mpss, ep_mps; | 561 | u16 rc_mpss, rc_mps, ep_mpss, ep_mps; |
| 564 | u16 rc_mrrs, ep_mrrs, max_mrrs; | 562 | u16 rc_mrrs, ep_mrrs, max_mrrs; |
| @@ -567,18 +565,18 @@ static int qib_tune_pcie_caps(struct qib_devdata *dd) | |||
| 567 | parent = dd->pcidev->bus->self; | 565 | parent = dd->pcidev->bus->self; |
| 568 | if (!pci_is_root_bus(parent->bus)) { | 566 | if (!pci_is_root_bus(parent->bus)) { |
| 569 | qib_devinfo(dd->pcidev, "Parent not root\n"); | 567 | qib_devinfo(dd->pcidev, "Parent not root\n"); |
| 570 | goto bail; | 568 | return; |
| 571 | } | 569 | } |
| 572 | 570 | ||
| 573 | if (!pci_is_pcie(parent) || !pci_is_pcie(dd->pcidev)) | 571 | if (!pci_is_pcie(parent) || !pci_is_pcie(dd->pcidev)) |
| 574 | goto bail; | 572 | return; |
| 573 | |||
| 575 | rc_mpss = parent->pcie_mpss; | 574 | rc_mpss = parent->pcie_mpss; |
| 576 | rc_mps = ffs(pcie_get_mps(parent)) - 8; | 575 | rc_mps = ffs(pcie_get_mps(parent)) - 8; |
| 577 | /* Find out supported and configured values for endpoint (us) */ | 576 | /* Find out supported and configured values for endpoint (us) */ |
| 578 | ep_mpss = dd->pcidev->pcie_mpss; | 577 | ep_mpss = dd->pcidev->pcie_mpss; |
| 579 | ep_mps = ffs(pcie_get_mps(dd->pcidev)) - 8; | 578 | ep_mps = ffs(pcie_get_mps(dd->pcidev)) - 8; |
| 580 | 579 | ||
| 581 | ret = 0; | ||
| 582 | /* Find max payload supported by root, endpoint */ | 580 | /* Find max payload supported by root, endpoint */ |
| 583 | if (rc_mpss > ep_mpss) | 581 | if (rc_mpss > ep_mpss) |
| 584 | rc_mpss = ep_mpss; | 582 | rc_mpss = ep_mpss; |
| @@ -618,8 +616,6 @@ static int qib_tune_pcie_caps(struct qib_devdata *dd) | |||
| 618 | ep_mrrs = max_mrrs; | 616 | ep_mrrs = max_mrrs; |
| 619 | pcie_set_readrq(dd->pcidev, ep_mrrs); | 617 | pcie_set_readrq(dd->pcidev, ep_mrrs); |
| 620 | } | 618 | } |
| 621 | bail: | ||
| 622 | return ret; | ||
| 623 | } | 619 | } |
| 624 | /* End of PCIe capability tuning */ | 620 | /* End of PCIe capability tuning */ |
| 625 | 621 | ||
