Revert "usb: xhci: Limit Stop Endpoint retries"

This reverts commit ae1a08850a which is
commit 42b7581376015c1bbcbe5831f043cd0ac119d028 upstream.

It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed.

Bug: 161946584
Change-Id: Id33b40e8d8ba8ba5c0cdb624f60a4ec630a106da
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2025-01-11 07:04:49 +00:00
parent 0ab35d883a
commit 50cda709eb
3 changed files with 4 additions and 27 deletions

View File

@@ -52,7 +52,6 @@
* endpoint rings; it generates events on the event ring for these. * endpoint rings; it generates events on the event ring for these.
*/ */
#include <linux/jiffies.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
@@ -1158,35 +1157,16 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,
return; return;
case EP_STATE_STOPPED: case EP_STATE_STOPPED:
/* /*
* Per xHCI 4.6.9, Stop Endpoint command on a Stopped * NEC uPD720200 sometimes sets this state and fails with
* EP is a Context State Error, and EP stays Stopped. * Context Error while continuing to process TRBs.
* * Be conservative and trust EP_CTX_STATE on other chips.
* But maybe it failed on Halted, and somebody ran Reset
* Endpoint later. EP state is now Stopped and EP_HALTED
* still set because Reset EP handler will run after us.
*/
if (ep->ep_state & EP_HALTED)
break;
/*
* On some HCs EP state remains Stopped for some tens of
* us to a few ms or more after a doorbell ring, and any
* new Stop Endpoint fails without aborting the restart.
* This handler may run quickly enough to still see this
* Stopped state, but it will soon change to Running.
*
* Assume this bug on unexpected Stop Endpoint failures.
* Keep retrying until the EP starts and stops again, on
* chips where this is known to help. Wait for 100ms.
*/ */
if (!(xhci->quirks & XHCI_NEC_HOST)) if (!(xhci->quirks & XHCI_NEC_HOST))
break; break;
if (time_is_before_jiffies(ep->stop_time + msecs_to_jiffies(100)))
break;
fallthrough; fallthrough;
case EP_STATE_RUNNING: case EP_STATE_RUNNING:
/* Race, HW handled stop ep cmd before ep was running */ /* Race, HW handled stop ep cmd before ep was running */
xhci_dbg(xhci, "Stop ep completion ctx error, ctx_state %d\n", xhci_dbg(xhci, "Stop ep completion ctx error, ep is running\n");
GET_EP_CTX_STATE(ep_ctx));
command = xhci_alloc_command(xhci, false, GFP_ATOMIC); command = xhci_alloc_command(xhci, false, GFP_ATOMIC);
if (!command) { if (!command) {

View File

@@ -8,7 +8,6 @@
* Some code borrowed from the Linux EHCI driver. * Some code borrowed from the Linux EHCI driver.
*/ */
#include <linux/jiffies.h>
#include <linux/pci.h> #include <linux/pci.h>
#ifndef __GENKSYMS__ /* ANDROID: KABI CRC preservation hack */ #ifndef __GENKSYMS__ /* ANDROID: KABI CRC preservation hack */
#include <linux/iommu.h> #include <linux/iommu.h>
@@ -1929,7 +1928,6 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
ret = -ENOMEM; ret = -ENOMEM;
goto done; goto done;
} }
ep->stop_time = jiffies;
ep->ep_state |= EP_STOP_CMD_PENDING; ep->ep_state |= EP_STOP_CMD_PENDING;
xhci_queue_stop_endpoint(xhci, command, urb->dev->slot_id, xhci_queue_stop_endpoint(xhci, command, urb->dev->slot_id,
ep_index, 0); ep_index, 0);

View File

@@ -971,7 +971,6 @@ struct xhci_virt_ep {
/* Bandwidth checking storage */ /* Bandwidth checking storage */
struct xhci_bw_info bw_info; struct xhci_bw_info bw_info;
struct list_head bw_endpoint_list; struct list_head bw_endpoint_list;
unsigned long stop_time;
/* Isoch Frame ID checking storage */ /* Isoch Frame ID checking storage */
int next_frame_id; int next_frame_id;
/* Use new Isoch TRB layout needed for extended TBC support */ /* Use new Isoch TRB layout needed for extended TBC support */