aboutsummaryrefslogtreecommitdiff
path: root/board-qemu
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2016-09-27 13:52:22 +0200
committerAlexey Kardashevskiy <aik@ozlabs.ru>2016-10-10 17:30:53 +1100
commite44b7f074f549f78303ad4d67d39b18db93d11bf (patch)
treea3457dd00a7cc85b7201fb9e9839e29d5203bb72 /board-qemu
parenta6db31fda1cb23e24bf59f581fc88f1343b506d1 (diff)
downloadSLOF-e44b7f074f549f78303ad4d67d39b18db93d11bf.zip
SLOF-e44b7f074f549f78303ad4d67d39b18db93d11bf.tar.gz
SLOF-e44b7f074f549f78303ad4d67d39b18db93d11bf.tar.bz2
pci: Fix secondary and subordinate PCI bus enumeration with board-qemu
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@redhat.com> Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'board-qemu')
-rw-r--r--board-qemu/slof/pci-phb.fs15
1 files changed, 11 insertions, 4 deletions
diff --git a/board-qemu/slof/pci-phb.fs b/board-qemu/slof/pci-phb.fs
index f79c5b4..667514e 100644
--- a/board-qemu/slof/pci-phb.fs
+++ b/board-qemu/slof/pci-phb.fs
@@ -304,9 +304,16 @@ setup-puid
get-parent set-node
;
-\ Landing routing to probe the popuated device tree
-: phb-pci-probe-bus ( busnr -- )
- drop phb-pci-walk-bridge
+\ Similar to pci-bridge-probe, but without setting the secondary and
+\ subordinate bus numbers (since this has been done by QEMU already)
+: phb-pci-bridge-probe ( addr -- )
+ dup pci-bridge-set-bases \ Set up all Base Registers
+ dup func-pci-bridge-range-props \ Set up temporary "range"
+ pci-device-vec-len 1+ TO pci-device-vec-len \ increase the device-slot vector depth
+ pci-enable \ enable mem/IO transactions
+ phb-pci-walk-bridge \ and walk the secondary bus
+ pci-device-vec-len 1- TO pci-device-vec-len \ decrease the device-slot vector depth
+ pci-bridge-set-limits \ Set up all Limit Registers
;
\ Stub routine, as qemu has enumerated, we already have the device
@@ -328,7 +335,7 @@ setup-puid
1 0 (probe-pci-host-bridge)
ELSE
2drop
- ['] phb-pci-probe-bus TO func-pci-probe-bus
+ ['] phb-pci-bridge-probe TO func-pci-bridge-probe
['] phb-pci-device-props TO func-pci-device-props
phb-pci-walk-bridge \ PHB device tree is already populated.
THEN