ppc/pnv: add phb-id/chip-id PnvPHB3RootBus properties
commit8ec1e4f1ef974e901b416fef6c3b38a5cc2eeffa
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Thu, 11 Aug 2022 16:39:40 +0000 (11 13:39 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 31 Aug 2022 17:08:05 +0000 (31 14:08 -0300)
treee660882ae6c079afa83378954345e83b79481255
parente5ea94360eba4818467283a259d8d681f0da799f
ppc/pnv: add phb-id/chip-id PnvPHB3RootBus properties

We rely on the phb-id and chip-id, which are PHB properties, to assign
chassis and slot to the root port. For default devices this is no big
deal: the root port is being created under pnv_phb_realize() and the
values are being passed on via the 'index' and 'chip-id' of the
pnv_phb_attach_root_port() helper.

If we want to implement user created root ports we have a problem. The
user created root port will not be aware of which PHB it belongs to,
unless we're willing to violate QOM best practices and access the PHB
via dev->parent_bus->parent. What we can do is to access the root bus
parent bus.

Since we're already assigning the root port as QOM child of the bus, and
the bus is initiated using PHB properties, let's add phb-id and chip-id
as properties of the bus. This will allow us trivial access to them, for
both user-created and default root ports, without doing anything too
shady with QOM.

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