diff options
| author | Heiner Kallweit <hkallweit1@gmail.com> | 2019-06-18 17:14:50 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2019-06-21 22:05:42 -0400 |
| commit | 62b1b3b3b6d3ef309b1024aea95265c01929933c (patch) | |
| tree | 5db41c7be5d6888479c5d853171951418c3e7e57 | |
| parent | 4cfd218855923a07dc02a5bec3d3bb37a118ebc2 (diff) | |
r8169: don't activate ASPM in chip if OS can't control ASPM
Certain chip version / board combinations have massive problems if
ASPM is active. If BIOS enables ASPM and doesn't let OS control it,
then we may have a problem with the current code. Therefore check the
return code of pci_disable_link_state() and don't enable ASPM in the
network chip if OS can't control ASPM.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/ethernet/realtek/r8169_main.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 2e2a74aa025c..48b8a90f7057 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c | |||
| @@ -652,6 +652,7 @@ struct rtl8169_private { | |||
| 652 | 652 | ||
| 653 | unsigned irq_enabled:1; | 653 | unsigned irq_enabled:1; |
| 654 | unsigned supports_gmii:1; | 654 | unsigned supports_gmii:1; |
| 655 | unsigned aspm_manageable:1; | ||
| 655 | dma_addr_t counters_phys_addr; | 656 | dma_addr_t counters_phys_addr; |
| 656 | struct rtl8169_counters *counters; | 657 | struct rtl8169_counters *counters; |
| 657 | struct rtl8169_tc_offsets tc_offset; | 658 | struct rtl8169_tc_offsets tc_offset; |
| @@ -4286,7 +4287,8 @@ static void rtl_pcie_state_l2l3_disable(struct rtl8169_private *tp) | |||
| 4286 | 4287 | ||
| 4287 | static void rtl_hw_aspm_clkreq_enable(struct rtl8169_private *tp, bool enable) | 4288 | static void rtl_hw_aspm_clkreq_enable(struct rtl8169_private *tp, bool enable) |
| 4288 | { | 4289 | { |
| 4289 | if (enable) { | 4290 | /* Don't enable ASPM in the chip if OS can't control ASPM */ |
| 4291 | if (enable && tp->aspm_manageable) { | ||
| 4290 | RTL_W8(tp, Config5, RTL_R8(tp, Config5) | ASPM_en); | 4292 | RTL_W8(tp, Config5, RTL_R8(tp, Config5) | ASPM_en); |
| 4291 | RTL_W8(tp, Config2, RTL_R8(tp, Config2) | ClkReqEn); | 4293 | RTL_W8(tp, Config2, RTL_R8(tp, Config2) | ClkReqEn); |
| 4292 | } else { | 4294 | } else { |
| @@ -6678,7 +6680,9 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 6678 | /* Disable ASPM completely as that cause random device stop working | 6680 | /* Disable ASPM completely as that cause random device stop working |
| 6679 | * problems as well as full system hangs for some PCIe devices users. | 6681 | * problems as well as full system hangs for some PCIe devices users. |
| 6680 | */ | 6682 | */ |
| 6681 | pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); | 6683 | rc = pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | |
| 6684 | PCIE_LINK_STATE_L1); | ||
| 6685 | tp->aspm_manageable = !rc; | ||
| 6682 | 6686 | ||
| 6683 | /* enable device (incl. PCI PM wakeup and hotplug setup) */ | 6687 | /* enable device (incl. PCI PM wakeup and hotplug setup) */ |
| 6684 | rc = pcim_enable_device(pdev); | 6688 | rc = pcim_enable_device(pdev); |
