* [PATCH v2] PCI / PM: Always check PME wakeup capability for runtime wakeup support
@ 2018-03-19 14:09 Kai-Heng Feng
2018-03-26 5:54 ` Kai Heng Feng
0 siblings, 1 reply; 4+ messages in thread
From: Kai-Heng Feng @ 2018-03-19 14:09 UTC (permalink / raw)
To: bhelgaas; +Cc: rafael.j.wysocki, linux-pci, linux-kernel, Kai-Heng Feng, stable
USB controller ASM1042 stops working after commit de3ef1eb1cd0 ("PM /
core: Drop run_wake flag from struct dev_pm_info").
The device in question is not power managed by platform firmware,
furthermore, it only supports PME# from D3cold:
Capabilities: [78] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0-,D1-,D2-,D3hot-,D3cold+)
Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
Before commit de3ef1eb1cd0, the device never gets runtime suspended.
After that commit, the device gets runtime suspended, so it does not
respond to any PME#.
usb_hcd_pci_probe() mandatorily calls device_wakeup_enable(), hence
device_can_wakeup() in pci_dev_run_wake() always returns true.
So pci_dev_run_wake() needs to check PME wakeup capability as its first
condition.
Fixes: de3ef1eb1cd0 ("PM / core: Drop run_wake flag from struct dev_pm_info")
Cc: stable@vger.kernel.org # 4.13+
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
v2: Explicitly check dev->pme_support.
drivers/pci/pci.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index f6a4dd10d9b0..52821a21fc07 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2125,16 +2125,16 @@ bool pci_dev_run_wake(struct pci_dev *dev)
{
struct pci_bus *bus = dev->bus;
- if (device_can_wakeup(&dev->dev))
- return true;
-
if (!dev->pme_support)
return false;
/* PME-capable in principle, but not from the target power state */
- if (!pci_pme_capable(dev, pci_target_state(dev, false)))
+ if (!pci_pme_capable(dev, pci_target_state(dev, true)))
return false;
+ if (device_can_wakeup(&dev->dev))
+ return true;
+
while (bus->parent) {
struct pci_dev *bridge = bus->self;
--
2.15.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI / PM: Always check PME wakeup capability for runtime wakeup support
2018-03-19 14:09 [PATCH v2] PCI / PM: Always check PME wakeup capability for runtime wakeup support Kai-Heng Feng
@ 2018-03-26 5:54 ` Kai Heng Feng
2018-03-30 9:00 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Kai Heng Feng @ 2018-03-26 5:54 UTC (permalink / raw)
To: bhelgaas; +Cc: rafael.j.wysocki, linux-pci, Linux Kernel Mailing List, stable
Hi Bjorn, Rafael,
> On Mar 19, 2018, at 10:09 PM, Kai-Heng Feng <kai.heng.feng@canonical.com>
> wrote:
>
> USB controller ASM1042 stops working after commit de3ef1eb1cd0 ("PM /
> core: Drop run_wake flag from struct dev_pm_info").
>
> The device in question is not power managed by platform firmware,
> furthermore, it only supports PME# from D3cold:
> Capabilities: [78] Power Management version 3
> Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0-,D1-,D2-,D3hot-,D3cold+)
> Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
>
> Before commit de3ef1eb1cd0, the device never gets runtime suspended.
> After that commit, the device gets runtime suspended, so it does not
> respond to any PME#.
>
> usb_hcd_pci_probe() mandatorily calls device_wakeup_enable(), hence
> device_can_wakeup() in pci_dev_run_wake() always returns true.
>
> So pci_dev_run_wake() needs to check PME wakeup capability as its first
> condition.
>
> Fixes: de3ef1eb1cd0 ("PM / core: Drop run_wake flag from struct
> dev_pm_info")
> Cc: stable@vger.kernel.org # 4.13+
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Is there any improvement I can address?
Or do you have any concern about this patch?
Kai-Heng
> ---
> v2: Explicitly check dev->pme_support.
>
> drivers/pci/pci.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index f6a4dd10d9b0..52821a21fc07 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -2125,16 +2125,16 @@ bool pci_dev_run_wake(struct pci_dev *dev)
> {
> struct pci_bus *bus = dev->bus;
>
> - if (device_can_wakeup(&dev->dev))
> - return true;
> -
> if (!dev->pme_support)
> return false;
>
> /* PME-capable in principle, but not from the target power state */
> - if (!pci_pme_capable(dev, pci_target_state(dev, false)))
> + if (!pci_pme_capable(dev, pci_target_state(dev, true)))
> return false;
>
> + if (device_can_wakeup(&dev->dev))
> + return true;
> +
> while (bus->parent) {
> struct pci_dev *bridge = bus->self;
>
> --
> 2.15.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI / PM: Always check PME wakeup capability for runtime wakeup support
2018-03-26 5:54 ` Kai Heng Feng
@ 2018-03-30 9:00 ` Rafael J. Wysocki
2018-03-30 9:30 ` Kai-Heng Feng
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2018-03-30 9:00 UTC (permalink / raw)
To: Kai Heng Feng, linux-pci; +Cc: bhelgaas, Linux Kernel Mailing List, stable
On Monday, March 26, 2018 7:54:35 AM CEST Kai Heng Feng wrote:
> Hi Bjorn, Rafael,
>
> > On Mar 19, 2018, at 10:09 PM, Kai-Heng Feng <kai.heng.feng@canonical.com>
> > wrote:
> >
> > USB controller ASM1042 stops working after commit de3ef1eb1cd0 ("PM /
> > core: Drop run_wake flag from struct dev_pm_info").
> >
> > The device in question is not power managed by platform firmware,
> > furthermore, it only supports PME# from D3cold:
> > Capabilities: [78] Power Management version 3
> > Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0-,D1-,D2-,D3hot-,D3cold+)
> > Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
> >
> > Before commit de3ef1eb1cd0, the device never gets runtime suspended.
> > After that commit, the device gets runtime suspended, so it does not
> > respond to any PME#.
> >
> > usb_hcd_pci_probe() mandatorily calls device_wakeup_enable(), hence
> > device_can_wakeup() in pci_dev_run_wake() always returns true.
> >
> > So pci_dev_run_wake() needs to check PME wakeup capability as its first
> > condition.
> >
> > Fixes: de3ef1eb1cd0 ("PM / core: Drop run_wake flag from struct
> > dev_pm_info")
> > Cc: stable@vger.kernel.org # 4.13+
> > Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
>
>
> Is there any improvement I can address?
> Or do you have any concern about this patch?
>
> Kai-Heng
>
> > ---
> > v2: Explicitly check dev->pme_support.
> >
> > drivers/pci/pci.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> > index f6a4dd10d9b0..52821a21fc07 100644
> > --- a/drivers/pci/pci.c
> > +++ b/drivers/pci/pci.c
> > @@ -2125,16 +2125,16 @@ bool pci_dev_run_wake(struct pci_dev *dev)
> > {
> > struct pci_bus *bus = dev->bus;
> >
> > - if (device_can_wakeup(&dev->dev))
> > - return true;
> > -
> > if (!dev->pme_support)
> > return false;
> >
> > /* PME-capable in principle, but not from the target power state */
> > - if (!pci_pme_capable(dev, pci_target_state(dev, false)))
> > + if (!pci_pme_capable(dev, pci_target_state(dev, true)))
So why do you change 'false' to 'true' here?
At least that change should be mentioned in the changelog too.
> > return false;
> >
> > + if (device_can_wakeup(&dev->dev))
> > + return true;
> > +
> > while (bus->parent) {
> > struct pci_dev *bridge = bus->self;
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI / PM: Always check PME wakeup capability for runtime wakeup support
2018-03-30 9:00 ` Rafael J. Wysocki
@ 2018-03-30 9:30 ` Kai-Heng Feng
0 siblings, 0 replies; 4+ messages in thread
From: Kai-Heng Feng @ 2018-03-30 9:30 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: linux-pci, bhelgaas, Linux Kernel Mailing List, stable
Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> On Monday, March 26, 2018 7:54:35 AM CEST Kai Heng Feng wrote:
>> Hi Bjorn, Rafael,
>>
>>> On Mar 19, 2018, at 10:09 PM, Kai-Heng Feng <kai.heng.feng@canonical.com>
>>> wrote:
>>>
>>> USB controller ASM1042 stops working after commit de3ef1eb1cd0 ("PM /
>>> core: Drop run_wake flag from struct dev_pm_info").
>>>
>>> The device in question is not power managed by platform firmware,
>>> furthermore, it only supports PME# from D3cold:
>>> Capabilities: [78] Power Management version 3
>>> Flags: PMEClk- DSI- D1- D2- AuxCurrent=55mA PME(D0-,D1-,D2-,D3hot-,D3cold+)
>>> Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
>>>
>>> Before commit de3ef1eb1cd0, the device never gets runtime suspended.
>>> After that commit, the device gets runtime suspended, so it does not
>>> respond to any PME#.
>>>
>>> usb_hcd_pci_probe() mandatorily calls device_wakeup_enable(), hence
>>> device_can_wakeup() in pci_dev_run_wake() always returns true.
>>>
>>> So pci_dev_run_wake() needs to check PME wakeup capability as its first
>>> condition.
>>>
>>> Fixes: de3ef1eb1cd0 ("PM / core: Drop run_wake flag from struct
>>> dev_pm_info")
>>> Cc: stable@vger.kernel.org # 4.13+
>>> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
>>
>>
>> Is there any improvement I can address?
>> Or do you have any concern about this patch?
>>
>> Kai-Heng
>>
>>> ---
>>> v2: Explicitly check dev->pme_support.
>>>
>>> drivers/pci/pci.c | 8 ++++----
>>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>>> index f6a4dd10d9b0..52821a21fc07 100644
>>> --- a/drivers/pci/pci.c
>>> +++ b/drivers/pci/pci.c
>>> @@ -2125,16 +2125,16 @@ bool pci_dev_run_wake(struct pci_dev *dev)
>>> {
>>> struct pci_bus *bus = dev->bus;
>>>
>>> - if (device_can_wakeup(&dev->dev))
>>> - return true;
>>> -
>>> if (!dev->pme_support)
>>> return false;
>>>
>>> /* PME-capable in principle, but not from the target power state */
>>> - if (!pci_pme_capable(dev, pci_target_state(dev, false)))
>>> + if (!pci_pme_capable(dev, pci_target_state(dev, true)))
>
> So why do you change 'false' to 'true' here?
>
> At least that change should be mentioned in the changelog too.
I'll update the reason in the change log.
Thanks.
>
>>> return false;
>>>
>>> + if (device_can_wakeup(&dev->dev))
>>> + return true;
>>> +
>>> while (bus->parent) {
>>> struct pci_dev *bridge = bus->self;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-30 9:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-19 14:09 [PATCH v2] PCI / PM: Always check PME wakeup capability for runtime wakeup support Kai-Heng Feng
2018-03-26 5:54 ` Kai Heng Feng
2018-03-30 9:00 ` Rafael J. Wysocki
2018-03-30 9:30 ` Kai-Heng Feng
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).