Patch "xhci: Fix control transfer error on Etron xHCI host" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

    xhci: Fix control transfer error on Etron xHCI host

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xhci-fix-control-transfer-error-on-etron-xhci-host.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a9a30ba698f399159bd9210f15f94e7f3ca2ab68
Author: Kuangyi Chiang <ki.chiang65@xxxxxxxxx>
Date:   Wed Nov 6 12:14:45 2024 +0200

    xhci: Fix control transfer error on Etron xHCI host
    
    [ Upstream commit 5e1c67abc9301d05130b7e267c204e7005503b33 ]
    
    Performing a stability stress test on a USB3.0 2.5G ethernet adapter
    results in errors like this:
    
    [   91.441469] r8152 2-3:1.0 eth3: get_registers -71
    [   91.458659] r8152 2-3:1.0 eth3: get_registers -71
    [   91.475911] r8152 2-3:1.0 eth3: get_registers -71
    [   91.493203] r8152 2-3:1.0 eth3: get_registers -71
    [   91.510421] r8152 2-3:1.0 eth3: get_registers -71
    
    The r8152 driver will periodically issue lots of control-IN requests
    to access the status of ethernet adapter hardware registers during
    the test.
    
    This happens when the xHCI driver enqueue a control TD (which cross
    over the Link TRB between two ring segments, as shown) in the endpoint
    zero's transfer ring. Seems the Etron xHCI host can not perform this
    TD correctly, causing the USB transfer error occurred, maybe the upper
    driver retry that control-IN request can solve problem, but not all
    drivers do this.
    
    |     |
    -------
    | TRB | Setup Stage
    -------
    | TRB | Link
    -------
    -------
    | TRB | Data Stage
    -------
    | TRB | Status Stage
    -------
    |     |
    
    To work around this, the xHCI driver should enqueue a No Op TRB if
    next available TRB is the Link TRB in the ring segment, this can
    prevent the Setup and Data Stage TRB to be breaked by the Link TRB.
    
    Check if the XHCI_ETRON_HOST quirk flag is set before invoking the
    workaround in xhci_queue_ctrl_tx().
    
    Fixes: d0e96f5a71a0 ("USB: xhci: Control transfer support.")
    Cc: stable@xxxxxxxxxxxxxxx
    Signed-off-by: Kuangyi Chiang <ki.chiang65@xxxxxxxxx>
    Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241106101459.775897-20-mathias.nyman@xxxxxxxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 99759926daac6..50f5880114004 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -3828,6 +3828,20 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
 	if (!urb->setup_packet)
 		return -EINVAL;
 
+	if ((xhci->quirks & XHCI_ETRON_HOST) &&
+	    urb->dev->speed >= USB_SPEED_SUPER) {
+		/*
+		 * If next available TRB is the Link TRB in the ring segment then
+		 * enqueue a No Op TRB, this can prevent the Setup and Data Stage
+		 * TRB to be breaked by the Link TRB.
+		 */
+		if (trb_is_link(ep_ring->enqueue + 1)) {
+			field = TRB_TYPE(TRB_TR_NOOP) | ep_ring->cycle_state;
+			queue_trb(xhci, ep_ring, false, 0, 0,
+					TRB_INTR_TARGET(0), field);
+		}
+	}
+
 	/* 1 TRB for setup, 1 for status */
 	num_trbs = 2;
 	/*




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux