| Thunderbolt devices appear in the OS as a PCIe switch, so you need two additional bus numbers (one for the Switch Upstream Port and one for the Switch Downstream Port). If the device is hotplugged to a port which has run out of bus numbers, you'll get this error message. Mika Westerberg is constantly fine-tuning the allocation of PCI resources in the Linux kernel to avoid such scenarios. Some recent patches: https://lore.kernel.org/linux-pci/20220905080232.36087-1-mik... https://lore.kernel.org/linux-pci/20221130112221.66612-1-mik... On macOS, it's possible to pause the PCI bus, reallocate resources and unpause the bus: https://developer.apple.com/library/archive/documentation/Ha... (search for "Supporting PCIe Pause") We don't have that on Linux unfortunately, so we depend on getting the initial resource allocation right. Sergei Miroshnichenko has worked on such a reallocation feature for Linux but it hasn't been accepted into mainline yet and he hasn't posted a new version of his patches for almost two years, so the effort seems stalled: https://lore.kernel.org/linux-pci/20201218174011.340514-1-s.... |
The patch for pausing and unpausing seems quite reasonable, except that it does require driver support (unsurprising - you’re literally reallocating the resources used by the driver!). I suppose if you had at least a few movable devices then you should be ok in the event of a hotplug event, so you’d have to hope that enough drivers bother to support the feature.
I wonder what is necessary to get people to care about the patch enough to fix it up and mainline it? I suppose the problem it fixes is still niche enough that not so many people are clamoring for the fix.