linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xhci: Remove CONFIG_USB_DEFAULT_PERSIST to prevent xHCI from runtime suspending
@ 2021-11-19  9:26 Kai-Heng Feng
  2021-12-01  0:19 ` Kai-Heng Feng
  0 siblings, 1 reply; 5+ messages in thread
From: Kai-Heng Feng @ 2021-11-19  9:26 UTC (permalink / raw)
  To: mathias.nyman
  Cc: Kai-Heng Feng, Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list

When the xHCI is quirked with XHCI_RESET_ON_RESUME, runtime resume
routine also resets the controller.

This is bad for USB drivers without reset_resume callback, because
there's no subsequent call of usb_dev_complete() ->
usb_resume_complete() to force rebinding the driver to the device. For
instance, btusb device stops working after xHCI controller is runtime
resumed, if the controlled is quirked with XHCI_RESET_ON_RESUME.

So always take XHCI_RESET_ON_RESUME into account to solve the issue.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/usb/host/xhci.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 902f410874e8e..af92a9f8ed670 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3934,7 +3934,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
@@ -3942,7 +3941,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
 	 */
 	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
@@ -4094,14 +4092,12 @@ 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? */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] xhci: Remove CONFIG_USB_DEFAULT_PERSIST to prevent xHCI from runtime suspending
  2021-11-19  9:26 [PATCH] xhci: Remove CONFIG_USB_DEFAULT_PERSIST to prevent xHCI from runtime suspending Kai-Heng Feng
@ 2021-12-01  0:19 ` Kai-Heng Feng
  2021-12-01  9:01   ` Mathias Nyman
  0 siblings, 1 reply; 5+ messages in thread
From: Kai-Heng Feng @ 2021-12-01  0:19 UTC (permalink / raw)
  To: mathias.nyman; +Cc: Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list

On Fri, Nov 19, 2021 at 5:27 PM Kai-Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> When the xHCI is quirked with XHCI_RESET_ON_RESUME, runtime resume
> routine also resets the controller.
>
> This is bad for USB drivers without reset_resume callback, because
> there's no subsequent call of usb_dev_complete() ->
> usb_resume_complete() to force rebinding the driver to the device. For
> instance, btusb device stops working after xHCI controller is runtime
> resumed, if the controlled is quirked with XHCI_RESET_ON_RESUME.
>
> So always take XHCI_RESET_ON_RESUME into account to solve the issue.
>
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>

A gentle ping...

> ---
>  drivers/usb/host/xhci.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 902f410874e8e..af92a9f8ed670 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -3934,7 +3934,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
> @@ -3942,7 +3941,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
>          */
>         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
> @@ -4094,14 +4092,12 @@ 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? */
> --
> 2.32.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xhci: Remove CONFIG_USB_DEFAULT_PERSIST to prevent xHCI from runtime suspending
  2021-12-01  0:19 ` Kai-Heng Feng
@ 2021-12-01  9:01   ` Mathias Nyman
  2021-12-09  6:42     ` Kai-Heng Feng
  0 siblings, 1 reply; 5+ messages in thread
From: Mathias Nyman @ 2021-12-01  9:01 UTC (permalink / raw)
  To: Kai-Heng Feng, mathias.nyman
  Cc: Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list

On 1.12.2021 2.19, Kai-Heng Feng wrote:
> On Fri, Nov 19, 2021 at 5:27 PM Kai-Heng Feng
> <kai.heng.feng@canonical.com> wrote:
>>
>> When the xHCI is quirked with XHCI_RESET_ON_RESUME, runtime resume
>> routine also resets the controller.
>>
>> This is bad for USB drivers without reset_resume callback, because
>> there's no subsequent call of usb_dev_complete() ->
>> usb_resume_complete() to force rebinding the driver to the device. For
>> instance, btusb device stops working after xHCI controller is runtime
>> resumed, if the controlled is quirked with XHCI_RESET_ON_RESUME.
>>
>> So always take XHCI_RESET_ON_RESUME into account to solve the issue.
>>
>> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> 
> A gentle ping...

