diff mbox series

[1/3] xhci: Fix port resume done detection for SS ports with LPM enabled

Message ID 1553269817-19312-2-git-send-email-mathias.nyman@linux.intel.com (mailing list archive)
State Superseded
Commit 6cbcf596934c8e16d6288c7cc62dfb7ad8eadf15
Headers show
Series xhci fixes for usb-linus | expand

Commit Message

Mathias Nyman March 22, 2019, 3:50 p.m. UTC
A suspended SS port in U3 link state will go to U0 when resumed, but
can almost immediately after that enter U1 or U2 link power save
states before host controller driver reads the port status.

Host controller driver only checks for U0 state, and might miss
the finished resume, leaving flags unclear and skip notifying usb
code of the wake.

Add U1 and U2 to the possible link states when checking for finished
port resume.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-ring.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Mathias Nyman April 1, 2019, 10:42 a.m. UTC | #1
On 27.3.2019 16.00, Sasha Levin wrote:
> Hi,
> 
> [This is an automated email]
> 
> This commit has been processed because it contains a -stable tag.
> The stable tag indicates that it's relevant for the following trees: all
> 
> The bot has tested the following trees: v5.0.4, v4.19.31, v4.14.108, v4.9.165, v4.4.177, v3.18.137.
> 
> v5.0.4: Build OK!
> v4.19.31: Build OK!
> v4.14.108: Build OK!
> v4.9.165: Failed to apply! Possible dependencies:
>      76a0f32b28d4 ("xhci: rename temp and temp1 variables")
> 
> v4.4.177: Failed to apply! Possible dependencies:
>      76a0f32b28d4 ("xhci: rename temp and temp1 variables")
> 
> v3.18.137: Failed to apply! Possible dependencies:
>      2338b9e47fba ("xhci: define the new default speed ID for SuperSpeedPlus used by xhci hw")
>      41485a90d573 ("xhci: optimize xhci bus resume time")
>      76a0f32b28d4 ("xhci: rename temp and temp1 variables")
>      b50107bb83d0 ("xhci: check xhci hardware for USB 3.1 support")
>      cd33a32157e4 ("usb: xhci: cleanup xhci_hcd allocation")
> 
> 
> How should we proceed with this patch?

Backported versions for 4.9, 4.4 and 3.18 sent to stable

Thanks
Mathias
Greg Kroah-Hartman April 1, 2019, 11:37 a.m. UTC | #2
On Mon, Apr 01, 2019 at 01:42:00PM +0300, Mathias Nyman wrote:
> On 27.3.2019 16.00, Sasha Levin wrote:
> > Hi,
> > 
> > [This is an automated email]
> > 
> > This commit has been processed because it contains a -stable tag.
> > The stable tag indicates that it's relevant for the following trees: all
> > 
> > The bot has tested the following trees: v5.0.4, v4.19.31, v4.14.108, v4.9.165, v4.4.177, v3.18.137.
> > 
> > v5.0.4: Build OK!
> > v4.19.31: Build OK!
> > v4.14.108: Build OK!
> > v4.9.165: Failed to apply! Possible dependencies:
> >      76a0f32b28d4 ("xhci: rename temp and temp1 variables")
> > 
> > v4.4.177: Failed to apply! Possible dependencies:
> >      76a0f32b28d4 ("xhci: rename temp and temp1 variables")
> > 
> > v3.18.137: Failed to apply! Possible dependencies:
> >      2338b9e47fba ("xhci: define the new default speed ID for SuperSpeedPlus used by xhci hw")
> >      41485a90d573 ("xhci: optimize xhci bus resume time")
> >      76a0f32b28d4 ("xhci: rename temp and temp1 variables")
> >      b50107bb83d0 ("xhci: check xhci hardware for USB 3.1 support")
> >      cd33a32157e4 ("usb: xhci: cleanup xhci_hcd allocation")
> > 
> > 
> > How should we proceed with this patch?
> 
> Backported versions for 4.9, 4.4 and 3.18 sent to stable

Thanks for the backports, all now queued up.

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 40fa25c..9215a28 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1647,10 +1647,13 @@  static void handle_port_status(struct xhci_hcd *xhci,
 		}
 	}
 
-	if ((portsc & PORT_PLC) && (portsc & PORT_PLS_MASK) == XDEV_U0 &&
-			DEV_SUPERSPEED_ANY(portsc)) {
+	if ((portsc & PORT_PLC) &&
+	    DEV_SUPERSPEED_ANY(portsc) &&
+	    ((portsc & PORT_PLS_MASK) == XDEV_U0 ||
+	     (portsc & PORT_PLS_MASK) == XDEV_U1 ||
+	     (portsc & PORT_PLS_MASK) == XDEV_U2)) {
 		xhci_dbg(xhci, "resume SS port %d finished\n", port_id);
-		/* We've just brought the device into U0 through either the
+		/* We've just brought the device into U0/1/2 through either the
 		 * Resume state after a device remote wakeup, or through the
 		 * U3Exit state after a host-initiated resume.  If it's a device
 		 * initiated remote wake, don't pass up the link state change,