[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211021010041.GA2655223@bhelgaas>
Date: Wed, 20 Oct 2021 20:00:41 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: Linux PCI <linux-pci@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>
Subject: Re: [PATCH] PCI: PM: Fix ordering of operations in
pci_back_from_sleep()
On Fri, Oct 15, 2021 at 06:45:59PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
>
> The ordering of operations in pci_back_from_sleep() is incorrect,
> because the device may be in D3cold when it runs and pci_enable_wake()
> needs to access the device's configuration space which cannot be
> done in D3cold.
>
> Fix this by calling pci_set_power_state() to put the device into D0
> before calling pci_enable_wake() for it.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Acked-by: Bjorn Helgaas <bhelgaas@...gle.com>
Thanks!
> ---
> drivers/pci/pci.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> Index: linux-pm/drivers/pci/pci.c
> ===================================================================
> --- linux-pm.orig/drivers/pci/pci.c
> +++ linux-pm/drivers/pci/pci.c
> @@ -2638,8 +2638,13 @@ EXPORT_SYMBOL(pci_prepare_to_sleep);
> */
> int pci_back_from_sleep(struct pci_dev *dev)
> {
> + int ret = pci_set_power_state(dev, PCI_D0);
> +
> + if (ret)
> + return ret;
> +
> pci_enable_wake(dev, PCI_D0, false);
> - return pci_set_power_state(dev, PCI_D0);
> + return 0;
> }
> EXPORT_SYMBOL(pci_back_from_sleep);
>
>
>
>
Powered by blists - more mailing lists