Patchwork [Precise] (pre-stable) ASPM: Fix pcie devices with non-pcie children

login
register
mail settings
Submitter Tim Gardner
Date March 27, 2012, 2:40 p.m.
Message ID <1332859234-83630-1-git-send-email-tim.gardner@canonical.com>
Download mbox | patch
Permalink /patch/148962/
State New
Headers show

Comments

Tim Gardner - March 27, 2012, 2:40 p.m.
From: Matthew Garrett <mjg@redhat.com>

BugLink: http://bugs.launchpad.net/bugs/961482

Commit 4949be16822e92a18ea0cc1616319926628092ee changed the behaviour of
pcie_aspm_sanity_check() to always return 0 if aspm is disabled, in order
to avoid cases where we changed ASPM state on pre-PCIe 1.1 devices. This
skipped the secondary function of pcie_aspm_sanity_check which was to avoid
us enabling ASPM on devices that had non-PCIe children, causing us to hit
a BUG_ON later on. Move the aspm_disabled check so we continue to honour
that scenario.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Colin King <colin.king@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/pci/pcie/aspm.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
Stefan Bader - March 28, 2012, 7:41 a.m.
On 27.03.2012 16:40, Tim Gardner wrote:
> From: Matthew Garrett <mjg@redhat.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/961482
> 
> Commit 4949be16822e92a18ea0cc1616319926628092ee changed the behaviour of
> pcie_aspm_sanity_check() to always return 0 if aspm is disabled, in order
> to avoid cases where we changed ASPM state on pre-PCIe 1.1 devices. This
> skipped the secondary function of pcie_aspm_sanity_check which was to avoid
> us enabling ASPM on devices that had non-PCIe children, causing us to hit
> a BUG_ON later on. Move the aspm_disabled check so we continue to honour
> that scenario.
> 
> Signed-off-by: Matthew Garrett <mjg@redhat.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Colin King <colin.king@canonical.com>
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---
>  drivers/pci/pcie/aspm.c |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 24f049e..2275162 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -500,9 +500,6 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
>  	int pos;
>  	u32 reg32;
>  
> -	if (aspm_disabled)
> -		return 0;
> -
>  	/*
>  	 * Some functions in a slot might not all be PCIe functions,
>  	 * very strange. Disable ASPM for the whole slot
> @@ -511,6 +508,16 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
>  		pos = pci_pcie_cap(child);
>  		if (!pos)
>  			return -EINVAL;
> +
> +		/*
> +		 * If ASPM is disabled then we're not going to change
> +		 * the BIOS state. It's safe to continue even if it's a
> +		 * pre-1.1 device
> +		 */
> +
> +		if (aspm_disabled)
> +			continue;
> +
>  		/*
>  		 * Disable ASPM for pre-1.1 PCIe device, we follow MS to use
>  		 * RBER bit to determine if a function is 1.1 version device

This went upstream and we also had some positive feedback.

Acked-by: Stefan Bader <stefan.bader@canonical.com>

Patch

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 24f049e..2275162 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -500,9 +500,6 @@  static int pcie_aspm_sanity_check(struct pci_dev *pdev)
 	int pos;
 	u32 reg32;
 
-	if (aspm_disabled)
-		return 0;
-
 	/*
 	 * Some functions in a slot might not all be PCIe functions,
 	 * very strange. Disable ASPM for the whole slot
@@ -511,6 +508,16 @@  static int pcie_aspm_sanity_check(struct pci_dev *pdev)
 		pos = pci_pcie_cap(child);
 		if (!pos)
 			return -EINVAL;
+
+		/*
+		 * If ASPM is disabled then we're not going to change
+		 * the BIOS state. It's safe to continue even if it's a
+		 * pre-1.1 device
+		 */
+
+		if (aspm_disabled)
+			continue;
+
 		/*
 		 * Disable ASPM for pre-1.1 PCIe device, we follow MS to use
 		 * RBER bit to determine if a function is 1.1 version device