UPSTREAM: xHCI: add aborting command ring function
authorElric Fu <elricfu1@gmail.com>
Wed, 27 Jun 2012 08:31:12 +0000 (16:31 +0800)
committerChromeBot <chrome-bot@google.com>
Fri, 22 Mar 2013 01:02:16 +0000 (18:02 -0700)
commita985d873dade9e455eea62fc6aafa2de2e8a58bf
treeda7c1029c182d7be70e9bc6ce18506dc4d3fb89d
parentb53116b1516e37d9c07baf7636c5d5d3f3a8a7c5
UPSTREAM: xHCI: add aborting command ring function

commit b92cc66c047ff7cf587b318fe377061a353c120f upstream.

Software have to abort command ring and cancel command
when a command is failed or hang. Otherwise, the command
ring will hang up and can't handle the others. An example
of a command that may hang is the Address Device Command,
because waiting for a SET_ADDRESS request to be acknowledged
by a USB device is outside of the xHC's ability to control.

To cancel a command, software will initialize a command
descriptor for the cancel command, and add it into a
cancel_cmd_list of xhci.

Sarah: Fixed missing newline on "Have the command ring been stopped?"
debugging statement.

This patch should be backported to kernels as old as 3.0, that contain
the commit 7ed603ecf8b68ab81f4c83097d3063d43ec73bb8 "xhci: Add an
assertion to check for virt_dev=0 bug." That commit papers over a NULL
pointer dereference, and this patch fixes the underlying issue that
caused the NULL pointer dereference.

Signed-off-by: Elric Fu <elricfu1@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by: Miroslav Sabljic <miroslav.sabljic@avl.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2818247b6565b7adfbcd53b74509448a8e1fad84)

BUG=None
TEST=Together with other cherry-picks: run BVT trybots on all platforms,
manually confirm that USB network/storage/input devices still work
(including across suspend/resume)

Change-Id: Iac376fec030eae1d2f85598c48fc136080fac129
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46059
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
drivers/usb/host/xhci-mem.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.c
drivers/usb/host/xhci.h