Thanks
Adding to queue

-Mathias

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xhci: Remove CONFIG_USB_DEFAULT_PERSIST to prevent xHCI from runtime suspending
  2021-12-01  9:01   ` Mathias Nyman
@ 2021-12-09  6:42     ` Kai-Heng Feng
  2021-12-10 14:22       ` Mathias Nyman
  0 siblings, 1 reply; 5+ messages in thread
From: Kai-Heng Feng @ 2021-12-09  6:42 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: mathias.nyman, Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list

On Wed, Dec 1, 2021 at 5:00 PM Mathias Nyman
<mathias.nyman@linux.intel.com> wrote:
>
> On 1.12.2021 2.19, Kai-Heng Feng wrote:
> > On Fri, Nov 19, 2021 at 5:27 PM Kai-Heng Feng
> > <kai.heng.feng@canonical.com> wrote:
> >>
> >> When the xHCI is quirked with XHCI_RESET_ON_RESUME, runtime resume
> >> routine also resets the controller.
> >>
> >> This is bad for USB drivers without reset_resume callback, because
> >> there's no subsequent call of usb_dev_complete() ->
> >> usb_resume_complete() to force rebinding the driver to the device. For
> >> instance, btusb device stops working after xHCI controller is runtime
> >> resumed, if the controlled is quirked with XHCI_RESET_ON_RESUME.
> >>
> >> So always take XHCI_RESET_ON_RESUME into account to solve the issue.
> >>
> >> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> >
> > A gentle ping...
>
> Thanks
> Adding to queue

I haven't found this patch in your repo. Can you please push it so I
can backport it to downstream kernel?

Kai-Heng

>
> -Mathias

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xhci: Remove CONFIG_USB_DEFAULT_PERSIST to prevent xHCI from runtime suspending
  2021-12-09  6:42     ` Kai-Heng Feng
@ 2021-12-10 14:22       ` Mathias Nyman
  0 siblings, 0 replies; 5+ messages in thread
From: Mathias Nyman @ 2021-12-10 14:22 UTC (permalink / raw)
  To: Kai-Heng Feng
  Cc: mathias.nyman, Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list

On 9.12.2021 8.42, Kai-Heng Feng wrote:
> On Wed, Dec 1, 2021 at 5:00 PM Mathias Nyman
> <mathias.nyman@linux.intel.com> wrote:
>>
>> On 1.12.2021 2.19, Kai-Heng Feng wrote:
>>> On Fri, Nov 19, 2021 at 5:27 PM Kai-Heng Feng
>>> <kai.heng.feng@canonical.com> wrote:
>>>>
>>>> When the xHCI is quirked with XHCI_RESET_ON_RESUME, runtime resume
>>>> routine also resets the controller.
>>>>
>>>> This is bad for USB drivers without reset_resume callback, because
>>>> there's no subsequent call of usb_dev_complete() ->
>>>> usb_resume_complete() to force rebinding the driver to the device. For
>>>> instance, btusb device stops working after xHCI controller is runtime
>>>> resumed, if the controlled is quirked with XHCI_RESET_ON_RESUME.
>>>>
>>>> So always take XHCI_RESET_ON_RESUME into account to solve the issue.
>>>>
>>>> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
>>>
>>> A gentle ping...
>>
>> Thanks
>> Adding to queue
> 
> I haven't found this patch in your repo. Can you please push it so I
> can backport it to downstream kernel?

Patch got shuffled around a bit.
It's now in my for-usb-linus branch, and sent to Greg

Thanks
-Mathias


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-10 14:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19  9:26 [PATCH] xhci: Remove CONFIG_USB_DEFAULT_PERSIST to prevent xHCI from runtime suspending Kai-Heng Feng
2021-12-01  0:19 ` Kai-Heng Feng
2021-12-01  9:01   ` Mathias Nyman
2021-12-09  6:42     ` Kai-Heng Feng
2021-12-10 14:22       ` Mathias Nyman

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).