From: Heiner Kallweit <hkallweit1@gmail.com>
To: Frederick Lawler <fred@fredlawl.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Greg KH <gregkh@linuxfoundation.org>,
Rajat Jain <rajatja@google.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: [PATCH v5 1/4] PCI/ASPM: add L1 sub-state support to pci_disable_link_state
Date: Sat, 31 Aug 2019 22:15:23 +0200 [thread overview]
Message-ID: <18f323f1-89a9-f624-1cef-a226e257b69a@gmail.com> (raw)
In-Reply-To: <c63f507f-7f52-7164-dbc5-07fc18e433b8@gmail.com>
Add support for disabling states L1.1 and L1.2 to
pci_disable_link_state. Allow separate control of
ASPM and PCI PM L1 sub-states.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- allow separate control of ASPM and PCI PM L1 sub-states
v5:
- rebased to latest pci/next
---
drivers/pci/pcie/aspm.c | 11 ++++++++++-
include/linux/pci.h | 10 +++++++---
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index ad6259ec5..6de7a597a 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -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;
+ /* sub-states 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) {
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 67303262f..054345eed 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1553,9 +1553,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);
--
2.23.0
next prev parent reply other threads:[~2019-08-31 20:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-31 20:10 [PATCH v5 0/4] PCI/ASPM: add sysfs attributes for controlling ASPM Heiner Kallweit
2019-08-31 20:15 ` Heiner Kallweit [this message]
2019-08-31 20:16 ` [PATCH v5 2/4] PCI/ASPM: allow to re-enable Clock PM Heiner Kallweit
2019-08-31 20:18 ` [PATCH v5 4/4] PCI/ASPM: remove Kconfig option PCIEASPM_DEBUG and related code Heiner Kallweit
2019-09-07 20:34 ` Bjorn Helgaas
2019-08-31 20:20 ` [PATCH v5 3/4] PCI/ASPM: add sysfs attributes for controlling ASPM link states Heiner Kallweit
2019-09-07 20:32 ` Bjorn Helgaas
2019-09-29 17:15 ` Heiner Kallweit
2019-10-02 19:55 ` Bjorn Helgaas
2019-10-02 21:10 ` Heiner Kallweit
2019-10-02 22:10 ` Bjorn Helgaas
2019-10-02 22:23 ` Heiner Kallweit
2019-10-03 14:15 ` Heiner Kallweit
2019-10-03 16:27 ` Bjorn Helgaas
2019-09-07 16:58 ` [PATCH v5 0/4] PCI/ASPM: add sysfs attributes for controlling ASPM Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18f323f1-89a9-f624-1cef-a226e257b69a@gmail.com \
--to=hkallweit1@gmail.com \
--cc=bhelgaas@google.com \
--cc=fred@fredlawl.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-pci@vger.kernel.org \
--cc=rajatja@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).