2019-09-26 18:00:17

by Kai-Heng Feng

[permalink] [raw]
Subject: [PATCH] xhci: Increase STS_SAVE timeout in xhci_suspend()

After commit f7fac17ca925 ("xhci: Convert xhci_handshake() to use
readl_poll_timeout_atomic()"), ASMedia xHCI may fail to suspend.

Although the algorithms are essentially the same, the old max timeout is
(usec + usec * time of doing readl()), and the new max timeout is just
usec, which is much less than the old one.

Increase the timeout to make ASMedia xHCI able to suspend again.

BugLink: https://bugs.launchpad.net/bugs/1844021
Fixes: f7fac17ca925 ("xhci: Convert xhci_handshake() to use readl_poll_timeout_atomic()")
Signed-off-by: Kai-Heng Feng <[email protected]>
---
drivers/usb/host/xhci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 559b639337fb..100493eb9691 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1032,7 +1032,7 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
writel(command, &xhci->op_regs->command);
xhci->broken_suspend = 0;
if (xhci_handshake(&xhci->op_regs->status,
- STS_SAVE, 0, 10 * 1000)) {
+ STS_SAVE, 0, 20 * 1000)) {
/*
* AMD SNPS xHC 3.0 occasionally does not clear the
* SSS bit of USBSTS and when driver tries to poll
--
2.17.1


2019-09-27 06:32:24

by Mathias Nyman

[permalink] [raw]
Subject: Re: [PATCH] xhci: Increase STS_SAVE timeout in xhci_suspend()

On 26.9.2019 20.57, Kai-Heng Feng wrote:
> After commit f7fac17ca925 ("xhci: Convert xhci_handshake() to use
> readl_poll_timeout_atomic()"), ASMedia xHCI may fail to suspend.
>
> Although the algorithms are essentially the same, the old max timeout is
> (usec + usec * time of doing readl()), and the new max timeout is just
> usec, which is much less than the old one.
>
> Increase the timeout to make ASMedia xHCI able to suspend again.
>
> BugLink: https://bugs.launchpad.net/bugs/1844021
> Fixes: f7fac17ca925 ("xhci: Convert xhci_handshake() to use readl_poll_timeout_atomic()")
> Signed-off-by: Kai-Heng Feng <[email protected]>
> ---

Thanks, adding to queue with stable tag for v5.2+ kernels

-Mathias