Hi all, This is third iteration of the patch series trying to solve the problem reported by Chris Chiu [1]. In summary the current resource distribution code does not cover the initial device enumeration so if we find unconfigured bridges they get the bare minimum. This one tries to be slightly more generic and deal with PCI devices in addition to PCIe. I've tried this on a system with Maple Ridge Thunderbolt controller (the same as in the orignal bug report), on QEMU with similar PCI topology using following parameters: -device pcie-pci-bridge,id=br1 \ -device e1000,bus=br1,addr=2 \ -device pci-bridge,chassis_nr=1,bus=br1,shpc=off,id=br2,addr=3 \ -device e1000,bus=br1,addr=4 \ -device e1000,bus=br2 Then on a QEMU similar to what Jonathan used when he found out the regression with multifunction devices: -device pcie-root-port,port=0,id=root_port13,chassis=0,slot=2 \ -device x3130-upstream,id=sw1,bus=root_port13,multifunction=on \ -device e1000,bus=root_port13,addr=0.1 \ -device xio3130-downstream,id=fun1,bus=sw1,chassis=0,slot=3 \ -device e1000,bus=fun1 The previous versions of the series can be found: v2: https://lore.kernel.org/linux-pci/20221114115953.40236-1-mika.westerberg@xxxxxxxxxxxxxxx/ v1: https://lore.kernel.org/linux-pci/20221103103254.30497-1-mika.westerberg@xxxxxxxxxxxxxxx/ Changes from v2: * Make both patches to work with PCI devices too (do not expect that the bridge is always first device on the bus). * Allow distribution with bridges that do not have all resource windows programmed (thereofore the pathch 2/2 is not revert anymore) * I did not add the tags from Rafael and Jonathan because the code is not exactly the same anymore so was not sure if they still apply. Changes from v1: * Re-worded the commit message to hopefully explain the problem better * Added Link: to the bug report * Update the comment according to Bjorn's suggestion * Dropped the ->multifunction check * Use %#llx in log format. [1] https://bugzilla.kernel.org/show_bug.cgi?id=216000 Mika Westerberg (2): PCI: Take other bus devices into account when distributing resources PCI: Distribute available resources for root buses too drivers/pci/setup-bus.c | 122 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 117 insertions(+), 5 deletions(-) -- 2.35.1