mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
ppc/pnv: Introduce support for user created PHB3 devices
PHB3 devices and PCI devices can now be added to the powernv8 machine using : -device pnv-phb3,chip-id=0,index=1 \ -device nec-usb-xhci,bus=pci.1,addr=0x0 The 'index' property identifies the PHB3 in the chip. In case of user created devices, a lookup on 'chip-id' is required to assign the owning chip. Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Signed-off-by: Cédric Le Goater <clg@kaod.org> Message-Id: <20220105212338.49899-7-danielhb413@gmail.com> Signed-off-by: Cédric Le Goater <clg@kaod.org>
This commit is contained in:
parent
e022e5a73a
commit
1f6a88fffc
3 changed files with 30 additions and 6 deletions
|
@ -991,6 +991,15 @@ static void pnv_phb3_realize(DeviceState *dev, Error **errp)
|
|||
PnvMachineState *pnv = PNV_MACHINE(qdev_get_machine());
|
||||
int i;
|
||||
|
||||
/* User created devices */
|
||||
if (!phb->chip) {
|
||||
phb->chip = pnv_get_chip(pnv, phb->chip_id);
|
||||
if (!phb->chip) {
|
||||
error_setg(errp, "invalid chip id: %d", phb->chip_id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (phb->phb_id >= PNV_CHIP_GET_CLASS(phb->chip)->num_phbs) {
|
||||
error_setg(errp, "invalid PHB index: %d", phb->phb_id);
|
||||
return;
|
||||
|
@ -1104,7 +1113,7 @@ static void pnv_phb3_class_init(ObjectClass *klass, void *data)
|
|||
dc->realize = pnv_phb3_realize;
|
||||
device_class_set_props(dc, pnv_phb3_properties);
|
||||
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
|
||||
dc->user_creatable = false;
|
||||
dc->user_creatable = true;
|
||||
}
|
||||
|
||||
static const TypeInfo pnv_phb3_type_info = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue