* [PATCH] xhci: Prevent runtime suspend all the time with XHCI_RESET_ON_RESUME quirk
@ 2020-05-04 9:19 Kai-Heng Feng
2020-05-04 9:47 ` Oliver Neukum
0 siblings, 1 reply; 5+ messages in thread
From: Kai-Heng Feng @ 2020-05-04 9:19 UTC (permalink / raw)
To: mathias.nyman
Cc: Kai-Heng Feng, Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list
Etron EJ168 USB 3.0 Host Controller stops working after S3, if it was
runtime suspended previously:
[ 370.080359] pci 0000:02:00.0: can't change power state from D3cold to D0 (config space inaccessible)
[ 370.080477] xhci_hcd 0000:04:00.0: can't change power state from D3cold to D0 (config space inaccessible)
[ 370.080532] pcieport 0000:00:1c.0: DPC: containment event, status:0x1f05 source:0x0200
[ 370.080533] pcieport 0000:00:1c.0: DPC: ERR_FATAL detected
[ 370.080536] xhci_hcd 0000:04:00.0: can't change power state from D3hot to D0 (config space inaccessible)
[ 370.080552] xhci_hcd 0000:04:00.0: AER: can't recover (no error_detected callback)
[ 370.080566] usb usb3: root hub lost power or was reset
[ 370.080566] usb usb4: root hub lost power or was reset
[ 370.080572] xhci_hcd 0000:04:00.0: Host halt failed, -19
[ 370.080574] xhci_hcd 0000:04:00.0: Host not accessible, reset failed.
[ 370.080575] xhci_hcd 0000:04:00.0: PCI post-resume error -19!
[ 370.080586] xhci_hcd 0000:04:00.0: HC died; cleaning up
This can be fixed by not runtime suspend the controller at all.
So instead of conditionally runtime suspend the controller, always
prevent runtime suspend with XHCI_RESET_ON_RESUME quirk.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
drivers/usb/host/xhci-pci.c | 3 ++-
drivers/usb/host/xhci.c | 19 -------------------
2 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 766b74723e64..7d2660923dae 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -371,7 +371,8 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
xhci->shared_hcd->can_do_streams = 1;
/* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */
- pm_runtime_put_noidle(&dev->dev);
+ if (!(xhci->quirks & XHCI_RESET_ON_RESUME))
+ pm_runtime_put_noidle(&dev->dev);
if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW)
pm_runtime_allow(&dev->dev);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index bee5deccc83d..8a1e3172405b 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3860,16 +3860,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
struct xhci_slot_ctx *slot_ctx;
int i, ret;
-#ifndef CONFIG_USB_DEFAULT_PERSIST
- /*
- * We called pm_runtime_get_noresume when the device was attached.
- * Decrement the counter here to allow controller to runtime suspend
- * if no devices remain.
- */
- if (xhci->quirks & XHCI_RESET_ON_RESUME)
- pm_runtime_put_noidle(hcd->self.controller);
-#endif
-
ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__);
/* If the host is halted due to driver unload, we still need to free the
* device.
@@ -4020,15 +4010,6 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
xhci_debugfs_create_slot(xhci, slot_id);
-#ifndef CONFIG_USB_DEFAULT_PERSIST
- /*
- * If resetting upon resume, we can't put the controller into runtime
- * suspend if there is a device attached.
- */
- if (xhci->quirks & XHCI_RESET_ON_RESUME)
- pm_runtime_get_noresume(hcd->self.controller);
-#endif
-
/* Is this a LS or FS device under a HS hub? */
/* Hub or peripherial? */
return 1;
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] xhci: Prevent runtime suspend all the time with XHCI_RESET_ON_RESUME quirk
2020-05-04 9:19 [PATCH] xhci: Prevent runtime suspend all the time with XHCI_RESET_ON_RESUME quirk Kai-Heng Feng
@ 2020-05-04 9:47 ` Oliver Neukum
2020-05-04 10:02 ` Kai-Heng Feng
0 siblings, 1 reply; 5+ messages in thread
From: Oliver Neukum @ 2020-05-04 9:47 UTC (permalink / raw)
To: Kai-Heng Feng, mathias.nyman
Cc: Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list
Am Montag, den 04.05.2020, 17:19 +0800 schrieb Kai-Heng Feng:
> Etron EJ168 USB 3.0 Host Controller stops working after S3, if it was
> runtime suspended previously:
> [ 370.080359] pci 0000:02:00.0: can't change power state from D3cold to D0 (config space inaccessible)
Apparently this controller has issues with D3cold
> [ 370.080477] xhci_hcd 0000:04:00.0: can't change power state from D3cold to D0 (config space inaccessible)
> [ 370.080532] pcieport 0000:00:1c.0: DPC: containment event, status:0x1f05 source:0x0200
> [ 370.080533] pcieport 0000:00:1c.0: DPC: ERR_FATAL detected
> [ 370.080536] xhci_hcd 0000:04:00.0: can't change power state from D3hot to D0 (config space inaccessible)
> [ 370.080552] xhci_hcd 0000:04:00.0: AER: can't recover (no error_detected callback)
> [ 370.080566] usb usb3: root hub lost power or was reset
> [ 370.080566] usb usb4: root hub lost power or was reset
> [ 370.080572] xhci_hcd 0000:04:00.0: Host halt failed, -19
> [ 370.080574] xhci_hcd 0000:04:00.0: Host not accessible, reset failed.
> [ 370.080575] xhci_hcd 0000:04:00.0: PCI post-resume error -19!
> [ 370.080586] xhci_hcd 0000:04:00.0: HC died; cleaning up
>
> This can be fixed by not runtime suspend the controller at all.
>
> So instead of conditionally runtime suspend the controller, always
> prevent runtime suspend with XHCI_RESET_ON_RESUME quirk.
What does that do to other controllers that can do runtime suspend
under the current scheme?
Regards
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xhci: Prevent runtime suspend all the time with XHCI_RESET_ON_RESUME quirk
2020-05-04 9:47 ` Oliver Neukum
@ 2020-05-04 10:02 ` Kai-Heng Feng
2020-05-04 10:13 ` Mathias Nyman
0 siblings, 1 reply; 5+ messages in thread
From: Kai-Heng Feng @ 2020-05-04 10:02 UTC (permalink / raw)
To: Oliver Neukum
Cc: Mathias Nyman, Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list
> On May 4, 2020, at 17:47, Oliver Neukum <oneukum@suse.com> wrote:
>
> Am Montag, den 04.05.2020, 17:19 +0800 schrieb Kai-Heng Feng:
>> Etron EJ168 USB 3.0 Host Controller stops working after S3, if it was
>> runtime suspended previously:
>> [ 370.080359] pci 0000:02:00.0: can't change power state from D3cold to D0 (config space inaccessible)
>
> Apparently this controller has issues with D3cold
>
>> [ 370.080477] xhci_hcd 0000:04:00.0: can't change power state from D3cold to D0 (config space inaccessible)
>> [ 370.080532] pcieport 0000:00:1c.0: DPC: containment event, status:0x1f05 source:0x0200
>> [ 370.080533] pcieport 0000:00:1c.0: DPC: ERR_FATAL detected
>> [ 370.080536] xhci_hcd 0000:04:00.0: can't change power state from D3hot to D0 (config space inaccessible)
>> [ 370.080552] xhci_hcd 0000:04:00.0: AER: can't recover (no error_detected callback)
>> [ 370.080566] usb usb3: root hub lost power or was reset
>> [ 370.080566] usb usb4: root hub lost power or was reset
>> [ 370.080572] xhci_hcd 0000:04:00.0: Host halt failed, -19
>> [ 370.080574] xhci_hcd 0000:04:00.0: Host not accessible, reset failed.
>> [ 370.080575] xhci_hcd 0000:04:00.0: PCI post-resume error -19!
>> [ 370.080586] xhci_hcd 0000:04:00.0: HC died; cleaning up
>>
>> This can be fixed by not runtime suspend the controller at all.
>>
>> So instead of conditionally runtime suspend the controller, always
>> prevent runtime suspend with XHCI_RESET_ON_RESUME quirk.
>
> What does that do to other controllers that can do runtime suspend
> under the current scheme?
Ok, I'll add a new quirk specific to this controller.
Kai-Heng
>
> Regards
> Oliver
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xhci: Prevent runtime suspend all the time with XHCI_RESET_ON_RESUME quirk
2020-05-04 10:02 ` Kai-Heng Feng
@ 2020-05-04 10:13 ` Mathias Nyman
2020-05-04 10:21 ` Kai-Heng Feng
0 siblings, 1 reply; 5+ messages in thread
From: Mathias Nyman @ 2020-05-04 10:13 UTC (permalink / raw)
To: Kai-Heng Feng, Oliver Neukum
Cc: Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list
On 4.5.2020 13.02, Kai-Heng Feng wrote:
>
>
>> On May 4, 2020, at 17:47, Oliver Neukum <oneukum@suse.com> wrote:
>>
>> Am Montag, den 04.05.2020, 17:19 +0800 schrieb Kai-Heng Feng:
>>> Etron EJ168 USB 3.0 Host Controller stops working after S3, if it was
>>> runtime suspended previously:
>>> [ 370.080359] pci 0000:02:00.0: can't change power state from D3cold to D0 (config space inaccessible)
>>
>> Apparently this controller has issues with D3cold
>>
>>> [ 370.080477] xhci_hcd 0000:04:00.0: can't change power state from D3cold to D0 (config space inaccessible)
>>> [ 370.080532] pcieport 0000:00:1c.0: DPC: containment event, status:0x1f05 source:0x0200
>>> [ 370.080533] pcieport 0000:00:1c.0: DPC: ERR_FATAL detected
>>> [ 370.080536] xhci_hcd 0000:04:00.0: can't change power state from D3hot to D0 (config space inaccessible)
>>> [ 370.080552] xhci_hcd 0000:04:00.0: AER: can't recover (no error_detected callback)
>>> [ 370.080566] usb usb3: root hub lost power or was reset
>>> [ 370.080566] usb usb4: root hub lost power or was reset
>>> [ 370.080572] xhci_hcd 0000:04:00.0: Host halt failed, -19
>>> [ 370.080574] xhci_hcd 0000:04:00.0: Host not accessible, reset failed.
>>> [ 370.080575] xhci_hcd 0000:04:00.0: PCI post-resume error -19!
>>> [ 370.080586] xhci_hcd 0000:04:00.0: HC died; cleaning up
>>>
>>> This can be fixed by not runtime suspend the controller at all.
>>>
>>> So instead of conditionally runtime suspend the controller, always
>>> prevent runtime suspend with XHCI_RESET_ON_RESUME quirk.
>>
>> What does that do to other controllers that can do runtime suspend
>> under the current scheme?
>
> Ok, I'll add a new quirk specific to this controller.
>
> Kai-Heng
Host shouldn't runtime suspend by default unless set by userspace, or
it has XHCI_DEFAULT_PM_RUNTIME_ALLOW quirk set.
-Mathias
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xhci: Prevent runtime suspend all the time with XHCI_RESET_ON_RESUME quirk
2020-05-04 10:13 ` Mathias Nyman
@ 2020-05-04 10:21 ` Kai-Heng Feng
0 siblings, 0 replies; 5+ messages in thread
From: Kai-Heng Feng @ 2020-05-04 10:21 UTC (permalink / raw)
To: Mathias Nyman
Cc: Oliver Neukum, Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list
> On May 4, 2020, at 18:13, Mathias Nyman <mathias.nyman@intel.com> wrote:
>
> On 4.5.2020 13.02, Kai-Heng Feng wrote:
>>
>>
>>> On May 4, 2020, at 17:47, Oliver Neukum <oneukum@suse.com> wrote:
>>>
>>> Am Montag, den 04.05.2020, 17:19 +0800 schrieb Kai-Heng Feng:
>>>> Etron EJ168 USB 3.0 Host Controller stops working after S3, if it was
>>>> runtime suspended previously:
>>>> [ 370.080359] pci 0000:02:00.0: can't change power state from D3cold to D0 (config space inaccessible)
>>>
>>> Apparently this controller has issues with D3cold
>>>
>>>> [ 370.080477] xhci_hcd 0000:04:00.0: can't change power state from D3cold to D0 (config space inaccessible)
>>>> [ 370.080532] pcieport 0000:00:1c.0: DPC: containment event, status:0x1f05 source:0x0200
>>>> [ 370.080533] pcieport 0000:00:1c.0: DPC: ERR_FATAL detected
>>>> [ 370.080536] xhci_hcd 0000:04:00.0: can't change power state from D3hot to D0 (config space inaccessible)
>>>> [ 370.080552] xhci_hcd 0000:04:00.0: AER: can't recover (no error_detected callback)
>>>> [ 370.080566] usb usb3: root hub lost power or was reset
>>>> [ 370.080566] usb usb4: root hub lost power or was reset
>>>> [ 370.080572] xhci_hcd 0000:04:00.0: Host halt failed, -19
>>>> [ 370.080574] xhci_hcd 0000:04:00.0: Host not accessible, reset failed.
>>>> [ 370.080575] xhci_hcd 0000:04:00.0: PCI post-resume error -19!
>>>> [ 370.080586] xhci_hcd 0000:04:00.0: HC died; cleaning up
>>>>
>>>> This can be fixed by not runtime suspend the controller at all.
>>>>
>>>> So instead of conditionally runtime suspend the controller, always
>>>> prevent runtime suspend with XHCI_RESET_ON_RESUME quirk.
>>>
>>> What does that do to other controllers that can do runtime suspend
>>> under the current scheme?
>>
>> Ok, I'll add a new quirk specific to this controller.
>>
>> Kai-Heng
>
> Host shouldn't runtime suspend by default unless set by userspace, or
> it has XHCI_DEFAULT_PM_RUNTIME_ALLOW quirk set.
In this case, runtime suspend is indeed enabled by userspace.
However we should still disable it at kernel side to prevent any bug.
Kai-Heng
>
> -Mathias
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-04 10:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04 9:19 [PATCH] xhci: Prevent runtime suspend all the time with XHCI_RESET_ON_RESUME quirk Kai-Heng Feng
2020-05-04 9:47 ` Oliver Neukum
2020-05-04 10:02 ` Kai-Heng Feng
2020-05-04 10:13 ` Mathias Nyman
2020-05-04 10:21 ` 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).