From: Sinan Kaya <okaya@codeaurora.org>
To: linux-pci@vger.kernel.org, timur@codeaurora.org
Cc: mayurkumar.patel@intel.com, David Daney <david.daney@cavium.com>,
linux-arm-msm@vger.kernel.org,
Shawn Lin <shawn.lin@rock-chips.com>,
linux-kernel@vger.kernel.org, Sinan Kaya <okaya@codeaurora.org>,
Julia Lawall <Julia.Lawall@lip6.fr>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH V4 3/3] PCI/ASPM: move link_state cleanup to bridge remove
Date: Mon, 13 Mar 2017 16:48:05 -0400 [thread overview]
Message-ID: <1489438085-2055-4-git-send-email-okaya@codeaurora.org> (raw)
In-Reply-To: <1489438085-2055-1-git-send-email-okaya@codeaurora.org>
For endpoints, change pcie_aspm_exit_link_state() so it cleans up
the device's own state and disables ASPM if necessary, but doesn't
remove the parent's link_state.
For bridges, change pcie_aspm_exit_link_state() so it frees the
bridge's own link_state.
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
drivers/pci/pcie/aspm.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index ed67710..6c2d7ea 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -419,8 +419,10 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link,
*/
if (dwreg.support & upreg.support & PCIE_LINK_STATE_L0S)
link->aspm_support |= ASPM_STATE_L0S;
- if (dwreg.enabled & PCIE_LINK_STATE_L0S)
+ if (dwreg.enabled & PCIE_LINK_STATE_L0S) {
link->aspm_enabled |= ASPM_STATE_L0S_UP;
+ link->aspm_default |= ASPM_STATE_L0S_UP;
+ }
if (upreg.enabled & PCIE_LINK_STATE_L0S)
link->aspm_enabled |= ASPM_STATE_L0S_DW;
link->latency_up.l0s = calc_l0s_latency(upreg.latency_encoding_l0s);
@@ -434,9 +436,6 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link,
link->latency_up.l1 = calc_l1_latency(upreg.latency_encoding_l1);
link->latency_dw.l1 = calc_l1_latency(dwreg.latency_encoding_l1);
- /* Save default state */
- link->aspm_default = link->aspm_enabled;
-
/* Setup initial capable state. Will be updated later */
link->aspm_capable = link->aspm_support;
}
@@ -579,6 +578,7 @@ int pci_aspm_init(struct pci_dev *pdev)
{
int ret;
struct pcie_link_state *link;
+ struct aspm_register_info upreg;
if (!aspm_support_enabled)
return 0;
@@ -601,6 +601,13 @@ int pci_aspm_init(struct pci_dev *pdev)
ret = -ENOMEM;
goto unlock;
}
+
+ pcie_get_aspm_reg(pdev, &upreg);
+ if (upreg.enabled & PCIE_LINK_STATE_L0S)
+ link->aspm_default |= ASPM_STATE_L0S_DW;
+ if (upreg.enabled & PCIE_LINK_STATE_L1)
+ link->aspm_default |= ASPM_STATE_L1;
+
} else {
WARN_ON(!pdev->bus);
if (!pdev->bus) {
@@ -748,10 +755,12 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
/* All functions are removed, so just disable ASPM for the link */
pcie_config_aspm_link(link, 0);
- list_del(&link->sibling);
- list_del(&link->link);
- /* Clock PM is for endpoint device */
- free_link_state(link);
+ if (pdev->has_secondary_link) {
+ list_del(&link->sibling);
+ list_del(&link->link);
+ /* Clock PM is for endpoint device */
+ free_link_state(link);
+ }
/* Recheck latencies and configure upstream links */
if (parent_link) {
--
1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2017-03-13 20:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 20:48 [PATCH V4 0/3] PCI/ASPM: reconfigure ASPM following hotplug for POLICY_DEFAULT Sinan Kaya
2017-03-13 20:48 ` [PATCH V4 1/3] PCI/ASPM: divide ASPM capability init into pre and post init Sinan Kaya
2017-03-13 20:48 ` [PATCH V4 2/3] PCI/ASPM: move part of ASPM initialization to pci_init_capabilities Sinan Kaya
2017-03-13 20:48 ` Sinan Kaya [this message]
2017-03-13 21:46 ` [PATCH V4 0/3] PCI/ASPM: reconfigure ASPM following hotplug for POLICY_DEFAULT Bjorn Helgaas
2017-03-13 22:05 ` Sinan Kaya
2017-03-13 23:08 ` Bjorn Helgaas
2017-03-13 23:21 ` Sinan Kaya
2017-03-14 19:21 ` Bjorn Helgaas
2017-03-15 14:33 ` Sinan Kaya
2017-03-20 17:43 ` Sinan Kaya
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=1489438085-2055-4-git-send-email-okaya@codeaurora.org \
--to=okaya@codeaurora.org \
--cc=Julia.Lawall@lip6.fr \
--cc=bhelgaas@google.com \
--cc=david.daney@cavium.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mayurkumar.patel@intel.com \
--cc=shawn.lin@rock-chips.com \
--cc=timur@codeaurora.org \
/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).