ppc/pnv: add PnvPHB base/proxy device
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Fri, 24 Jun 2022 08:49:11 +0000 (05:49 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 31 Aug 2022 17:08:05 +0000 (14:08 -0300)
commite4e6db5283f775e44879246c6c93cb2462cf742f
tree0ae5292a5d04b2e4126e75c3fc8b495191255ed8
parent91bcee7157b0a1c627705d5a24076a3058ea01a7
ppc/pnv: add PnvPHB base/proxy device

The PnvPHB device is going to be the base device for all other powernv
PHBs. It consists of a device that has the same user API as the other
PHB, namely being a PCIHostBridge and having chip-id and index
properties. It also has a 'backend' pointer that will be initialized
with the PHB implementation that the device is going to use.

The initialization of the PHB backend is done by checking the PHB
version via a 'version' attribute that can be set via a global machine
property.  The 'version' field will be used to make adjustments based on
the running version, e.g. PHB3 uses a 'chip' reference while PHB4 uses
'pec'. To init the PnvPHB bus we'll rely on helpers for each version.
The version 3 helper is already added (pnv_phb3_bus_init), the PHB4
helper will be added later on.

For now let's add the basic logic of the PnvPHB object, which consists
mostly of pnv_phb_realize() doing all the work of checking the
phb->version set, initializing the proper backend, passing through its
attributes to the chosen backend, finalizing the backend realize and
adding a root port in the end.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220624084921.399219-3-danielhb413@gmail.com>
hw/pci-host/meson.build
hw/pci-host/pnv_phb.c [new file with mode: 0644]
hw/pci-host/pnv_phb.h [new file with mode: 0644]