fix(loongarch64): preserve firmware PCI bridge bus numbers - #386
Conversation
|
Thanks for the contribution. This fixes the reported LS3A6000 boot issue by preserving the firmware-programmed However, this fix is still not general: it is restricted to Could we preserve the firmware bus register during PCI enumeration for all |
Cache the firmware-programmed bridge bus register during enumeration for no_pcie_bar_realloc backends. Preserve it for identity bus mappings and translate primary, secondary, and subordinate bus numbers when a zone remaps buses.
Thanks for the suggestion. I’ve reworked the patch accordingly. For all The identity-mapping path has been verified on the LS3A6000 root zone, which can now boot successfully and detect the NVMe device behind the bridge. Guest zones, bus-remapping scenarios, and other architectures have not yet been runtime-tested. |
There was a problem hiding this comment.
In get_node(), since set_vbdf() is executed before config_value_init(), the firmware bus number hasn't been cached yet. This causes bridge_bus_reg to be incorrectly set to primary + 1. It would be more reasonable to call config_value_init() right before the final set_vbdf() at the end of get_node()
| && (config.bus == physical_primary | ||
| || (config.bus >= physical_secondary && config.bus <= physical_subordinate)) | ||
| }) | ||
| .all(|config| config.bus == config.v_bus); |
There was a problem hiding this comment.
If the filter result is empty, .all() returns true, which might cause the guest Linux to see an incorrect bus.
Cache PCI configuration values before set_vbdf initializes the virtual bridge bus register. Also require at least one visible bus mapping before treating a bridge topology as identity-mapped.
* fix(loongarch64): preserve firmware PCI bridge bus numbers * fix(pci): preserve firmware bridge bus topology Cache the firmware-programmed bridge bus register during enumeration for no_pcie_bar_realloc backends. Preserve it for identity bus mappings and translate primary, secondary, and subordinate bus numbers when a zone remaps buses. * fix(pci): initialize bridge state before bus mapping Cache PCI configuration values before set_vbdf initializes the virtual bridge bus register. Also require at least one visible bus mapping before treating a bridge topology as identity-mapped.
* fix(loongarch64): preserve firmware PCI bridge bus numbers * fix(pci): preserve firmware bridge bus topology Cache the firmware-programmed bridge bus register during enumeration for no_pcie_bar_realloc backends. Preserve it for identity bus mappings and translate primary, secondary, and subordinate bus numbers when a zone remaps buses. * fix(pci): initialize bridge state before bus mapping Cache PCI configuration values before set_vbdf initializes the virtual bridge bus register. Also require at least one visible bus mapping before treating a bridge topology as identity-mapped.
Issue
On LS3A6000, root Linux stops at:
The physical bridge
00:0d.0uses secondary bus05, butbridge_bus_regincorrectly initializes it as01, preventing Linux from discovering the NVMe device at05:00.0.Change
For identity-mapped physical PCI bridges on LoongArch with
CONFIG_NO_PCIE_BAR_REALLOC=y, initializebridge_bus_regfrom the hardware register at offset0x18.Other architectures and remapped PCI bridges are unaffected.
Verification