From: Michal Pecio <michal.pecio@gmail.com>
To: Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/6] xHCI: endpoint state maintainability and small fixes
Date: Mon, 10 Mar 2025 09:36:05 +0100 [thread overview]
Message-ID: <20250310093605.2b3d0425@foxbook> (raw)
These patches are mostly independent, except
- 2/6 depends on 1/6
- 6/6 depends on 4/5 and 5/6
It is assumed that issues with EP_STALLED are resolved like below.
They document assumptions currently made by xhci_urb_dequeue() and
xhci_handle_cmd_stop_ep() and clean up this code a little to make it
more maintainable.
Some potential issues with no known significant impact are fixed.
I haven't tagged them for stable. Maybe 5/6 could go, just in case?
Michal
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1770,7 +1770,7 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
}
/* In this case no commands are pending but the endpoint is stopped */
- if (ep->ep_state & EP_CLEARING_TT) {
+ if (ep->ep_state & (EP_CLEARING_TT | EP_STALLED)) {
/* and cancelled TDs can be given back right away */
xhci_dbg(xhci, "Invalidating TDs instantly on slot %d ep %d in state 0x%x\n",
urb->dev->slot_id, ep_index, ep->ep_state);
@@ -3207,10 +3207,14 @@ static void xhci_endpoint_reset(struct usb_hcd *hcd,
return;
ep = &vdev->eps[ep_index];
+
+ spin_lock_irqsave(&xhci->lock, flags);
+
+ /* Unblock the endpoint as device side is unstalled now */
ep->ep_state &= ~EP_STALLED;
+ xhci_ring_doorbell_for_active_rings(xhci, udev->slot_id, ep_index);
/* Bail out if toggle is already being cleared by a endpoint reset */
- spin_lock_irqsave(&xhci->lock, flags);
if (ep->ep_state & EP_HARD_CLEAR_TOGGLE) {
ep->ep_state &= ~EP_HARD_CLEAR_TOGGLE;
spin_unlock_irqrestore(&xhci->lock, flags);
Michal Pecio (6):
usb: xhci: Document endpoint state management
usb: xhci: Deduplicate some endpoint state flag lists
usb: xhci: Only set EP_HARD_CLEAR_TOGGLE after queuing Reset Endpoint
usb: xhci: Don't change the status of stalled TDs on failed Stop EP
usb: xhci: Avoid Stop Endpoint retry loop if the endpoint seems
Running
usb: xhci: Update comments about Stop Endpoint races
drivers/usb/host/xhci-ring.c | 102 ++++++++++++++++++++---------------
drivers/usb/host/xhci.c | 16 ++++--
drivers/usb/host/xhci.h | 58 +++++++++++++++-----
3 files changed, 115 insertions(+), 61 deletions(-)
--
2.48.1
next reply other threads:[~2025-03-10 8:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 8:36 Michal Pecio [this message]
2025-03-10 8:36 ` [PATCH 1/6] usb: xhci: Document endpoint state management Michal Pecio
2025-03-10 9:25 ` Mathias Nyman
2025-03-10 8:37 ` [PATCH 2/6] usb: xhci: Deduplicate some endpoint state flag lists Michal Pecio
2025-03-10 9:51 ` Mathias Nyman
2025-03-11 0:13 ` Michał Pecio
2025-03-10 8:38 ` [PATCH 3/6] usb: xhci: Only set EP_HARD_CLEAR_TOGGLE after queuing Reset Endpoint Michal Pecio
2025-03-10 8:39 ` usb: xhci: Don't change the status of stalled TDs on failed Stop EP Michal Pecio
2025-03-10 8:43 ` Michal Pecio
2025-03-10 8:40 ` [PATCH 4/6] " Michal Pecio
2025-03-10 13:54 ` Mathias Nyman
2025-03-10 8:41 ` [PATCH 5/6] usb: xhci: Avoid Stop Endpoint retry loop if the endpoint seems Running Michal Pecio
2025-03-10 8:42 ` [PATCH 6/6] usb: xhci: Update comments about Stop Endpoint races Michal Pecio
2025-03-11 15:41 ` [PATCH 0/6] xHCI: endpoint state maintainability and small fixes Mathias Nyman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250310093605.2b3d0425@foxbook \
--to=michal.pecio@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.