]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
PCI/ASPM: Convert quirks to override advertised link states
authorBjorn Helgaas <bhelgaas@google.com>
Mon, 10 Nov 2025 22:22:27 +0000 (16:22 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 13 Nov 2025 00:51:39 +0000 (18:51 -0600)
commit30579eebba6ae52dc7441479aec9dd8d782256d3
treeb66a011ef3373d19b28db0b894cb5b3265060fe3
parent575b98e39d817537afdc6c39d35c1de484a64d42
PCI/ASPM: Convert quirks to override advertised link states

Existing quirks to disable ASPM L0s and L1 use pci_disable_link_state(),
which disables ASPM states and prevents their use in the future.  But since
they are FINAL quirks, they happen after ASPM has already been enabled.
Here's a typical call path:

  pci_host_probe
    pci_scan_root_bus_bridge
      pci_scan_child_bus
        pci_scan_slot
          pci_scan_single_device
            pci_device_add
              pci_fixup_device(pci_fixup_header)  # HEADER quirks
          pcie_aspm_init_link_state
            pcie_config_aspm_path
              pcie_config_aspm_link
                pcie_config_aspm_dev              # ASPM may be enabled
    pci_bus_add_devices
      pci_bus_add_devices
        pci_fixup_device(pci_fixup_final)         # FINAL quirks
          quirk_disable_aspm_l0s
            pci_disable_link_state(dev, PCIE_LINK_STATE_L0S)

Sometimes enabling ASPM can make the link non-functional, so if we know
ASPM is broken on a device, we shouldn't enable it at all, even
temporarily.

Convert the existing quirks to use pcie_aspm_remove_cap() instead, which
overrides the ASPM Support advertised in PCIe Link Capabilities, and make
them HEADER quirks so they run before pcie_aspm_init_link_state() has a
chance to enable ASPM.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Link: https://patch.msgid.link/20251110222929.2140564-4-helgaas@kernel.org
drivers/pci/quirks.c