Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit b099ce3b authored by Julius Werner's avatar Julius Werner Committed by Hemant Kumar
Browse files

usb: xhci: Fix Command Ring Stopped Event handling



The current XHCI code treats a command completion event with the
COMP_CMD_STOP code as a slightly different version of COMP_CMD_ABORT. In
particular, it puts the pointed-to command TRB through the normal
command completion handlers. This is not how this event works.

As XHCI spec 4.6.1.1 describes, unlike other command completion events
Command Ring Stopped sets the Command TRB Pointer to the *current*
Command Ring Dequeue Pointer. This is the command TRB that the XHCI will
execute next, and not a command that has already been executed. The
driver's internal command ring dequeue pointer should not be increased
after this event, since it does not really mark a command completion...
it's just a hint for the driver that execution is stopped now and where
it will be picked up again if the ring gets restarted.

This patch gets rid of the handle_stopped_command_ring() function and
splits its behavior into two distinct parts for COMP_CMD_STOP and
COMP_CMD_ABORT events. It ensures that the former no longer messes with
the dequeue pointer, while the latter's behavior is unchanged. This
prevents the hardware and software dequeue pointer from going out of
sync during command cancellations, which can lead to a variety of
problems (up to a total HCD death if the next command after the one that
was cancelled is Stop Endpoint, and the stop_endpoint_watchdog won't see
the command's completion because it got skipped by the software dequeue
pointer).

BUG=chrome-os-partner:19579
TEST=Manual

This patch can be dropped when we rebase onto upstream's new global
command queue rework (in particular "xhci: rework command timeout and
cancellation") which will probably go into 3.15.

Change-Id: Ia30e6fa7fd24908fbb8f48dd9f2d6fa3f6db4a75
Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186091


Reviewed-by: default avatarVincent Palatin <vpalatin@chromium.org>
Git-commit: 1ebfca337a6095e23b942196781c5ef030a13898
Git-repo: https://chromium.googlesource.com/chromiumos/third_party/kernel-next


CRs-Fixed: 671440
[hemantk@codeaurora.org: amended the subject line of the commit text]
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent 60d75479
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment