Message ID | 1430335224-6716-9-git-send-email-mdroth@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
On 29/04/2015 21:20, Michael Roth wrote: > + if (spapr->dr_phb_enabled) { > + for (i = 0; i < SPAPR_DRC_MAX_PHB; i++) { > + sPAPRDRConnector *drc = > + spapr_dr_connector_new(OBJECT(machine), > + SPAPR_DR_CONNECTOR_TYPE_PHB, i); > + qemu_register_reset(spapr_drc_reset, drc); > + } > + } Is this needed because drc is busless? Then I think it should be done in device_set_realized (and the matching qemu_unregister_reset too). Paolo
Quoting Paolo Bonzini (2015-04-30 09:08:10) > > > On 29/04/2015 21:20, Michael Roth wrote: > > + if (spapr->dr_phb_enabled) { > > + for (i = 0; i < SPAPR_DRC_MAX_PHB; i++) { > > + sPAPRDRConnector *drc = > > + spapr_dr_connector_new(OBJECT(machine), > > + SPAPR_DR_CONNECTOR_TYPE_PHB, i); > > + qemu_register_reset(spapr_drc_reset, drc); > > + } > > + } > > Is this needed because drc is busless? Then I think it should be done > in device_set_realized (and the matching qemu_unregister_reset too). You mean move the qemu_register_reset() to DRC->realize()? Don't recall if there was a reason I did it this way, but that does seem a lot cleaner. And yah, no bus for DRCs, so we're not hooked into qbus_reset_all_fn() > > Paolo >
On Wed, Apr 29, 2015 at 02:20:17PM -0500, Michael Roth wrote: > Since we route hotplugged PHBs to their DR connector using their > PHB.index value, we align the number of DR connectors with the > maximum index value: SPAPR_PCI_MAX_INDEX. > > Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> As with Bharata's similar patch, I'm not sure why the DRC needs an explicitly registered reset, rather than ->reset being called automatically by the qdev model, but otherwise Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index c8ad5b0..c539932 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -90,6 +90,9 @@ #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift)) +/* maximum number of hotpluggable PHBs */ +#define SPAPR_DRC_MAX_PHB (SPAPR_PCI_MAX_INDEX + 1) + typedef struct sPAPRMachineClass sPAPRMachineClass; typedef struct sPAPRMachineState sPAPRMachineState; @@ -1387,6 +1390,16 @@ static SaveVMHandlers savevm_htab_handlers = { .load_state = htab_load, }; +static void spapr_drc_reset(void *opaque) +{ + sPAPRDRConnector *drc = opaque; + DeviceState *d = DEVICE(drc); + + if (d) { + device_reset(d); + } +} + /* pSeries LPAR / sPAPR hardware init */ static void ppc_spapr_init(MachineState *machine) { @@ -1561,6 +1574,21 @@ static void ppc_spapr_init(MachineState *machine) spapr->dr_phb_enabled = smc->dr_phb_enabled; + /* Setup hotplug / dynamic-reconfiguration connectors. top-level + * connectors (described in root DT node's "ibm,drc-types" property) + * are pre-initialized here. additional child connectors (such as + * connectors for a PHBs PCI slots) are added as needed during their + * parent's realization. + */ + if (spapr->dr_phb_enabled) { + for (i = 0; i < SPAPR_DRC_MAX_PHB; i++) { + sPAPRDRConnector *drc = + spapr_dr_connector_new(OBJECT(machine), + SPAPR_DR_CONNECTOR_TYPE_PHB, i); + qemu_register_reset(spapr_drc_reset, drc); + } + } + /* Set up PCI */ spapr_pci_rtas_init();
Since we route hotplugged PHBs to their DR connector using their PHB.index value, we align the number of DR connectors with the maximum index value: SPAPR_PCI_MAX_INDEX. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> --- hw/ppc/spapr.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)