Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] xhci: enable XHCI_TRUST_TX_LENGTH quirk for ThunderX2 builtin hosts
@ 2019-11-27 15:30 Ard Biesheuvel
  2019-11-27 15:58 ` Mathias Nyman
  0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2019-11-27 15:30 UTC (permalink / raw)
  To: linux-usb; +Cc: mathias.nyman, gregkh, Ard Biesheuvel

When using a USB webcam on a ThunderX2 workstation, the kernel log
gets flooded with messages like

  xhci_hcd 0000:00:0f.0:
  WARN Successful completion on short TX for slot 7 ep 2: needs XHCI_TRUST_TX_LENGTH quirk?

Enabling the quirk manually makes the issue go away, so let's enable
it unconditionally for this hardware.

Cc: <stable@vger.kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/usb/host/xhci-pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 1e0236e90687..331b5900dd72 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -256,7 +256,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	if ((pdev->vendor == PCI_VENDOR_ID_BROADCOM ||
 	     pdev->vendor == PCI_VENDOR_ID_CAVIUM) &&
 	     pdev->device == 0x9026)
-		xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT;
+		xhci->quirks |= XHCI_RESET_PLL_ON_DISCONNECT |
+				XHCI_TRUST_TX_LENGTH;
 
 	if (xhci->quirks & XHCI_RESET_ON_RESUME)
 		xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
-- 
2.20.1


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

* Re: [PATCH] xhci: enable XHCI_TRUST_TX_LENGTH quirk for ThunderX2 builtin hosts
  2019-11-27 15:30 [PATCH] xhci: enable XHCI_TRUST_TX_LENGTH quirk for ThunderX2 builtin hosts Ard Biesheuvel
@ 2019-11-27 15:58 ` Mathias Nyman
  2019-11-27 16:16   ` Ard Biesheuvel
  0 siblings, 1 reply; 4+ messages in thread
From: Mathias Nyman @ 2019-11-27 15:58 UTC (permalink / raw)
  To: Ard Biesheuvel, linux-usb; +Cc: mathias.nyman, gregkh

On 27.11.2019 17.30, Ard Biesheuvel wrote:
> When using a USB webcam on a ThunderX2 workstation, the kernel log
> gets flooded with messages like
> 
>    xhci_hcd 0000:00:0f.0:
>    WARN Successful completion on short TX for slot 7 ep 2: needs XHCI_TRUST_TX_LENGTH quirk?
> 
> Enabling the quirk manually makes the issue go away, so let's enable
> it unconditionally for this hardware.
> 

This issue starts to be common for many vendors, many report successful
completions after a initial short transfer in a TD

Does the patch below help in your case? It worked for a Renesas controller
with similar issues. It's a more generic solution.
  
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 9ebaa8e132a9..d23f7408c81f 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2381,7 +2381,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
         case COMP_SUCCESS:
                 if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
                         break;
-               if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
+               if (xhci->quirks & XHCI_TRUST_TX_LENGTH ||
+                   ep_ring->last_td_was_short)
                         trb_comp_code = COMP_SHORT_PACKET;
                 else
                         xhci_warn_ratelimited(xhci,

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

* Re: [PATCH] xhci: enable XHCI_TRUST_TX_LENGTH quirk for ThunderX2 builtin hosts
  2019-11-27 15:58 ` Mathias Nyman
@ 2019-11-27 16:16   ` Ard Biesheuvel
  2019-11-28 14:36     ` Mathias Nyman
  0 siblings, 1 reply; 4+ messages in thread
From: Ard Biesheuvel @ 2019-11-27 16:16 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: Ard Biesheuvel, linux-usb, Mathias Nyman, Greg Kroah-Hartman

