Re: xhci: WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.

Michał Pecio
2025-04-07T05:49:12Z

On Sun, 6 Apr 2025 15:26:41 -0400, Alan Stern wrote:
> I'd guess that you're seeing the result of the
>
> usb_disable_interface(udev, intf, true);
>
> call in usb_reset_and_verify_device(). This call is made following
> the actual reset, as part of the procedure for putting everything
> back to the way it was before the reset.

Your guess is right. I added dump_stack() to those calls.

The bug is triggered by this function calling usb_disable_interface()
and usb_enable_interface() after usb_hcd_alloc_bandwidth().

These two issue endpoint_disable() and endpoint_reset() to the HCD and
xhci_hcd appears to be confused about the intent of the former, because
it clears host_ep->hcpriv, breaking all future endpoint_reset() calls.

Since 6.15, this call informs xhci_hcd that device endpoint has been
cleared and pending URBs can be started, so this isn't working now.

BTW, that's not a corner of the driver which I'm very familiar with,
but AFAIU this disable/enable sequence is pointless for xHCI if done
on freshly created endpoints. It would only wait for clearing TT to
finish (there should be none) and issue some commands to clear the
toggle/sequence state (which should be blank).

Michal