Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1612437 > unrolled thread

[PATCH V6 5/5] PCI/ASPM: move link_state cleanup to bridge remove

Started bySinan Kaya <okaya@codeaurora.org>
First post2017-03-30 01:10 +0200
Last post2017-03-30 15:30 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH V6 5/5] PCI/ASPM: move link_state cleanup to bridge remove Sinan Kaya <okaya@codeaurora.org> - 2017-03-30 01:10 +0200
    Re: [PATCH V6 5/5] PCI/ASPM: move link_state cleanup to bridge remove Sinan Kaya <okaya@codeaurora.org> - 2017-03-30 15:30 +0200

#1612437 — [PATCH V6 5/5] PCI/ASPM: move link_state cleanup to bridge remove

FromSinan Kaya <okaya@codeaurora.org>
Date2017-03-30 01:10 +0200
Subject[PATCH V6 5/5] PCI/ASPM: move link_state cleanup to bridge remove
Message-ID<tquT0-5z9-23@gated-at.bofh.it>
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.

Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=194895
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
 drivers/pci/pcie/aspm.c | 20 +++++++++++++++-----
 drivers/pci/remove.c    |  3 +--
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index a38602a..37ca9b3 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -963,6 +963,21 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
 	if (!parent || !parent->link_state)
 		return;
 
+	if (pdev->has_secondary_link) {
+		link = pdev->link_state;
+		down_read(&pci_bus_sem);
+		mutex_lock(&aspm_lock);
+
+		list_del(&link->sibling);
+		list_del(&link->link);
+
+		/* Clock PM is for endpoint device */
+		free_link_state(link);
+		mutex_unlock(&aspm_lock);
+		up_read(&pci_bus_sem);
+		return;
+	}
+
 	down_read(&pci_bus_sem);
 	mutex_lock(&aspm_lock);
 	/*
@@ -978,11 +993,6 @@ 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);
-
 	/* Recheck latencies and configure upstream links */
 	if (parent_link) {
 		pcie_update_aspm_capable(root);
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index 73a03d3..7e14ebd 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -25,8 +25,7 @@ static void pci_stop_dev(struct pci_dev *dev)
 		dev->is_added = 0;
 	}
 
-	if (dev->bus->self)
-		pcie_aspm_exit_link_state(dev);
+	pcie_aspm_exit_link_state(dev);
 }
 
 static void pci_destroy_dev(struct pci_dev *dev)
-- 
1.9.1

[toc] | [next] | [standalone]


#1613059

FromSinan Kaya <okaya@codeaurora.org>
Date2017-03-30 15:30 +0200
Message-ID<tqIjf-6VF-11@gated-at.bofh.it>
In reply to#1612437
On 3/29/2017 7:04 PM, Sinan Kaya wrote:
>  	if (!parent || !parent->link_state)
>  		return;
>  
> +	if (pdev->has_secondary_link) {
> +		link = pdev->link_state;

I think I accidentally moved the parent check above this code
and broke the case where you can actually remove the root port.

I'll post v7 with reverting this change.

-- 
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web