stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* patch "usb: xhci: Fix USB 3.1 supported protocol parsing" added to usb-linus
@ 2017-06-12 14:05 gregkh
  2017-06-13 12:12 ` yd_tseng
  0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2017-06-12 14:05 UTC (permalink / raw)
  To: yd_tseng, gregkh, mathias.nyman, stable


This is a note to let you know that I've just added the patch titled

    usb: xhci: Fix USB 3.1 supported protocol parsing

to my usb git tree which can be found at
    git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.

The patch will show up in the next release of the linux-next tree
(usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the
next -rc kernel release.

If you have any questions about this process, please let me know.


>From b72eb8435b25be3a1880264cf32ac91e626ba5ba Mon Sep 17 00:00:00 2001
From: YD Tseng <yd_tseng@asmedia.com.tw>
Date: Fri, 9 Jun 2017 14:48:40 +0300
Subject: usb: xhci: Fix USB 3.1 supported protocol parsing

xHCI host controllers can have both USB 3.1 and 3.0 extended speed
protocol lists. If the USB3.1 speed is parsed first and 3.0 second then
the minor revision supported will be overwritten by the 3.0 speeds and
the USB3 roothub will only show support for USB 3.0 speeds.

This was the case with a xhci controller with the supported protocol
capability listed below.
In xhci-mem.c, the USB 3.1 speed is parsed first, the min_rev of usb3_rhub
is set as 0x10.  And then USB 3.0 is parsed.  However, the min_rev of
usb3_rhub will be changed to 0x00. If USB 3.1 device is connected behind
this host controller, the speed of USB 3.1 device just reports 5G speed
using lsusb.

     00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
  00 01 08 00 00 00 00 00 40 00 00 00 00 00 00 00 00
  10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  20 02 08 10 03 55 53 42 20 01 02 00 00 00 00 00 00     //USB 3.1
  30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  40 02 08 00 03 55 53 42 20 03 06 00 00 00 00 00 00     //USB 3.0
  50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  60 02 08 00 02 55 53 42 20 09 0E 19 00 00 00 00 00     //USB 2.0
  70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

This patch fixes the issue by only owerwriting the minor revision if
it is higher than the existing one.

[reword commit message -Mathias]
Cc: <stable@vger.kernel.org>
Signed-off-by: YD Tseng <yd_tseng@asmedia.com.tw>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/host/xhci-mem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 1f1687e888d6..fddf2731f798 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -2119,11 +2119,12 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
 {
 	u32 temp, port_offset, port_count;
 	int i;
-	u8 major_revision;
+	u8 major_revision, minor_revision;
 	struct xhci_hub *rhub;
 
 	temp = readl(addr);
 	major_revision = XHCI_EXT_PORT_MAJOR(temp);
+	minor_revision = XHCI_EXT_PORT_MINOR(temp);
 
 	if (major_revision == 0x03) {
 		rhub = &xhci->usb3_rhub;
@@ -2137,7 +2138,9 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
 		return;
 	}
 	rhub->maj_rev = XHCI_EXT_PORT_MAJOR(temp);
-	rhub->min_rev = XHCI_EXT_PORT_MINOR(temp);
+
+	if (rhub->min_rev < minor_revision)
+		rhub->min_rev = minor_revision;
 
 	/* Port offset and count in the third dword, see section 7.2 */
 	temp = readl(addr + 2);
-- 
2.13.1

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

* RE: patch "usb: xhci: Fix USB 3.1 supported protocol parsing" added to usb-linus
  2017-06-12 14:05 patch "usb: xhci: Fix USB 3.1 supported protocol parsing" added to usb-linus gregkh
@ 2017-06-13 12:12 ` yd_tseng
  0 siblings, 0 replies; 2+ messages in thread
From: yd_tseng @ 2017-06-13 12:12 UTC (permalink / raw)
  To: gregkh, mathias.nyman; +Cc: stable

Hi Greg and Mathias,

Thanks for the hand.  :)

BRs,
YD

