ppc/pnv: fix QOM parenting of user creatable root ports
commit6a1e1ce2efb9c22723f9f7cada5d5a31842eb37d
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Fri, 19 Aug 2022 09:47:48 +0000 (19 06:47 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 31 Aug 2022 17:08:06 +0000 (31 14:08 -0300)
tree81a3a72e68ed0be3361a59cb0d5431faedc9d233
parent3466bb50ec7c49a63b4a146c82d4030742451f40
ppc/pnv: fix QOM parenting of user creatable root ports

User creatable root ports are being parented by the 'peripheral' or the
'peripheral-anon' container. This happens because this is the regular
QOM schema for sysbus devices that are added via the command line.

Let's make this QOM hierarchy similar to what we have with default root
ports, i.e. the root port must be parented by the pnv-root-bus. To do
that we change the qom and bus parent of the root port during
root_port_realize(). The realize() is shared by the default root port
code path, so we can remove the code inside pnv_phb_attach_root_port()
that was adding the root port as a child of the bus as well.

After all that, remove pnv_phb_attach_root_port() and create the root
port explictly in the 'default_enabled()' case of pnv_phb_realize().

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
Message-Id: <20220819094748.400578-3-danielhb413@gmail.com>
hw/pci-host/pnv_phb.c