Resetting dead USB controllers automatically?

From: Ondrej Zary
Date: Tue Mar 12 2019 - 10:47:01 EST


Hello,
my USB controller sometimes dies when plugging a device (maybe because of static):

[11197.529334] ehci-pci 0000:00:09.2: HC died; cleaning up
[11197.529883] uhci_hcd 0000:00:09.0: host system error, PCI problems?
[11197.529893] uhci_hcd 0000:00:09.0: host controller process error, something bad happened!
[11197.530568] usb 1-1: USB disconnect, device number 7
[11197.531224] uhci_hcd 0000:00:09.0: host system error, PCI problems?
[11197.531278] uhci_hcd 0000:00:09.0: host controller process error, something bad happened!
[11197.532155] uhci_hcd 0000:00:09.0: host system error, PCI problems?
[11197.532203] uhci_hcd 0000:00:09.0: host controller process error, something bad happened!
[11197.539798] uhci_hcd 0000:00:09.0: host system error, PCI problems?
[11197.539865] uhci_hcd 0000:00:09.0: host controller process error, something bad happened!
[11197.540092] uhci_hcd 0000:00:09.0: host system error, PCI problems?
[11197.540109] uhci_hcd 0000:00:09.0: host controller process error, something bad happened!
[11197.541210] uhci_hcd 0000:00:09.0: host system error, PCI problems?
[11197.541285] uhci_hcd 0000:00:09.0: host controller process error, something bad happened!
[11197.553179] usb 1-2: USB disconnect, device number 3
[11197.554087] usb 1-4: USB disconnect, device number 4
[11197.580154] uhci_hcd 0000:00:09.0: FGR not stopped yet!
[11197.943554] uhci_hcd 0000:00:09.0: host system error, PCI problems?
[11197.943717] uhci_hcd 0000:00:09.0: host controller process error, something bad happened!
[11197.943735] uhci_hcd 0000:00:09.0: host controller halted, very bad!
[11197.943794] uhci_hcd 0000:00:09.0: HCRESET not completed yet!
[11197.943809] uhci_hcd 0000:00:09.0: HC died; cleaning up

rmmod & modprobe isn't enough to fix it. Reboot is needed to make it work again.
Or something like this:
#!/bin/sh
rmmod ehci-pci
rmmod uhci-hcd
echo 1 >"/sys/bus/pci/devices/0000:00:09.0/remove"
echo 1 >"/sys/bus/pci/devices/0000:00:09.1/remove"
echo 1 >"/sys/bus/pci/devices/0000:00:09.2/remove"
echo 1 >/sys/bus/pci/rescan
modprobe uhci-hcd

I'm not the only one affected by this problem:
http://www.google.com/search?q=%22HC+died%3B+cleaning+up%22

Maybe the uhci/ehci drivers (or the USB core?) could reset the controller automatically to improve reliability.

Looks like someone thought about this before but it was never implemented.
There's a comment in ehci_handle_controller_death() function in drivers/usb/host/ehci-timer.c:
/* Not in process context, so don't try to reset the controller */



The controller is:
00:09.0 USB controller [0c03]: VIA Technologies, Inc. VT82xx/62xx UHCI USB 1.1 Controller [1106:3038] (rev 62)
00:09.1 USB controller [0c03]: VIA Technologies, Inc. VT82xx/62xx UHCI USB 1.1 Controller [1106:3038] (rev 62)
00:09.2 USB controller [0c03]: VIA Technologies, Inc. USB 2.0 [1106:3104] (rev 65)

--
Ondrej Zary