]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
PCI/ASPM: Add L1 PM substate support to pci_disable_link_state()
authorHeiner Kallweit <hkallweit1@gmail.com>
Tue, 10 Mar 2020 01:48:30 +0000 (09:48 +0800)
committerSeth Forshee <seth.forshee@canonical.com>
Fri, 20 Mar 2020 22:24:35 +0000 (17:24 -0500)
BugLink: https://bugs.launchpad.net/bugs/1836030
Add support for disabling states L1.1 and L1.2 to pci_disable_link_state().
Allow separate control of ASPM and PCI PM L1 substates.

Link: https://lore.kernel.org/r/d81f8036-c236-6463-48e7-ebcdcda85bba@gmail.com
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
(cherry picked from commit aff5d0552da4055da3faa27ee4252e48bb1f5821)
Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/pci/pcie/aspm.c
include/linux/pci.h

index 652ef23bba35ae66fb70a211f9d904bc3af9caed..e8df0b51b74af30d2aa45f9a6bad86de261e3478 100644 (file)
@@ -1094,7 +1094,16 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
        if (state & PCIE_LINK_STATE_L0S)
                link->aspm_disable |= ASPM_STATE_L0S;
        if (state & PCIE_LINK_STATE_L1)
-               link->aspm_disable |= ASPM_STATE_L1;
+               /* L1 PM substates require L1 */
+               link->aspm_disable |= ASPM_STATE_L1 | ASPM_STATE_L1SS;
+       if (state & PCIE_LINK_STATE_L1_1)
+               link->aspm_disable |= ASPM_STATE_L1_1;
+       if (state & PCIE_LINK_STATE_L1_2)
+               link->aspm_disable |= ASPM_STATE_L1_2;
+       if (state & PCIE_LINK_STATE_L1_1_PCIPM)
+               link->aspm_disable |= ASPM_STATE_L1_1_PCIPM;
+       if (state & PCIE_LINK_STATE_L1_2_PCIPM)
+               link->aspm_disable |= ASPM_STATE_L1_2_PCIPM;
        pcie_config_aspm_link(link, policy_to_aspm_state(link));
 
        if (state & PCIE_LINK_STATE_CLKPM) {
index f39f22f9ee474fea6d2370ca1f6db7dbe67bb026..9c39a9ef282918e7a3567aa76d0f75a8e5bee133 100644 (file)
@@ -1544,9 +1544,13 @@ extern bool pcie_ports_native;
 #define pcie_ports_native      false
 #endif
 
-#define PCIE_LINK_STATE_L0S    1
-#define PCIE_LINK_STATE_L1     2
-#define PCIE_LINK_STATE_CLKPM  4
+#define PCIE_LINK_STATE_L0S            BIT(0)
+#define PCIE_LINK_STATE_L1             BIT(1)
+#define PCIE_LINK_STATE_CLKPM          BIT(2)
+#define PCIE_LINK_STATE_L1_1           BIT(3)
+#define PCIE_LINK_STATE_L1_2           BIT(4)
+#define PCIE_LINK_STATE_L1_1_PCIPM     BIT(5)
+#define PCIE_LINK_STATE_L1_2_PCIPM     BIT(6)
 
 #ifdef CONFIG_PCIEASPM
 int pci_disable_link_state(struct pci_dev *pdev, int state);