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:Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/186091 Reviewed-by:
Vincent 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:
Hemant Kumar <hemantk@codeaurora.org>
Loading
Please register or sign in to comment