ppc/pnv: Introduce user creatable pnv-phb4 devices
commit5bc67b052b511ef042bd420857227e1e5173c88a
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 12 Jan 2022 10:28:27 +0000 (12 11:28 +0100)
committerCédric Le Goater <clg@kaod.org>
Wed, 12 Jan 2022 10:28:27 +0000 (12 11:28 +0100)
tree5947736dbf376b5fe462df4168549214138ec69c
parentdc8e2914ab27e09ce6483fa41be6822b2ff3b650
ppc/pnv: Introduce user creatable pnv-phb4 devices

This patch introduces pnv-phb4 user creatable devices that are created
in a similar manner as pnv-phb3 devices, allowing the user to interact
with the PHBs directly instead of creating PCI Express Controllers that
will create a certain amount of PHBs per controller index.

We accomplish this by doing the following:

- add a pnv_phb4_get_stack() helper to retrieve which stack an user
created phb4 would occupy;

- when dealing with an user created pnv-phb4 (detected by checking if
phb->stack is NULL at the start of phb4_realize()), retrieve its stack
and initialize its properties as done in stk_realize();

- use 'defaults_enabled()' in stk_realize() to avoid creating and
initializing a 'stack->phb' qdev that might be overwritten by an user
created pnv-phb4 device. This process is wrapped into a new helper
called pnv_pec_stk_default_phb_realize().

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20220111131027.599784-5-danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
hw/pci-host/pnv_phb4.c
hw/pci-host/pnv_phb4_pec.c
hw/ppc/pnv.c