From 3e820c2f3095363b5adadedbf53cbe506e00c868 Mon Sep 17 00:00:00 2001 From: leoliu-oc Date: Thu, 30 Oct 2025 16:08:34 +0800 Subject: [PATCH] usb: pci-quirks: Fix TBT USB Enumeration Long Blocking Issue zhaoxin inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IDAQZI CVE: NA ------------------- At two Type-C ports, a set of devices are cascaded respectively, including a TBT4 dock, a TBT3 storage device, and a USB2.0 device. During the enumeration process, due to the addition of serial port identification, the U3 hub in the U3 dock slows down, and it is prone to triggering the patch of the FW U3 hub to switch the Vbus. At this time, the PCIe hierarchy in the secondary TBT3 storage device may still be in the process of enumeration, which may lead to unpredictable disconnections in PCIe/NVMe/XHCI. The corresponding driver does not expect disconnections to occur during the enumeration when enumerating these controllers. During xHCI handoff and other CNR periods, the driver may loop - read MMIO up to 500000 times. Since the controller is disconnected, each MMIO operation will experience a 30-millisecond timeout. This may result in a maximum waiting time of 15000 seconds in this loop, which may trigger more deadlocks and ultimately cause the system to seem unresponsive. Previously, some cases have been found where the system experiences a black screen or freezes because some CPU cores remain in the NVMe and PCIe drivers for an extended period. Signed-off-by: leoliu-oc --- drivers/usb/host/pci-quirks.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 070c66f86e67..9984088bbd7d 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -1015,6 +1015,8 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done, do { result = readl(ptr); + if (result == ~(u32)0) + return -ENODEV; result &= mask; if (result == done) return 0; -- Gitee