Skip to content

RFC pci: Refactor PCI root bus creation code

Eduardo Habkost qemu-arm qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 RFC Latest6 patches 15 repliesIn review

Changes in v2 from the cover letter

* Original series subject:
"pci: Type-safety and phb->bus initialization cleanup"
* In addition to changing function signatures, also rename the functions to pci_host_bus_init*()
* Inline pci_bus_init() and pci_host_bus_register() inside their callers
* Remove unnecessary PCIBus* variables

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6pci: Inline pci_host_bus_register() inside pci_bus_init()hw/pci/pci.c+3 -82 replies
2/6pci: Move pci_bus_init() logic to pci_bus_new_inplace()hw/pci/pci.c+17 -223 replies
3/6pci: Rename and change signatures of pci_bus_new() & related functionshw/alpha/typhoon.c hw/mips/gt64xxx_pci.c hw/pci-bridge/pci_expander_bridge.c +17 more+111 -1138 replies
4/6pci: Manually simplify QOM casts at pci_host_bus_init*() callshw/pci-host/q35.c hw/pci-host/uninorth.c hw/ppc/spapr_pci.c +1 more+4 -41 reply
5/6pci: Set phb->bus inside pci_host_bus_init_inplace()hw/alpha/typhoon.c hw/mips/gt64xxx_pci.c hw/pci-bridge/pci_expander_bridge.c +16 more+58 -770 replies
6/6pci: Remove unnecessary PCIBus variableshw/alpha/typhoon.c hw/pci-bridge/pci_expander_bridge.c hw/pci-host/piix.c +4 more+26 -381 reply

Reviews trailers per patch

4 of 6 patches have a Reviewed-by or Acked-by.

PatchDavid GibsonCornelia HuckMarcel Apfelbaum
1/6R-b R-b
2/6R-b
3/6
4/6R-b
5/6
6/6A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [Qemu-devel] [RFC v2 0/6] pci: Refactor PCI root bus creation code

Changes v1 -> v2:
* Original series subject:
"pci: Type-safety and phb->bus initialization cleanup"
* In addition to changing function signatures, also rename the functions to pci_host_bus_init*()
* Inline pci_bus_init() and pci_host_bus_register() inside their callers
* Remove unnecessary PCIBus* variables

The purpose of the pci_bus_new*() and pci_register_bus() is not clear from their signatures: they look like generic functions to create PCI buss, but the functions work only when creating a root bus in a PCI host bridge.

This series implements the following changes:

1) Rename pci_bus_new*() and pci_register_bus() to pci_host_bus_init*()
2) Replace DeviceState with PCIHostState on their argument type, because they already require a PCI_HOST_BRIDGE object
3) Move PCIHostState::bus initialization inside pci_host_bus_init*(), to avoid code duplication and make sure the field will be always initialized consistently.

Eduardo Habkost (6):
pci: Inline pci_host_bus_register() inside pci_bus_init()
pci: Move pci_bus_init() logic to pci_bus_new_inplace()
pci: Rename and change signatures of pci_bus_new() & related functions
pci: Manually simplify QOM casts at pci_host_bus_init*() calls
pci: Set phb->bus inside pci_host_bus_init_inplace()
pci: Remove unnecessary PCIBus variables

 include/hw/pci/pci.h                | 31 +++++++-------
 hw/alpha/typhoon.c                  | 17 ++++----
 hw/mips/gt64xxx_pci.c               |  9 ++---
 hw/pci-bridge/pci_expander_bridge.c | 14 +++----
 hw/pci-host/apb.c                   |  7 +---
 hw/pci-host/bonito.c                |  7 ++--
 hw/pci-host/gpex.c                  |  6 +--
 hw/pci-host/grackle.c               | 10 ++---
 hw/pci-host/piix.c                  | 30 +++++++-------
 hw/pci-host/ppce500.c               | 14 +++----
 hw/pci-host/prep.c                  |  7 ++--
 hw/pci-host/q35.c                   |  5 +--
 hw/pci-host/uninorth.c              | 18 +++------
 hw/pci-host/versatile.c             |  8 ++--
 hw/pci-host/xilinx-pcie.c           |  6 +--
 hw/pci/pci.c                        | 81 +++++++++++++++++--------------------
 hw/ppc/ppc4xx_pci.c                 | 10 ++---
 hw/ppc/spapr_pci.c                  | 11 ++---
 hw/s390x/s390-pci-bus.c             | 13 +++---
 hw/sh4/sh_pci.c                     |  9 ++---
 20 files changed, 135 insertions(+), 178 deletions(-)
Signature · 1 line
2.11.0.259.g40922b1