Linux PCI subsystem development
 help / color / mirror / Atom feed
* [RFC PATCH] usb: pci-quirks: Reset stubborn xHCI controllers
@ 2026-12-03 18:45 Michal Pecio
  0 siblings, 0 replies; only message in thread
From: Michal Pecio @ 2026-12-03 18:45 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman, Paul Menzel, Wen Xiong
  Cc: linux-usb, linux-pci

TUSB7340 has been reported to get stuck and refuse to halt after
kexec; at least in one case problems turned out to begin already
in xhci_shutdown() routine before kexec. Issuing a PCI function
reset to the chip was reported to restore operation.

I obtained a PCIe card with TUSB7340 and found that problems are
not limited to kexec - ordinary reboot also triggers halt error
(seen over netconsole) if a busy device like keyboard (opened by
the kernel's VT) or a network interface (brought up) is present.
Some chips don't seem to appreciate halting mid-operation.

The issue is also triggered by my BIOS if a keyboard is connected.
The BIOS doesn't halt xHCI chips used for legacy USB support at
all (USBSTS shows EINT | PCD), and when the booting kernel tries
to halt a TUSB7340, the chip locks up as usual.

All chips also get IOMMU faults on USB port connection if I patch
quirk_usb_handoff_xhci() not to halt them after the handoff and
blacklist xhci-hcd, but faulting addresses belong to a reserved
area so that's OK, at least in my BIOS. Good luck.

All things considered, it seems that when an xHCI chip is in the
"running" state (power-on default is "halted") and it refuses to
stop, it's better to take this seriously and give it a good kick.
This allows my TUSB7340 to work even after being used by BIOS:

pci 0000:08:00.0: xHCI HW did not halt within 32000 usec status = 0x18
pci 0000:08:00.0: Function reset, status 0
pci 0000:08:00.0: quirk_usb_early_handoff+0x0/0x680 took 138097 usecs
xhci_hcd 0000:08:00.0: xHCI Host Controller

Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Link: https://lore.kernel.org/linux-usb/fb68e15d-b8f2-42ac-aa65-0d9fedcfcdbd@molgen.mpg.de/
Reported-by: Wen Xiong <wenxiong@linux.ibm.com>
Link: https://lore.kernel.org/linux-usb/20261001222527.11742-1-wenxiong@linux.ibm.com/
Suggested-by: Wen Xiong <wenxiong@linux.ibm.com>
Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
---
 drivers/usb/host/pci-quirks.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 1dbfd697a582..ba30ac74ab30 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -1253,10 +1253,14 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)
 	timeout = handshake(op_reg_base + XHCI_STS_OFFSET, XHCI_STS_HALT, 1,
 			XHCI_MAX_HALT_USEC, 125);
 	if (timeout) {
+		int ret;
+
 		val = readl(op_reg_base + XHCI_STS_OFFSET);
 		dev_warn(&pdev->dev,
 			 "xHCI HW did not halt within %d usec status = 0x%x\n",
 			 XHCI_MAX_HALT_USEC, val);
+		ret = pci_reset_function(pdev);
+		dev_warn(&pdev->dev, "Function reset, status %d\n", ret);
 	}
 
 iounmap:
-- 
2.48.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-03 18:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 18:45 [RFC PATCH] usb: pci-quirks: Reset stubborn xHCI controllers Michal Pecio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox