[PATCH 1/4][SRU][OEM-OSP1-B] UBUNTU: SAUCE: PCI/ASPM: add L1 sub-state support to pci_disable_link_state
AceLan Kao
acelan.kao at canonical.com
Wed Jul 10 09:40:11 UTC 2019
From: Heiner Kallweit <hkallweit1 at gmail.com>
BugLink: https://bugs.launchpad.net/bugs/1836030
Link: https://www.spinics.net/lists/linux-pci/msg83229.html
Add support for disabling states L1.1 and L1.2 to pci_disable_link_state.
Signed-off-by: Heiner Kallweit <hkallweit1 at gmail.com>
Signed-off-by: AceLan Kao <acelan.kao at canonical.com>
---
drivers/pci/pcie/aspm.c | 13 ++++++++++---
include/linux/pci-aspm.h | 8 +++++---
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 727e3c1ef9a4..a90318a69ce5 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -35,9 +35,9 @@
#define ASPM_STATE_L1_1_PCIPM (0x20) /* PCI PM L1.1 state */
#define ASPM_STATE_L1_2_PCIPM (0x40) /* PCI PM L1.2 state */
#define ASPM_STATE_L1_SS_PCIPM (ASPM_STATE_L1_1_PCIPM | ASPM_STATE_L1_2_PCIPM)
+#define ASPM_STATE_L1_1_MASK (ASPM_STATE_L1_1 | ASPM_STATE_L1_1_PCIPM)
#define ASPM_STATE_L1_2_MASK (ASPM_STATE_L1_2 | ASPM_STATE_L1_2_PCIPM)
-#define ASPM_STATE_L1SS (ASPM_STATE_L1_1 | ASPM_STATE_L1_1_PCIPM |\
- ASPM_STATE_L1_2_MASK)
+#define ASPM_STATE_L1SS (ASPM_STATE_L1_1_MASK | ASPM_STATE_L1_2_MASK)
#define ASPM_STATE_L0S (ASPM_STATE_L0S_UP | ASPM_STATE_L0S_DW)
#define ASPM_STATE_ALL (ASPM_STATE_L0S | ASPM_STATE_L1 | \
ASPM_STATE_L1SS)
@@ -1079,8 +1079,15 @@ static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
link = parent->link_state;
if (state & PCIE_LINK_STATE_L0S)
link->aspm_disable |= ASPM_STATE_L0S;
- if (state & PCIE_LINK_STATE_L1)
+ if (state & PCIE_LINK_STATE_L1) {
link->aspm_disable |= ASPM_STATE_L1;
+ /* sub-states require L1 */
+ link->aspm_disable |= ASPM_STATE_L1SS;
+ }
+ if (state & PCIE_LINK_STATE_L1_1)
+ link->aspm_disable |= ASPM_STATE_L1_1_MASK;
+ if (state & PCIE_LINK_STATE_L1_2)
+ link->aspm_disable |= ASPM_STATE_L1_2_MASK;
pcie_config_aspm_link(link, policy_to_aspm_state(link));
if (state & PCIE_LINK_STATE_CLKPM) {
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index df28af5cef21..e66c3e3d8a93 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -19,9 +19,11 @@
#include <linux/pci.h>
-#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)
#ifdef CONFIG_PCIEASPM
void pci_disable_link_state(struct pci_dev *pdev, int state);
--
2.17.1
More information about the kernel-team
mailing list