• Sarah Sharp's avatar
    xhci: Don't submit commands or URBs to halted hosts. · 7bd89b40
    Sarah Sharp authored
    Commit fccf4e86
    "USB: Free bandwidth when usb_disable_device is called" caused a bit of an
    issue when the xHCI host controller driver is unloaded.  It changed the
    USB core to remove all endpoints when a USB device is disabled.  When the
    driver is unloaded, it will remove the SuperSpeed split root hub, which
    will disable all devices under that roothub and then halt the host
    controller.  When the second High Speed split roothub is removed, the USB
    core will attempt to disable the endpoints, which will submit a Configure
    Endpoint command to a halted host controller.
    
    The command will eventually time out, but it makes the xHCI driver unload
    take *minutes* if there are a couple of USB 1.1/2.0 devices attached.  We
    must halt the host controller when the SuperSpeed roothub is removed,
    because we can't allow any interrupts from things like port status
    changes.
    
    Make several different functions not submit commands or URBs to the host
    controller when the host is halted, by adding a check in
    xhci_check_args().  xhci_check_args() is used by these functions:
    
    xhci.c-int xhci_urb_enqueue()
    xhci.c-int xhci_drop_endpoint()
    xhci.c-int xhci_add_endpoint()
    xhci.c-int xhci_check_bandwidth()
    xhci.c-void xhci_reset_bandwidth()
    xhci.c-static int xhci_check_streams_endpoint()
    xhci.c-int xhci_discover_or_reset_device()
    
    It's also used by xhci_free_dev().  However, we have to take special
    care in that case, because we want the device memory to be freed if the
    host controller is halted.
    
    This patch should be backported to the 2.6.39 and 3.0 kernel.
    Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
    Cc: stable@kernel.org
    7bd89b40
xhci.c 94.1 KB