mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
ppc/pnv: turn PnvPHB3 into a PnvPHB backend
We need a handful of changes that needs to be done in a single swoop to turn PnvPHB3 into a PnvPHB backend. In the PnvPHB3, since the PnvPHB device implements PCIExpressHost and will hold the PCI bus, change PnvPHB3 parent to TYPE_DEVICE. There are a couple of instances in pnv_phb3.c that needs to access the PCI bus, so a phb_base pointer is added to allow access to the parent PnvPHB. The PnvPHB3 root port will now be connected to a PnvPHB object. In pnv.c, the powernv8 machine chip8 will now hold an array of PnvPHB objects. pnv_get_phb3_child() needs to be adapted to return the PnvPHB3 backend from the PnvPHB child. A global property is added in pnv_machine_power8_class_init() to ensure that all PnvPHBs are created with phb->version = 3. After all these changes we're still able to boot a powernv8 machine with default settings. The real gain will come with user created PnvPHB devices, coming up next. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com> Message-Id: <20220624084921.399219-4-danielhb413@gmail.com>
This commit is contained in:
parent
e4e6db5283
commit
1f5d6b2ad1
4 changed files with 26 additions and 30 deletions
21
hw/ppc/pnv.c
21
hw/ppc/pnv.c
|
@ -43,6 +43,7 @@
|
|||
#include "hw/ipmi/ipmi.h"
|
||||
#include "target/ppc/mmu-hash64.h"
|
||||
#include "hw/pci/msi.h"
|
||||
#include "hw/pci-host/pnv_phb.h"
|
||||
|
||||
#include "hw/ppc/xics.h"
|
||||
#include "hw/qdev-properties.h"
|
||||
|
@ -660,7 +661,8 @@ static void pnv_chip_power8_pic_print_info(PnvChip *chip, Monitor *mon)
|
|||
ics_pic_print_info(&chip8->psi.ics, mon);
|
||||
|
||||
for (i = 0; i < chip8->num_phbs; i++) {
|
||||
PnvPHB3 *phb3 = &chip8->phbs[i];
|
||||
PnvPHB *phb = &chip8->phbs[i];
|
||||
PnvPHB3 *phb3 = PNV_PHB3(phb->backend);
|
||||
|
||||
pnv_phb3_msi_pic_print_info(&phb3->msis, mon);
|
||||
ics_pic_print_info(&phb3->lsis, mon);
|
||||
|
@ -1149,7 +1151,7 @@ static void pnv_chip_power8_instance_init(Object *obj)
|
|||
chip8->num_phbs = pcc->num_phbs;
|
||||
|
||||
for (i = 0; i < chip8->num_phbs; i++) {
|
||||
object_initialize_child(obj, "phb[*]", &chip8->phbs[i], TYPE_PNV_PHB3);
|
||||
object_initialize_child(obj, "phb[*]", &chip8->phbs[i], TYPE_PNV_PHB);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1287,9 +1289,9 @@ static void pnv_chip_power8_realize(DeviceState *dev, Error **errp)
|
|||
memory_region_add_subregion(get_system_memory(), PNV_HOMER_BASE(chip),
|
||||
&chip8->homer.regs);
|
||||
|
||||
/* PHB3 controllers */
|
||||
/* PHB controllers */
|
||||
for (i = 0; i < chip8->num_phbs; i++) {
|
||||
PnvPHB3 *phb = &chip8->phbs[i];
|
||||
PnvPHB *phb = &chip8->phbs[i];
|
||||
|
||||
object_property_set_int(OBJECT(phb), "index", i, &error_fatal);
|
||||
object_property_set_int(OBJECT(phb), "chip-id", chip->chip_id,
|
||||
|
@ -1982,7 +1984,8 @@ static ICSState *pnv_ics_get(XICSFabric *xi, int irq)
|
|||
}
|
||||
|
||||
for (j = 0; j < chip8->num_phbs; j++) {
|
||||
PnvPHB3 *phb3 = &chip8->phbs[j];
|
||||
PnvPHB *phb = &chip8->phbs[j];
|
||||
PnvPHB3 *phb3 = PNV_PHB3(phb->backend);
|
||||
|
||||
if (ics_valid_irq(&phb3->lsis, irq)) {
|
||||
return &phb3->lsis;
|
||||
|
@ -2020,7 +2023,8 @@ static void pnv_ics_resend(XICSFabric *xi)
|
|||
ics_resend(&chip8->psi.ics);
|
||||
|
||||
for (j = 0; j < chip8->num_phbs; j++) {
|
||||
PnvPHB3 *phb3 = &chip8->phbs[j];
|
||||
PnvPHB *phb = &chip8->phbs[j];
|
||||
PnvPHB3 *phb3 = PNV_PHB3(phb->backend);
|
||||
|
||||
ics_resend(&phb3->lsis);
|
||||
ics_resend(ICS(&phb3->msis));
|
||||
|
@ -2120,8 +2124,13 @@ static void pnv_machine_power8_class_init(ObjectClass *oc, void *data)
|
|||
PnvMachineClass *pmc = PNV_MACHINE_CLASS(oc);
|
||||
static const char compat[] = "qemu,powernv8\0qemu,powernv\0ibm,powernv";
|
||||
|
||||
static GlobalProperty phb_compat[] = {
|
||||
{ TYPE_PNV_PHB, "version", "3" },
|
||||
};
|
||||
|
||||
mc->desc = "IBM PowerNV (Non-Virtualized) POWER8";
|
||||
mc->default_cpu_type = POWERPC_CPU_TYPE_NAME("power8_v2.0");
|
||||
compat_props_add(mc->compat_props, phb_compat, G_N_ELEMENTS(phb_compat));
|
||||
|
||||
xic->icp_get = pnv_icp_get;
|
||||
xic->ics_get = pnv_ics_get;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue