Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI/ASPM: Add pcie_aspm_remove_cap() to override advertised link states

Add pcie_aspm_remove_cap(). A quirk can use this to prevent use of ASPM
L0s or L1 link states, even if the device advertised support for them.

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-3-helgaas@kernel.org

+15
+2
drivers/pci/pci.h
··· 958 958 void pci_restore_aspm_l1ss_state(struct pci_dev *dev); 959 959 960 960 #ifdef CONFIG_PCIEASPM 961 + void pcie_aspm_remove_cap(struct pci_dev *pdev, u32 lnkcap); 961 962 void pcie_aspm_init_link_state(struct pci_dev *pdev); 962 963 void pcie_aspm_exit_link_state(struct pci_dev *pdev); 963 964 void pcie_aspm_pm_state_change(struct pci_dev *pdev, bool locked); ··· 966 965 void pci_configure_ltr(struct pci_dev *pdev); 967 966 void pci_bridge_reconfigure_ltr(struct pci_dev *pdev); 968 967 #else 968 + static inline void pcie_aspm_remove_cap(struct pci_dev *pdev, u32 lnkcap) { } 969 969 static inline void pcie_aspm_init_link_state(struct pci_dev *pdev) { } 970 970 static inline void pcie_aspm_exit_link_state(struct pci_dev *pdev) { } 971 971 static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev, bool locked) { }
+13
drivers/pci/pcie/aspm.c
··· 1542 1542 } 1543 1543 EXPORT_SYMBOL(pci_enable_link_state_locked); 1544 1544 1545 + void pcie_aspm_remove_cap(struct pci_dev *pdev, u32 lnkcap) 1546 + { 1547 + if (lnkcap & PCI_EXP_LNKCAP_ASPM_L0S) 1548 + pdev->aspm_l0s_support = 0; 1549 + if (lnkcap & PCI_EXP_LNKCAP_ASPM_L1) 1550 + pdev->aspm_l1_support = 0; 1551 + 1552 + pci_info(pdev, "ASPM: Link Capabilities%s%s treated as unsupported to avoid device defect\n", 1553 + lnkcap & PCI_EXP_LNKCAP_ASPM_L0S ? " L0s" : "", 1554 + lnkcap & PCI_EXP_LNKCAP_ASPM_L1 ? " L1" : ""); 1555 + 1556 + } 1557 + 1545 1558 static int pcie_aspm_set_policy(const char *val, 1546 1559 const struct kernel_param *kp) 1547 1560 {