diff mbox series

fix: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller

Message ID 20220925172236.2288-1-jens.glathe@oldschoolsolutions.biz
State New
Headers show
Series fix: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller | expand

Commit Message

Jens Glathe Sept. 25, 2022, 5:22 p.m. UTC
only if it reports as a V0.96 XHCI controller. Appears to fix the errors
"xhci_hcd <address>; ERROR Transfer event TRB DMA ptr not part of
current TD ep_index 2 comp_code 13" that appear spuriously (or pretty
often) when using a r8152 USB3 ethernet adapter with integrated hub.

Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
---
 drivers/usb/host/xhci-pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Mathias Nyman Sept. 26, 2022, 11:31 a.m. UTC | #1
Hi

Thanks for the patch, some small changes still needed:

Include subsystem in subject line, something like
usb: xhci: Add XHCI_SPURIOUS...

On 25.9.2022 20.22, Jens Glathe wrote:
> only if it reports as a V0.96 XHCI controller. Appears to fix the errors
> "xhci_hcd <address>; ERROR Transfer event TRB DMA ptr not part of
> current TD ep_index 2 comp_code 13" that appear spuriously (or pretty
> often) when using a r8152 USB3 ethernet adapter with integrated hub.
> 
> Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
> ---
>   drivers/usb/host/xhci-pci.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index dce6c0ec8d34..d1b8e7148dd1 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -306,8 +306,12 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
>   	}
>   
>   	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
> -		pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI)
> +		pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) {
> +		/* try to tame the ASMedia 1042 controller which is 0.96 */
> +		if (xhci->hci_version == 0x96)

Do we need this 0x96 check? It's anyway set for 1.0 and newer controllers

> +			xhci->quirks |= XHCI_SPURIOUS_SUCCESS;

This reminds me that I should get rid of this quirk.

If we get a short transfers event for a TRB mid TD, then xhci hosts version 1.0 and later
should send a second event for the last TRB in the TD

so this is default behavior for modern xHCI, not a spurious event.

But your patch is anyways needed for stable kernels.

Thanks
-Mathias
Alan Stern Sept. 26, 2022, 3:18 p.m. UTC | #2
On Mon, Sep 26, 2022 at 02:31:42PM +0300, Mathias Nyman wrote:
> Hi
> 
> Thanks for the patch, some small changes still needed:
> 
> Include subsystem in subject line, something like
> usb: xhci: Add XHCI_SPURIOUS...

And don't forget to include a revision number inside the []'s on the 
Subject line for all revised submissions.

> On 25.9.2022 20.22, Jens Glathe wrote:
> > only if it reports as a V0.96 XHCI controller. Appears to fix the errors

It would be nice if the first sentence (not to mention the later ones) 
of the patch description actually was a complete sentence.  I realize 
that lots of commits don't bother to do this, but IMNSHO they ought to.

> > "xhci_hcd <address>; ERROR Transfer event TRB DMA ptr not part of
> > current TD ep_index 2 comp_code 13" that appear spuriously (or pretty
> > often) when using a r8152 USB3 ethernet adapter with integrated hub.
> > 
> > Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
> > ---

Likewise, for resubmissions don't forget to include a quick description 
here (just below the "---" line) of how the resubmission differs from 
the earlier versions.

Alan Stern
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index dce6c0ec8d34..d1b8e7148dd1 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -306,8 +306,12 @@  static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 	}
 
 	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
-		pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI)
+		pdev->device == PCI_DEVICE_ID_ASMEDIA_1042_XHCI) {
+		/* try to tame the ASMedia 1042 controller which is 0.96 */
+		if (xhci->hci_version == 0x96)
+			xhci->quirks |= XHCI_SPURIOUS_SUCCESS;
 		xhci->quirks |= XHCI_BROKEN_STREAMS;
+	}
 	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
 		pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) {
 		xhci->quirks |= XHCI_TRUST_TX_LENGTH;