> -----Original Message-----
> From: gregkh@linuxfoundation.org [mailto:gregkh@linuxfoundation.org]
> Sent: Monday, June 12, 2017 10:06 PM
> To: yd_tseng@asmedia.com.tw; gregkh@linuxfoundation.org;
> mathias.nyman@linux.intel.com; stable@vger.kernel.org
> Subject: patch "usb: xhci: Fix USB 3.1 supported protocol parsing" added
to usb-
> linus
> 
> 
> This is a note to let you know that I've just added the patch titled
> 
>     usb: xhci: Fix USB 3.1 supported protocol parsing
> 
> to my usb git tree which can be found at
>     git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
> in the usb-linus branch.
> 
> The patch will show up in the next release of the linux-next tree (usually
> sometime within the next 24 hours during the week.)
> 
> The patch will hopefully also be merged in Linus's tree for the next -rc
kernel
> release.
> 
> If you have any questions about this process, please let me know.
> 
> 
> From b72eb8435b25be3a1880264cf32ac91e626ba5ba Mon Sep 17 00:00:00
> 2001
> From: YD Tseng <yd_tseng@asmedia.com.tw>
> Date: Fri, 9 Jun 2017 14:48:40 +0300
> Subject: usb: xhci: Fix USB 3.1 supported protocol parsing
> 
> xHCI host controllers can have both USB 3.1 and 3.0 extended speed
protocol
> lists. If the USB3.1 speed is parsed first and 3.0 second then the minor
revision
> supported will be overwritten by the 3.0 speeds and the USB3 roothub will
only
> show support for USB 3.0 speeds.
> 
> This was the case with a xhci controller with the supported protocol
capability
> listed below.
> In xhci-mem.c, the USB 3.1 speed is parsed first, the min_rev of usb3_rhub
is set
> as 0x10.  And then USB 3.0 is parsed.  However, the min_rev of usb3_rhub
will be
> changed to 0x00. If USB 3.1 device is connected behind this host
controller, the
> speed of USB 3.1 device just reports 5G speed using lsusb.
> 
>      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
>   00 01 08 00 00 00 00 00 40 00 00 00 00 00 00 00 00
>   10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>   20 02 08 10 03 55 53 42 20 01 02 00 00 00 00 00 00     //USB 3.1
>   30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>   40 02 08 00 03 55 53 42 20 03 06 00 00 00 00 00 00     //USB 3.0
>   50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>   60 02 08 00 02 55 53 42 20 09 0E 19 00 00 00 00 00     //USB 2.0
>   70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 
> This patch fixes the issue by only owerwriting the minor revision if it is
higher
> than the existing one.
> 
> [reword commit message -Mathias]
> Cc: <stable@vger.kernel.org>
> Signed-off-by: YD Tseng <yd_tseng@asmedia.com.tw>
> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/usb/host/xhci-mem.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index
> 1f1687e888d6..fddf2731f798 100644
> --- a/drivers/usb/host/xhci-mem.c
> +++ b/drivers/usb/host/xhci-mem.c
> @@ -2119,11 +2119,12 @@ static void xhci_add_in_port(struct xhci_hcd
*xhci,
> unsigned int num_ports,  {
>  	u32 temp, port_offset, port_count;
>  	int i;
> -	u8 major_revision;
> +	u8 major_revision, minor_revision;
>  	struct xhci_hub *rhub;
> 
>  	temp = readl(addr);
>  	major_revision = XHCI_EXT_PORT_MAJOR(temp);
> +	minor_revision = XHCI_EXT_PORT_MINOR(temp);
> 
>  	if (major_revision == 0x03) {
>  		rhub = &xhci->usb3_rhub;
> @@ -2137,7 +2138,9 @@ static void xhci_add_in_port(struct xhci_hcd *xhci,
> unsigned int num_ports,
>  		return;
>  	}
>  	rhub->maj_rev = XHCI_EXT_PORT_MAJOR(temp);
> -	rhub->min_rev = XHCI_EXT_PORT_MINOR(temp);
> +
> +	if (rhub->min_rev < minor_revision)
> +		rhub->min_rev = minor_revision;
> 
>  	/* Port offset and count in the third dword, see section 7.2 */
>  	temp = readl(addr + 2);
> --
> 2.13.1


==================================================================================================================
This email and any attachments to it contain confidential information and are intended solely for the use of the individual to whom it 
is addressed.If you are not the intended recipient or receive it accidentally, please immediately notify the sender by e-mail and delete 
the message and any attachments from your computer system, and destroy all hard copies. If any, please be advised that any unauthorized 
disclosure, copying, distribution or any action taken or omitted in reliance on this, is illegal and prohibited. Furthermore, any views 
or opinions expressed are solely those of the author and do not represent those of ASMedia Technology Inc. Thank you for your cooperation.
==================================================================================================================

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

end of thread, other threads:[~2017-06-13 12:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-12 14:05 patch "usb: xhci: Fix USB 3.1 supported protocol parsing" added to usb-linus gregkh
2017-06-13 12:12 ` yd_tseng

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