xhci: Don't write zeroed pointers to xHC registers.
authorSarah Sharp <sarah.a.sharp@linux.intel.com>
Fri, 16 Mar 2012 20:09:39 +0000 (13:09 -0700)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 30 Apr 2012 18:15:09 +0000 (19:15 +0100)
commit4db62cb8b0f02da23045deaf20c51f1195d63a1c
tree4c0329845aef1db704e455bd9e3e809ef5645e0b
parent1ec6241bce2006215f21eca184587014fde0f7a7
xhci: Don't write zeroed pointers to xHC registers.

BugLink: http://bugs.launchpad.net/bugs/987337

commit 159e1fcc9a60fc7daba23ee8fcdb99799de3fe84 upstream.

When xhci_mem_cleanup() is called, we can't be sure if the xHC is
actually halted.  We can ask the xHC to halt by writing to the RUN bit
in the command register, but that might timeout due to a HW hang.

If the host controller is still running, we should not write zeroed
values to the event ring dequeue pointers or base tables, the DCBAA
pointers, or the command ring pointers.  Eric Fu reports his VIA VL800
host accesses the event ring pointers after a failed register restore on
resume from suspend.  The hypothesis is that the host never actually
halted before the register write to change the event ring pointer to
zero.

Remove all writes of zeroed values to pointer registers in
xhci_mem_cleanup().  Instead, make all callers of the function reset the
host controller first, which will reset those registers to zero.
xhci_mem_init() is the only caller that doesn't first halt and reset the
host controller before calling xhci_mem_cleanup().

This should be backported to kernels as old as 2.6.32.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Tested-by: Elric Fu <elricfu1@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/usb/host/xhci-mem.c