Skip to contentSkip to conversation

PCI: Disallow ASPM on ASMedia ASM1083/1085 PCIe-PCI bridge

PATCH In review Robert Hancock 2 participants 6 messages Jul 22, 2020 – Jul 29, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: Disallow ASPM on ASMedia ASM1083/1085 PCIe-PCI bridge

Recently ASPM handling was changed to no longer disable ASPM on all PCIe to PCI bridges. Unfortunately these ASMedia PCIe to PCI bridge devices don't seem to function properly with ASPM enabled, as they cause the parent PCIe root port to cause repeated AER timeout errors. In addition to flooding the kernel log, this also causes the machine to wake up immediately after suspend is initiated.

Fixes 66ff14e59e8a ("PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges")
---
 drivers/pci/quirks.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/pci/quirks.c +13 -0
index 812bfc32ecb8..e5713114f2ab 100644
@@ -2330,6 +2330,19 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
 
+static void quirk_disable_aspm_l0s_l1(struct pci_dev *dev)
+{
+	pci_info(dev, "Disabling ASPM L0s/L1\n");
+	pci_disable_link_state(dev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
+}
+
+/*
+ * ASM1083/1085 PCIe-PCI bridge devices cause AER timeout errors on the
+ * upstream PCIe root port when ASPM is enabled. At least L0s mode is affected,
+ * disable both L0s and L1 for now to be safe.
+ */
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x1080, quirk_disable_aspm_l0s_l1);
+
 /*
  * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain
  * Link bit cleared after starting the link retrain process to allow this
Signature · 1 line
2.26.2
#1 lore raw

[+cc Puranjay]

Quoted 6 lines · Robert Hancock

Recently ASPM handling was changed to no longer disable ASPM on all PCIe to PCI bridges. Unfortunately these ASMedia PCIe to PCI bridge devices don't seem to function properly with ASPM enabled, as they cause the parent PCIe root port to cause repeated AER timeout errors. In addition to flooding the kernel log, this also causes the machine to wake up immediately after suspend is initiated.

Hi Robert, thanks a lot for the report of this problem
(https://lore.kernel.org/r/CADLC3L1R2hssRjxHJv9yhdN_7-hGw58rXSfNp-FraZh0Tw+gRw@mail.gmail.com
and https://bugzilla.redhat.com/show_bug.cgi?id=1853960).

I'm pretty sure Linux ASPM support is missing some things. This problem might be a hardware problem where a quirk is the right solution, but it could also be that it's a result of a Linux defect that we should fix.

Could you collect the dmesg log and "sudo lspci -vvxxxx" output somewhere (maybe a bugzilla.kernel.org issue)? I want to figure out whether this L1 PM substates are enabled on this link, and whether that's configured correctly.

Quoted 34 lines
Fixes 66ff14e59e8a ("PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges")
---
 drivers/pci/quirks.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/pci/quirks.c +13 -0
index 812bfc32ecb8..e5713114f2ab 100644
@@ -2330,6 +2330,19 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
 
+static void quirk_disable_aspm_l0s_l1(struct pci_dev *dev)
+{
+	pci_info(dev, "Disabling ASPM L0s/L1\n");
+	pci_disable_link_state(dev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
+}
+
+/*
+ * ASM1083/1085 PCIe-PCI bridge devices cause AER timeout errors on the
+ * upstream PCIe root port when ASPM is enabled. At least L0s mode is affected,
+ * disable both L0s and L1 for now to be safe.
+ */
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x1080, quirk_disable_aspm_l0s_l1);
+
 /*
  * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain
  * Link bit cleared after starting the link retrain process to allow this
Signature · 1 line
2.26.2
#2 lore raw
Quoted 20 lines · Bjorn Helgaas

[+cc Puranjay]

Quoted 6 lines · Robert Hancock

Recently ASPM handling was changed to no longer disable ASPM on all PCIe to PCI bridges. Unfortunately these ASMedia PCIe to PCI bridge devices don't seem to function properly with ASPM enabled, as they cause the parent PCIe root port to cause repeated AER timeout errors. In addition to flooding the kernel log, this also causes the machine to wake up immediately after suspend is initiated.

Hi Robert, thanks a lot for the report of this problem
(https://lore.kernel.org/r/CADLC3L1R2hssRjxHJv9yhdN_7-hGw58rXSfNp-FraZh0Tw+gRw@mail.gmail.com
and https://bugzilla.redhat.com/show_bug.cgi?id=1853960).

I'm pretty sure Linux ASPM support is missing some things. This problem might be a hardware problem where a quirk is the right solution, but it could also be that it's a result of a Linux defect that we should fix.

Quoted 4 lines

Could you collect the dmesg log and "sudo lspci -vvxxxx" output somewhere (maybe a bugzilla.kernel.org issue)? I want to figure out whether this L1 PM substates are enabled on this link, and whether that's configured correctly.

Created a Bugzilla entry and added dmesg and lspci output:
https://bugzilla.kernel.org/show_bug.cgi?id=208667

As I noted in that report, I subsequently found this page on ASMedia's
site: https://www.asmedia.com.tw/eng/e_show_products.php?cate_index=169&item=114
which indicates this ASM1083 device has "No PCIe ASPM support". It's not clear why this problem isn't occurring on Windows however - either it is not enabling ASPM, somehow it doesn't cause issues with the PCIe link, or it is causing issues and just doesn't notify the user in any way. I can try and check if this bridge device is ending up with ASPM enabled under Windows 10 or not..

#3 lore raw
Quoted 23 lines · Robert Hancock
Quoted 17 lines · Bjorn Helgaas
Quoted 6 lines · Robert Hancock

Recently ASPM handling was changed to no longer disable ASPM on all PCIe to PCI bridges. Unfortunately these ASMedia PCIe to PCI bridge devices don't seem to function properly with ASPM enabled, as they cause the parent PCIe root port to cause repeated AER timeout errors. In addition to flooding the kernel log, this also causes the machine to wake up immediately after suspend is initiated.

Hi Robert, thanks a lot for the report of this problem
(https://lore.kernel.org/r/CADLC3L1R2hssRjxHJv9yhdN_7-hGw58rXSfNp-FraZh0Tw+gRw@mail.gmail.com
and https://bugzilla.redhat.com/show_bug.cgi?id=1853960).

I'm pretty sure Linux ASPM support is missing some things. This problem might be a hardware problem where a quirk is the right solution, but it could also be that it's a result of a Linux defect that we should fix.

Quoted 4 lines

Could you collect the dmesg log and "sudo lspci -vvxxxx" output somewhere (maybe a bugzilla.kernel.org issue)? I want to figure out whether this L1 PM substates are enabled on this link, and whether that's configured correctly.

Quoted 6 lines

Created a Bugzilla entry and added dmesg and lspci output:
https://bugzilla.kernel.org/show_bug.cgi?id=208667

As I noted in that report, I subsequently found this page on ASMedia's
site: https://www.asmedia.com.tw/eng/e_show_products.php?cate_index=169&item=114
which indicates this ASM1083 device has "No PCIe ASPM support".

How nice. According to your lspci, the device itself claims to support ASPM:

02:00.0 ... ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge

    LnkCap: ... ASPM L0s L1 ...

but the web page claims otherwise. That would mean the device is defective for claiming something that's not true. Or possibly those capability bits can be set by BIOS.

Quoted 5 lines

It's not clear why this problem isn't occurring on Windows however - either it is not enabling ASPM, somehow it doesn't cause issues with the PCIe link, or it is causing issues and just doesn't notify the user in any way. I can try and check if this bridge device is ending up with ASPM enabled under Windows 10 or not..

If Windows *does* manage to enable ASPM, that would be interesting. I don't know whether Windows has a similar quirk mechanism. I suppose they must have *some* way to work around defective devices.

Bjorn

#4 lore raw
Quoted 48 lines · Bjorn Helgaas
Quoted 23 lines · Robert Hancock
Quoted 17 lines · Bjorn Helgaas
Quoted 6 lines · Robert Hancock

Recently ASPM handling was changed to no longer disable ASPM on all PCIe to PCI bridges. Unfortunately these ASMedia PCIe to PCI bridge devices don't seem to function properly with ASPM enabled, as they cause the parent PCIe root port to cause repeated AER timeout errors. In addition to flooding the kernel log, this also causes the machine to wake up immediately after suspend is initiated.

Hi Robert, thanks a lot for the report of this problem
(https://lore.kernel.org/r/CADLC3L1R2hssRjxHJv9yhdN_7-hGw58rXSfNp-FraZh0Tw+gRw@mail.gmail.com
and https://bugzilla.redhat.com/show_bug.cgi?id=1853960).

I'm pretty sure Linux ASPM support is missing some things. This problem might be a hardware problem where a quirk is the right solution, but it could also be that it's a result of a Linux defect that we should fix.

Quoted 4 lines

Could you collect the dmesg log and "sudo lspci -vvxxxx" output somewhere (maybe a bugzilla.kernel.org issue)? I want to figure out whether this L1 PM substates are enabled on this link, and whether that's configured correctly.

Quoted 6 lines

Created a Bugzilla entry and added dmesg and lspci output:
https://bugzilla.kernel.org/show_bug.cgi?id=208667

As I noted in that report, I subsequently found this page on ASMedia's
site: https://www.asmedia.com.tw/eng/e_show_products.php?cate_index=169&item=114
which indicates this ASM1083 device has "No PCIe ASPM support".

How nice. According to your lspci, the device itself claims to support ASPM:

02:00.0 ... ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge

    LnkCap: ... ASPM L0s L1 ...

but the web page claims otherwise. That would mean the device is defective for claiming something that's not true. Or possibly those capability bits can be set by BIOS.

Quoted 5 lines

It's not clear why this problem isn't occurring on Windows however - either it is not enabling ASPM, somehow it doesn't cause issues with the PCIe link, or it is causing issues and just doesn't notify the user in any way. I can try and check if this bridge device is ending up with ASPM enabled under Windows 10 or not..

Quoted 3 lines

If Windows *does* manage to enable ASPM, that would be interesting. I don't know whether Windows has a similar quirk mechanism. I suppose they must have *some* way to work around defective devices.

As I posted on the Bugzilla report, based on lspci output it appears Windows does have ASPM L0s enabled for this bridge. However, it appears to have the exact same problem: there are correctable PCIe error entries showing up in the Windows system event log against the root port the bridge is connected to. So I am thinking this hardware is just broken with ASPM enabled.

#5 lore raw
In reply to Robert Hancock
Quoted 10 lines · Robert Hancock

Recently ASPM handling was changed to no longer disable ASPM on all PCIe to PCI bridges. Unfortunately these ASMedia PCIe to PCI bridge devices don't seem to function properly with ASPM enabled, as they cause the parent PCIe root port to cause repeated AER timeout errors. In addition to flooding the kernel log, this also causes the machine to wake up immediately after suspend is initiated.

Fixes 66ff14e59e8a ("PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges")

I applied this to for-linus for v5.8, since 66ff14e59e8a was merged for v5.8. Thanks very much for finding, debugging, and fixing this!

66ff14e59e8a wasn't marked for stable, so if it *was* backported to stable kernels, I assume whatever process backported it will also catch this because of the Fixes: tag.

Quoted 31 lines
---
 drivers/pci/quirks.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/pci/quirks.c +13 -0
index 812bfc32ecb8..e5713114f2ab 100644
@@ -2330,6 +2330,19 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f1, quirk_disable_aspm_l0s);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x10f4, quirk_disable_aspm_l0s);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1508, quirk_disable_aspm_l0s);
 
+static void quirk_disable_aspm_l0s_l1(struct pci_dev *dev)
+{
+	pci_info(dev, "Disabling ASPM L0s/L1\n");
+	pci_disable_link_state(dev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1);
+}
+
+/*
+ * ASM1083/1085 PCIe-PCI bridge devices cause AER timeout errors on the
+ * upstream PCIe root port when ASPM is enabled. At least L0s mode is affected,
+ * disable both L0s and L1 for now to be safe.
+ */
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x1080, quirk_disable_aspm_l0s_l1);
+
 /*
  * Some Pericom PCIe-to-PCI bridges in reverse mode need the PCIe Retrain
  * Link bit cleared after starting the link retrain process to allow this
Signature · 1 line
2.26.2