From: Greg Kroah-Hartman Date: Wed, 18 Apr 2012 00:10:57 +0000 (-0700) Subject: 3.0-stable patches X-Git-Tag: v3.2.16~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ae7b7bd8003dc79bab1b5cd97667fd7f4d4bb826;p=thirdparty%2Fkernel%2Fstable-queue.git 3.0-stable patches added patches: xhci-correct-the-define-xhci_legacy_disable_smi.patch xhci-don-t-re-enable-ie-constantly.patch xhci-don-t-write-zeroed-pointers-to-xhc-registers.patch xhci-restore-event-ring-dequeue-pointer-on-resume.patch --- diff --git a/queue-3.0/series b/queue-3.0/series index 212642637a4..d644729875e 100644 --- a/queue-3.0/series +++ b/queue-3.0/series @@ -20,3 +20,7 @@ usb-pl2303-fix-dtr-rts-being-raised-on-baud-rate-change.patch usb-option-re-add-novatelwireless_product_hspa_highspeed-to-option_id-array.patch usb-sierra-add-support-for-sierra-wireless-mc7710.patch usb-don-t-clear-urb-dev-in-scatter-gather-library.patch +xhci-don-t-re-enable-ie-constantly.patch +xhci-don-t-write-zeroed-pointers-to-xhc-registers.patch +xhci-restore-event-ring-dequeue-pointer-on-resume.patch +xhci-correct-the-define-xhci_legacy_disable_smi.patch diff --git a/queue-3.0/xhci-correct-the-define-xhci_legacy_disable_smi.patch b/queue-3.0/xhci-correct-the-define-xhci_legacy_disable_smi.patch new file mode 100644 index 00000000000..8fca204357b --- /dev/null +++ b/queue-3.0/xhci-correct-the-define-xhci_legacy_disable_smi.patch @@ -0,0 +1,57 @@ +From 95018a53f7653e791bba1f54c8d75d9cb700d1bd Mon Sep 17 00:00:00 2001 +From: Alex He +Date: Fri, 30 Mar 2012 10:21:38 +0800 +Subject: xHCI: Correct the #define XHCI_LEGACY_DISABLE_SMI + +From: Alex He + +commit 95018a53f7653e791bba1f54c8d75d9cb700d1bd upstream. + +Re-define XHCI_LEGACY_DISABLE_SMI and used it in right way. All SMI enable +bits will be cleared to zero and flag bits 29:31 are also cleared to zero. +Other bits should be presvered as Table 146. + +This patch should be backported to kernels as old as 2.6.31. + +Signed-off-by: Alex He +Signed-off-by: Sarah Sharp +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/pci-quirks.c | 10 +++++++--- + drivers/usb/host/xhci-ext-caps.h | 5 +++-- + 2 files changed, 10 insertions(+), 5 deletions(-) + +--- a/drivers/usb/host/pci-quirks.c ++++ b/drivers/usb/host/pci-quirks.c +@@ -824,9 +824,13 @@ static void __devinit quirk_usb_handoff_ + } + } + +- /* Disable any BIOS SMIs */ +- writel(XHCI_LEGACY_DISABLE_SMI, +- base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); ++ val = readl(base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); ++ /* Mask off (turn off) any enabled SMIs */ ++ val &= XHCI_LEGACY_DISABLE_SMI; ++ /* Mask all SMI events bits, RW1C */ ++ val |= XHCI_LEGACY_SMI_EVENTS; ++ /* Disable any BIOS SMIs and clear all SMI events*/ ++ writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); + + if (usb_is_intel_switchable_xhci(pdev)) + usb_enable_xhci_ports(pdev); +--- a/drivers/usb/host/xhci-ext-caps.h ++++ b/drivers/usb/host/xhci-ext-caps.h +@@ -62,8 +62,9 @@ + /* USB Legacy Support Control and Status Register - section 7.1.2 */ + /* Add this offset, plus the value of xECP in HCCPARAMS to the base address */ + #define XHCI_LEGACY_CONTROL_OFFSET (0x04) +-/* bits 1:2, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ +-#define XHCI_LEGACY_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17)) ++/* bits 1:3, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ ++#define XHCI_LEGACY_DISABLE_SMI ((0x7 << 1) + (0xff << 5) + (0x7 << 17)) ++#define XHCI_LEGACY_SMI_EVENTS (0x7 << 29) + + /* command register values to disable interrupts and halt the HC */ + /* start/stop HC execution - do not write unless HC is halted*/ diff --git a/queue-3.0/xhci-don-t-re-enable-ie-constantly.patch b/queue-3.0/xhci-don-t-re-enable-ie-constantly.patch new file mode 100644 index 00000000000..408acc91b46 --- /dev/null +++ b/queue-3.0/xhci-don-t-re-enable-ie-constantly.patch @@ -0,0 +1,54 @@ +From 4e833c0b87a30798e67f06120cecebef6ee9644c Mon Sep 17 00:00:00 2001 +From: Felipe Balbi +Date: Thu, 15 Mar 2012 16:37:08 +0200 +Subject: xhci: don't re-enable IE constantly + +From: Felipe Balbi + +commit 4e833c0b87a30798e67f06120cecebef6ee9644c upstream. + +While we're at that, define IMAN bitfield to aid readability. + +The interrupt enable bit should be set once on driver init, and we +shouldn't need to continually re-enable it. Commit c21599a3 introduced +a read of the irq_pending register, and that allows us to preserve the +state of the IE bit. Before that commit, we were blindly writing 0x3 to +the register. + +This patch should be backported to kernels as old as 2.6.36, or ones +that contain the commit c21599a36165dbc78b380846b254017a548b9de5 "USB: +xhci: Reduce reads and writes of interrupter registers". + +Signed-off-by: Felipe Balbi +Signed-off-by: Sarah Sharp +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/xhci-ring.c | 2 +- + drivers/usb/host/xhci.h | 4 ++++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/usb/host/xhci-ring.c ++++ b/drivers/usb/host/xhci-ring.c +@@ -2352,7 +2352,7 @@ hw_died: + u32 irq_pending; + /* Acknowledge the PCI interrupt */ + irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); +- irq_pending |= 0x3; ++ irq_pending |= IMAN_IP; + xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); + } + +--- a/drivers/usb/host/xhci.h ++++ b/drivers/usb/host/xhci.h +@@ -205,6 +205,10 @@ struct xhci_op_regs { + #define CMD_PM_INDEX (1 << 11) + /* bits 12:31 are reserved (and should be preserved on writes). */ + ++/* IMAN - Interrupt Management Register */ ++#define IMAN_IP (1 << 1) ++#define IMAN_IE (1 << 0) ++ + /* USBSTS - USB status - status bitmasks */ + /* HC not running - set to 1 when run/stop bit is cleared. */ + #define STS_HALT XHCI_STS_HALT diff --git a/queue-3.0/xhci-don-t-write-zeroed-pointers-to-xhc-registers.patch b/queue-3.0/xhci-don-t-write-zeroed-pointers-to-xhc-registers.patch new file mode 100644 index 00000000000..3ac4061e75c --- /dev/null +++ b/queue-3.0/xhci-don-t-write-zeroed-pointers-to-xhc-registers.patch @@ -0,0 +1,76 @@ +From 159e1fcc9a60fc7daba23ee8fcdb99799de3fe84 Mon Sep 17 00:00:00 2001 +From: Sarah Sharp +Date: Fri, 16 Mar 2012 13:09:39 -0700 +Subject: xhci: Don't write zeroed pointers to xHC registers. + +From: Sarah Sharp + +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 +Tested-by: Elric Fu +Signed-off-by: Greg Kroah-Hartman + +--- + 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; + } diff --git a/queue-3.0/xhci-restore-event-ring-dequeue-pointer-on-resume.patch b/queue-3.0/xhci-restore-event-ring-dequeue-pointer-on-resume.patch new file mode 100644 index 00000000000..862a39c1ce6 --- /dev/null +++ b/queue-3.0/xhci-restore-event-ring-dequeue-pointer-on-resume.patch @@ -0,0 +1,37 @@ +From fb3d85bc7193f23c9a564502df95564c49a32c91 Mon Sep 17 00:00:00 2001 +From: Sarah Sharp +Date: Fri, 16 Mar 2012 13:27:39 -0700 +Subject: xhci: Restore event ring dequeue pointer on resume. + +From: Sarah Sharp + +commit fb3d85bc7193f23c9a564502df95564c49a32c91 upstream. + +The xhci_save_registers() function saved the event ring dequeue pointer +in the s3 register structure, but xhci_restore_registers() never +restored it. No other code in the xHCI successful resume path would +ever restore it either. Fix that. + +This should be backported to kernels as old as 2.6.37, that contain the +commit 5535b1d5f8885695c6ded783c692e3c0d0eda8ca "USB: xHCI: PCI power +management implementation". + +Signed-off-by: Sarah Sharp +Tested-by: Elric Fu +Cc: Andiry Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/xhci.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/host/xhci.c ++++ b/drivers/usb/host/xhci.c +@@ -627,6 +627,7 @@ static void xhci_restore_registers(struc + xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control); + xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size); + xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); ++ xhci_write_64(xhci, xhci->s3.erst_dequeue, &xhci->ir_set->erst_dequeue); + } + + static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci)