• Sarah Sharp's avatar
    xhci: Don't write zeroed pointers to xHC registers. · 159e1fcc
    Sarah Sharp authored
    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: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
    Tested-by: default avatarElric Fu <elricfu1@gmail.com>
    Cc: stable@vger.kernel.org
    159e1fcc
xhci-mem.c 73.6 KB