[SLOF] [PATCH] pci: Fix secondary and subordinate PCI bus enumeration with board-qemu

Nikunj A Dadhania nikunj at linux.vnet.ibm.com
Wed Sep 28 18:21:21 AEST 2016


Thomas Huth <thuth at redhat.com> writes:

> SLOF currently fails to correctly initialize the secondary and
> subordinate bus number registers in the config space of PCI
> bridges, so that for example with the following command line,
> none of the PCI devices is usable:
>
>  qemu-system-ppc64 -nodefaults -nographic -serial mon:stdio \
>     -device pci-bridge,chassis_nr=1,id=bridge0,addr=0x3 \
>     -device pci-bridge,chassis_nr=2,id=bridge1,addr=0x4 \
>     -device virtio-balloon,bus=bridge1,addr=0x1 \
>     -device virtio-net,bus=bridge0,addr=0x2 \
>     -device virtio-rng,bus=bridge0,addr=0x5 \
>     -device pci-bridge,chassis_nr=3,id=br2,addr=0x6,bus=bridge1 \
>     -device e1000,bus=br2,addr=0x1
>
> This is because SLOF tries to enumerate the PCI bus numbers
> that are reachable via a bridge. In the function pci-bridge-probe,
> it increases the pci-bus-number counter and writes that value into
> the secondary bus number register of the PCI config space, and
> after probing all attached bridges, it fills the number of the
> last enumerated bus number into the subordinate bus number register.
> This works fine if the whole bus enumeration is done by SLOF,
> however on board-qemu, we nowadays rely on the pre-initialized PCI
> device tree from QEMU - and the numbers that SLOF is trying to use
> here do not match with the bus numbers that QEMU already assigned
> to the bus segments (QEMU provides the device tree nodes in
> descending order, but SLOF tries to enumerate the bus numbers in
> ascending order here instead).
>
> To fix this issue, we should simply stop setting up the secondary
> and subordinate config space registers of the bridge in SLOF - since
> this is done by QEMU already! Thus we replace the "pci-bridge-probe"
> function with a board-qemu-specific function "phb-pci-bridge-probe",
> that does not call "pci-bus!" and "pci-bus-subo!" anymore. (And since
> pci-bridge-probe was the only spot that called phb-pci-probe-bus, we
> can get rid of that wrapper now, too, and call phb-pci-walk-bridge
> from phb-pci-bridge-probe directly instead).
>
> Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1377083
> Signed-off-by: Thomas Huth <thuth at redhat.com>

Reviewed-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>

Regards
Nikunj



More information about the SLOF mailing list