On Wed, 27 Nov 2019 at 16:56, Mathias Nyman
<mathias.nyman@linux.intel.com> wrote:
>
> On 27.11.2019 17.30, Ard Biesheuvel wrote:
> > When using a USB webcam on a ThunderX2 workstation, the kernel log
> > gets flooded with messages like
> >
> >    xhci_hcd 0000:00:0f.0:
> >    WARN Successful completion on short TX for slot 7 ep 2: needs XHCI_TRUST_TX_LENGTH quirk?
> >
> > Enabling the quirk manually makes the issue go away, so let's enable
> > it unconditionally for this hardware.
> >
>
> This issue starts to be common for many vendors, many report successful
> completions after a initial short transfer in a TD
>
> Does the patch below help in your case? It worked for a Renesas controller
> with similar issues. It's a more generic solution.
>
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index 9ebaa8e132a9..d23f7408c81f 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -2381,7 +2381,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
>          case COMP_SUCCESS:
>                  if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
>                          break;
> -               if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
> +               if (xhci->quirks & XHCI_TRUST_TX_LENGTH ||
> +                   ep_ring->last_td_was_short)
>                          trb_comp_code = COMP_SHORT_PACKET;
>                  else
>                          xhci_warn_ratelimited(xhci,

Yes, that works too. If you roll that into a patch

Tested-by: Ard Biesheuvel <ardb@kernel.org>

and please consider cc'ing stable as well.

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

* Re: [PATCH] xhci: enable XHCI_TRUST_TX_LENGTH quirk for ThunderX2 builtin hosts
  2019-11-27 16:16   ` Ard Biesheuvel
@ 2019-11-28 14:36     ` Mathias Nyman
  0 siblings, 0 replies; 4+ messages in thread
From: Mathias Nyman @ 2019-11-28 14:36 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Ard Biesheuvel, linux-usb, Mathias Nyman, Greg Kroah-Hartman

On 27.11.2019 18.16, Ard Biesheuvel wrote:
> On Wed, 27 Nov 2019 at 16:56, Mathias Nyman
> <mathias.nyman@linux.intel.com> wrote:
>>
>> On 27.11.2019 17.30, Ard Biesheuvel wrote:
>>> When using a USB webcam on a ThunderX2 workstation, the kernel log
>>> gets flooded with messages like
>>>
>>>     xhci_hcd 0000:00:0f.0:
>>>     WARN Successful completion on short TX for slot 7 ep 2: needs XHCI_TRUST_TX_LENGTH quirk?
>>>
>>> Enabling the quirk manually makes the issue go away, so let's enable
>>> it unconditionally for this hardware.
>>>
>>
>> This issue starts to be common for many vendors, many report successful
>> completions after a initial short transfer in a TD
>>
>> Does the patch below help in your case? It worked for a Renesas controller
>> with similar issues. It's a more generic solution.
>>
>> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
>> index 9ebaa8e132a9..d23f7408c81f 100644
>> --- a/drivers/usb/host/xhci-ring.c
>> +++ b/drivers/usb/host/xhci-ring.c
>> @@ -2381,7 +2381,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
>>           case COMP_SUCCESS:
>>                   if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
>>                           break;
>> -               if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
>> +               if (xhci->quirks & XHCI_TRUST_TX_LENGTH ||
>> +                   ep_ring->last_td_was_short)
>>                           trb_comp_code = COMP_SHORT_PACKET;
>>                   else
>>                           xhci_warn_ratelimited(xhci,
> 
> Yes, that works too. If you roll that into a patch
> 
> Tested-by: Ard Biesheuvel <ardb@kernel.org>
> 
> and please consider cc'ing stable as well.
> 

Will do, thanks

-Mathias

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 15:30 [PATCH] xhci: enable XHCI_TRUST_TX_LENGTH quirk for ThunderX2 builtin hosts Ard Biesheuvel
2019-11-27 15:58 ` Mathias Nyman
2019-11-27 16:16   ` Ard Biesheuvel
2019-11-28 14:36     ` Mathias Nyman

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org
	public-inbox-index linux-usb

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git