qemu-e2k/include/hw/pci
Greg Kurz a8eeafda19 spapr/pci: populate PCI DT in reverse order
Since commit 1d2d974244 "spapr_pci: enumerate and add PCI device tree", QEMU
populates the PCI device tree in the opposite order compared to SLOF.

Before 1d2d974244:

Populating /pci@800000020000000
                     00 0000 (D) : 1af4 1000    virtio [ net ]
                     00 0800 (D) : 1af4 1001    virtio [ block ]
                     00 1000 (D) : 1af4 1009    virtio [ network ]
Populating /pci@800000020000000/unknown-legacy-device@2

7e5294b8 :  /pci@800000020000000
7e52b998 :  |-- ethernet@0
7e52c0c8 :  |-- scsi@1
7e52c7e8 :  +-- unknown-legacy-device@2 ok

Since 1d2d974244:

Populating /pci@800000020000000
                     00 1000 (D) : 1af4 1009    virtio [ network ]
Populating /pci@800000020000000/unknown-legacy-device@2
                     00 0800 (D) : 1af4 1001    virtio [ block ]
                     00 0000 (D) : 1af4 1000    virtio [ net ]

7e5e8118 :  /pci@800000020000000
7e5ea6a0 :  |-- unknown-legacy-device@2
7e5eadb8 :  |-- scsi@1
7e5eb4d8 :  +-- ethernet@0 ok

This behaviour change is not actually a bug since no assumptions should be
made on DT ordering. But it has no real justification either, other than
being the consequence of the way fdt_add_subnode() inserts new elements
to the front of the FDT rather than adding them to the tail.

This patch reverts to the historical SLOF ordering by walking PCI devices
in reverse order. This reconciles pseries with x86 machine types behavior.
It is expected to make things easier when porting existing applications to
power.

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
(slight update to the changelog)
Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-03-01 11:23:39 +11:00
..
msi.h pci: Convert msi_init() to Error and fix callers to check it 2016-07-05 13:14:41 +03:00
msix.h pci: Convert msix_init() to Error and fix callers 2017-02-01 03:37:18 +02:00
pci_bridge.h Remove unused function declarations 2016-09-15 15:32:22 +03:00
pci_bus.h hw/pci: delay bus_master_enable_region initialization 2016-07-04 14:50:01 +03:00
pci_host.h
pci_ids.h PCI: add missing classes in pci_ids.h to build device tree 2017-03-01 11:23:38 +11:00
pci_regs.h pci: Introduce define for PM capability version 1.1 2016-06-02 10:42:09 +08:00
pci-assign.h hw/pci-assign: split pci-assign.c 2015-09-10 12:04:27 +00:00
pci.h spapr/pci: populate PCI DT in reverse order 2017-03-01 11:23:39 +11:00
pcie_aer.h pcie_aer: support configurable AER capa version 2017-01-10 07:02:52 +02:00
pcie_host.h pci: Split pcie_host_mmcfg_map() 2015-01-26 20:25:52 +02:00
pcie_port.h hw/pcie: Introduce a base class for PCI Express Root Ports 2017-02-01 03:37:17 +02:00
pcie_regs.h pcie: Add support for PCIe CAP v1 2016-06-02 10:42:26 +08:00
pcie.h PCI/migration merge vmstate_pci_device and vmstate_pcie_device 2017-01-24 18:00:31 +00:00
shpc.h include: Clean up includes 2016-02-23 12:43:05 +00:00
slotid_cap.h