This is a note to let you know that I've just added the patch titled

    xhci: Don't write zeroed pointers to xHC registers.

to the 3.0-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xhci-don-t-write-zeroed-pointers-to-xhc-registers.patch
and it can be found in the queue-3.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 159e1fcc9a60fc7daba23ee8fcdb99799de3fe84 Mon Sep 17 00:00:00 2001
From: Sarah Sharp <[email protected]>
Date: Fri, 16 Mar 2012 13:09:39 -0700
Subject: xhci: Don't write zeroed pointers to xHC registers.

From: Sarah Sharp <[email protected]>

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 <[email protected]>
Tested-by: Elric Fu <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/usb/host/xhci-mem.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1509,11 +1509,6 @@ void xhci_mem_cleanup(struct xhci_hcd *x
        int i;
 
        /* Free the Event Ring Segment Table and the actual Event Ring */
-       if (xhci->ir_set) {
-               xhci_writel(xhci, 0, &xhci->ir_set->erst_size);
-               xhci_write_64(xhci, 0, &xhci->ir_set->erst_base);
-               xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue);
-       }
        size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries);
        if (xhci->erst.entries)
                pci_free_consistent(pdev, size,
@@ -1525,7 +1520,6 @@ void xhci_mem_cleanup(struct xhci_hcd *x
        xhci->event_ring = NULL;
        xhci_dbg(xhci, "Freed event ring\n");
 
-       xhci_write_64(xhci, 0, &xhci->op_regs->cmd_ring);
        if (xhci->cmd_ring)
                xhci_ring_free(xhci, xhci->cmd_ring);
        xhci->cmd_ring = NULL;
@@ -1554,7 +1548,6 @@ void xhci_mem_cleanup(struct xhci_hcd *x
        xhci->medium_streams_pool = NULL;
        xhci_dbg(xhci, "Freed medium stream array pool\n");
 
-       xhci_write_64(xhci, 0, &xhci->op_regs->dcbaa_ptr);
        if (xhci->dcbaa)
                pci_free_consistent(pdev, sizeof(*xhci->dcbaa),
                                xhci->dcbaa, xhci->dcbaa->dma);
@@ -2123,6 +2116,8 @@ int xhci_mem_init(struct xhci_hcd *xhci,
 
 fail:
        xhci_warn(xhci, "Couldn't initialize memory\n");
+       xhci_halt(xhci);
+       xhci_reset(xhci);
        xhci_mem_cleanup(xhci);
        return -ENOMEM;
 }


Patches currently in stable-queue which might be from 
[email protected] are

queue-3.0/xhci-don-t-re-enable-ie-constantly.patch
queue-3.0/xhci-correct-the-define-xhci_legacy_disable_smi.patch
queue-3.0/xhci-don-t-write-zeroed-pointers-to-xhc-registers.patch
queue-3.0/xhci-restore-event-ring-dequeue-pointer-on-resume.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to