diff mbox

pci: don't touch card regs after runtime suspend D3

Message ID 1348016824-1895-1-git-send-email-airlied@redhat.com
State Accepted
Headers show

Commit Message

David Airlie Sept. 19, 2012, 1:07 a.m. UTC
If the driver takes care of state saving, don't touch any registers on it.

Optimus (dual-gpu) laptops seem to have their own form of D3cold, but
unfortunately enter it on normal D3 transitions via the ACPI callback.

So when we use runtime PM to transition to D3, the card disappears off
the PCI bus, however we then try to access registers on it in the 
runtime suspend finish, which really doesn't work.

This patch check is the pci state is saved and doesn't attempt to hit
any registers after that point if it is.

(Looks okay to Rafael)

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/pci/pci-driver.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Bjorn Helgaas Nov. 5, 2012, 10:30 p.m. UTC | #1
On Tue, Sep 18, 2012 at 7:07 PM, Dave Airlie <airlied@redhat.com> wrote:
> If the driver takes care of state saving, don't touch any registers on it.
>
> Optimus (dual-gpu) laptops seem to have their own form of D3cold, but
> unfortunately enter it on normal D3 transitions via the ACPI callback.
>
> So when we use runtime PM to transition to D3, the card disappears off
> the PCI bus, however we then try to access registers on it in the
> runtime suspend finish, which really doesn't work.
>
> This patch check is the pci state is saved and doesn't attempt to hit
> any registers after that point if it is.
>
> (Looks okay to Rafael)
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>

I applied this to my pci/misc branch as v3.8 material.

Let me know if this should be v3.7 material or if it needs to be
backported to -stable (and how far if so).

> ---
>  drivers/pci/pci-driver.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index 5270f1a..214a40b 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -1057,10 +1057,11 @@ static int pci_pm_runtime_suspend(struct device *dev)
>                 return 0;
>         }
>
> -       if (!pci_dev->state_saved)
> +       if (!pci_dev->state_saved) {
>                 pci_save_state(pci_dev);
>
> -       pci_finish_runtime_suspend(pci_dev);
> +               pci_finish_runtime_suspend(pci_dev);
> +       }
>
>         return 0;
>  }
> --
> 1.7.12
>
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 5270f1a..214a40b 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1057,10 +1057,11 @@  static int pci_pm_runtime_suspend(struct device *dev)
 		return 0;
 	}
 
-	if (!pci_dev->state_saved)
+	if (!pci_dev->state_saved) {
 		pci_save_state(pci_dev);
 
-	pci_finish_runtime_suspend(pci_dev);
+		pci_finish_runtime_suspend(pci_dev);
+	}
 
 	return 0;
 }