From a888363597429a237fa30de221a3aa8c094a3411 Mon Sep 17 00:00:00 2001 From: LeoLiu-oc Date: Wed, 24 Dec 2025 16:51:07 +0800 Subject: [PATCH] anolis: PCI: Fix PCIe unplug Enumeration Long Blocking Issue ANBZ: #28496 When a USB4 device is inserted, a PCIe tunnel will be established. Then, the PCIe hierarchy within the USB4 device will be enumerated. If the device is suddenly unplugged during the enumeration process, it is possible that the function pci_find_next_ext_capability called when the PCI driver scans the PCIe extended capability may take a very long time, perhaps more than 20 seconds. Signed-off-by: LeoLiu-oc --- drivers/pci/pci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 1cd63450675a..6b8ce37563d5 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -566,6 +566,13 @@ int pci_find_next_ext_capability(struct pci_dev *dev, int start, int cap) return 0; while (ttl-- > 0) { +#ifdef CONFIG_X86 + if (boot_cpu_data.x86_vendor == X86_VENDOR_CENTAUR || + boot_cpu_data.x86_vendor == X86_VENDOR_ZHAOXIN) + if (header == 0xffffffff) + return 0; +#endif + if (PCI_EXT_CAP_ID(header) == cap && pos != start) return pos; -- Gitee