summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-02-19 14:38:33 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-02-20 12:07:03 +0100
commit3b3af837338f199fae38627ea0b9467a931cf784 (patch)
tree50592fc23abefdb2f4fcae18cac4ab254dbfbc80
parent0a2bf109353e092acbcdd6a864c41526d7b761dd (diff)
downloadbarebox-3b3af837338f.tar.gz
barebox-3b3af837338f.tar.xz
usb: xhci: Allow context state errors when halting an endpoint
This ports U-Boot commit 6f64f0ae230f9e8f68c5d9bf56ffee438fa60a6a: | Author: Hector Martin <marcan@marcan.st> | AuthorDate: Sun Oct 29 15:37:40 2023 +0900 | | usb: xhci: Allow context state errors when halting an endpoint | | There is a race where an endpoint may halt by itself while we are trying | to halt it, which results in a context state error. See xHCI 4.6.9 which | mentions this case. | | This also avoids BUGging when we attempt to stop an endpoint which was | already stopped to begin with, which is probably a bug elsewhere but | not a good reason to crash. | | Signed-off-by: Hector Martin <marcan@marcan.st> | Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240219133835.3886399-14-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/usb/host/xhci-ring.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 23357a8825..1b9a5b7867 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -550,6 +550,7 @@ static void abort_td(struct usb_device *udev, int ep_index)
struct xhci_ctrl *ctrl = xhci_get_ctrl(udev);
struct xhci_ring *ring = ctrl->devs[udev->slot_id]->eps[ep_index].ring;
union xhci_trb *event;
+ xhci_comp_code comp;
trb_type type;
dma_addr_t addr;
u32 field;
@@ -578,10 +579,11 @@ static void abort_td(struct usb_device *udev, int ep_index)
dev_warn(ctrl->dev, "abort_td: Expected a TRB_TRANSFER TRB first\n");
}
+ comp = GET_COMP_CODE(le32_to_cpu(event->event_cmd.status));
BUG_ON(type != TRB_COMPLETION ||
TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags))
- != udev->slot_id || GET_COMP_CODE(le32_to_cpu(
- event->event_cmd.status)) != COMP_SUCCESS);
+ != udev->slot_id || (comp != COMP_SUCCESS && comp
+ != COMP_CTX_STATE));
xhci_acknowledge_event(ctrl);
addr = xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue);