xhci: Rework how we handle unresponsive or hoptlug removed hosts
authorMathias Nyman <mathias.nyman@linux.intel.com>
Fri, 7 Apr 2017 14:57:01 +0000 (17:57 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 8 Apr 2017 10:17:41 +0000 (12:17 +0200)
commitd9f11ba9f107aa335091ab8d7ba5eea714e46e8b
treefdcd52b0fbd2fb43f2b27f210f380211e449b51f
parentfe190ed0d60260e44f48d8b0b04f26a8c8898a02
xhci: Rework how we handle unresponsive or hoptlug removed hosts

Introduce a new xhci_hc_died() function that takes care of handling
pending commands and URBs if a host controller becomes unresponsive.

This addresses issues on hotpluggable xhci controllers that disappear
from the bus suddenly, often while the bus (PCI) remove function is
still being processed.

xhci_hc_died() sets a XHCI_STATUS_DYING flag to prevent new URBs and
commands or to be queued. The flag also ensures xhci_hc_died() will
give back pending commands and URBs once.

Host is considered dead if register read returns 0xffffffff, or host
fails to abort the command ring, or fails stopping an endpoint after
trying for 5 seconds.

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-hub.c
drivers/usb/host/xhci-ring.c
drivers/usb/host/xhci.c
drivers/usb/host/xhci.h