linux/drivers/usb/host
Michal Pecio c7c1f3b05c usb: xhci: Fix host controllers "dying" after suspend and resume
A recent cleanup went a bit too far and dropped clearing the cycle bit
of link TRBs, so it stays different from the rest of the ring half of
the time. Then a race occurs: if the xHC reaches such link TRB before
more commands are queued, the link's cycle bit unintentionally matches
the xHC's cycle so it follows the link and waits for further commands.
If more commands are queued before the xHC gets there, inc_enq() flips
the bit so the xHC later sees a mismatch and stops executing commands.

This function is called before suspend and 50% of times after resuming
the xHC is doomed to get stuck sooner or later. Then some Stop Endpoint
command fails to complete in 5 seconds and this shows up

xhci_hcd 0000:00:10.0: xHCI host not responding to stop endpoint command
xhci_hcd 0000:00:10.0: xHCI host controller not responding, assume dead
xhci_hcd 0000:00:10.0: HC died; cleaning up

followed by loss of all USB decives on the affected bus. That's if you
are lucky, because if Set Deq gets stuck instead, the failure is silent.

Likely responsible for kernel bug 219824. I found this while searching
for possible causes of that regression and reproduced it locally before
hearing back from the reporter. To repro, simply wait for link cycle to
become set (debugfs), then suspend, resume and wait. To accelerate the
failure I used a script which repeatedly starts and stops a UVC camera.

Some HCs get fully reinitialized on resume and they are not affected.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=219824
Fixes: 36b972d4b7 ("usb: xhci: improve xhci_clear_command_ring()")
Cc: stable@vger.kernel.org
Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20250304113147.3322584-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-04 15:02:24 +01:00
..
bcma-hcd.c USB: bcma: Remove unused of_gpio.h 2024-11-04 01:27:52 +01:00
ehci-atmel.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-brcm.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-dbg.c
ehci-exynos.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-fsl.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-fsl.h
ehci-grlib.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-hcd.c drivers/usb/host: refactor min/max with min_t/max_t 2024-11-13 15:09:50 +01:00
ehci-hub.c
ehci-mem.c
ehci-mv.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-npcm7xx.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-omap.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-orion.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-pci.c
ehci-platform.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-ppc-of.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-ps3.c
ehci-q.c
ehci-sched.c
ehci-sh.c usb: ehci-hcd: fix call balance of clocks handling routines 2024-12-04 16:25:13 +01:00
ehci-spear.c usb: ehci-spear: fix call balance of sehci clk handling routines 2024-11-16 09:04:06 +01:00
ehci-st.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci-sysfs.c
ehci-timer.c
ehci-xilinx-of.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ehci.h
fhci-dbg.c
fhci-hcd.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
fhci-hub.c
fhci-mem.c
fhci-q.c
fhci-sched.c usb: host: fix typo in the comment 2024-10-04 15:08:37 +02:00
fhci-tds.c
fhci.h
fsl-mph-dr-of.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
isp116x-hcd.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
isp116x.h
isp1362-hcd.c Merge 6.12-rc3 into usb-next 2024-10-14 08:03:44 +02:00
isp1362.h
Kconfig xhci-pci: Make xhci-pci-renesas a proper modular driver 2024-08-07 12:51:38 +02:00
Makefile
max3421-hcd.c usb: host: max3421-hcd: Correctly abort a USB request. 2024-12-04 16:25:30 +01:00
octeon-hcd.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
octeon-hcd.h
ohci-at91.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ohci-da8xx.c Merge 6.12-rc3 into usb-next 2024-10-14 08:03:44 +02:00
ohci-dbg.c
ohci-exynos.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ohci-hcd.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
ohci-hub.c
ohci-mem.c
ohci-nxp.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ohci-omap.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ohci-pci.c
ohci-platform.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ohci-ppc-of.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ohci-ps3.c
ohci-pxa27x.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ohci-q.c
ohci-s3c2410.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ohci-sa1111.c
ohci-sm501.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ohci-spear.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ohci-st.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
ohci.h
oxu210hp-hcd.c USB: host: Use str_enable_disable-like helpers 2025-01-15 18:28:12 +01:00
pci-quirks.c USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI 2025-02-14 09:18:14 +01:00
pci-quirks.h
r8a66597-hcd.c drivers/usb/host: refactor min/max with min_t/max_t 2024-11-13 15:09:50 +01:00
r8a66597.h
sl811-hcd.c USB: host: Use str_enable_disable-like helpers 2025-01-15 18:28:12 +01:00
sl811.h
sl811_cs.c
ssb-hcd.c
uhci-debug.c
uhci-grlib.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
uhci-hcd.c
uhci-hcd.h
uhci-hub.c
uhci-pci.c
uhci-platform.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
uhci-q.c
xen-hcd.c
xhci-caps.h xhci: Add missing capability definition bits 2024-12-27 13:06:10 +01:00
xhci-dbg.c
xhci-dbgcap.c xhci: dbc: Improve performance by removing delay in transfer event polling. 2024-12-27 13:06:10 +01:00
xhci-dbgcap.h xhci: dbc: honor usb transfer size boundaries. 2024-10-17 08:45:36 +02:00
xhci-dbgtty.c xhci: dbgtty: Improve performance by handling received data immediately. 2024-12-27 13:06:10 +01:00
xhci-debugfs.c xhci: don't mess with ->d_iname 2025-01-15 13:14:37 +01:00
xhci-debugfs.h
xhci-ext-caps.c
xhci-ext-caps.h xhci: Add USB4 tunnel detection for USB3 devices on Intel hosts 2024-09-03 09:54:39 +02:00
xhci-histb.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
xhci-hub.c xhci: Restrict USB4 tunnel detection for USB3 devices to Intel hosts 2025-03-03 10:10:06 +01:00
xhci-mem.c usb: xhci: Enable the TRB overfetch quirk on VIA VL805 2025-02-27 12:22:24 -08:00
xhci-mtk-sch.c
xhci-mtk.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
xhci-mtk.h
xhci-mvebu.c
xhci-mvebu.h
xhci-pci-renesas.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
xhci-pci.c usb: xhci: Enable the TRB overfetch quirk on VIA VL805 2025-02-27 12:22:24 -08:00
xhci-pci.h xhci-pci: Make xhci-pci-renesas a proper modular driver 2024-08-07 12:51:38 +02:00
xhci-plat.c usb: host: xhci-plat: add support compatible ID PNP0D15 2025-01-17 12:38:59 +01:00
xhci-plat.h
xhci-port.h
xhci-rcar.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
xhci-ring.c USB: host: Use str_enable_disable-like helpers 2025-01-15 18:28:12 +01:00
xhci-rzv2m.c
xhci-rzv2m.h
xhci-tegra.c usb: xhci: tegra: Fix OF boolean read warning 2025-01-17 12:39:42 +01:00
xhci-trace.c
xhci-trace.h xhci: trace stream context at Set TR Deq command completion 2024-11-06 13:26:14 +01:00
xhci.c usb: xhci: Fix host controllers "dying" after suspend and resume 2025-03-04 15:02:24 +01:00
xhci.h usb: xhci: Enable the TRB overfetch quirk on VIA VL805 2025-02-27 12:22:24 -08:00