From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41094) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZM9ev-0004kT-Dp for qemu-devel@nongnu.org; Mon, 03 Aug 2015 02:55:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZM9et-00059L-He for qemu-devel@nongnu.org; Mon, 03 Aug 2015 02:55:41 -0400 Date: Mon, 3 Aug 2015 16:55:01 +1000 From: David Gibson Message-ID: <20150803065501.GB31111@voom.redhat.com> References: <1438580143-587-1-git-send-email-bharata@linux.vnet.ibm.com> <1438580143-587-5-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4bRzO86E/ozDv8r1" Content-Disposition: inline In-Reply-To: <1438580143-587-5-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v0 4/5] spapr: Support hotplug by specifying DRC count List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: mdroth@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, agraf@suse.de --4bRzO86E/ozDv8r1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 03, 2015 at 11:05:42AM +0530, Bharata B Rao wrote: > Support hotplug identifier type RTAS_LOG_V6_HP_ID_DRC_COUNT that allows > hotplugging of DRCs by specifying the DRC count. >=20 > While we are here, rename >=20 > spapr_hotplug_req_add_event() to spapr_hotplug_req_add_by_index() > spapr_hotplug_req_remove_event() to spapr_hotplug_req_remove_by_index() >=20 > so that they match with spapr_hotplug_req_add_by_count(). >=20 > Signed-off-by: Bharata B Rao > --- > hw/ppc/spapr.c | 2 +- > hw/ppc/spapr_events.c | 47 ++++++++++++++++++++++++++++++++++++++------= --- > hw/ppc/spapr_pci.c | 4 ++-- > include/hw/ppc/spapr.h | 8 ++++++-- > 4 files changed, 47 insertions(+), 14 deletions(-) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 669dc43..13af9be 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -2072,7 +2072,7 @@ static void spapr_add_lmbs(DeviceState *dev, uint64= _t addr, uint64_t size, > =20 > drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); > drck->attach(drc, dev, fdt, fdt_offset, !dev->hotplugged, errp); > - spapr_hotplug_req_add_event(drc); > + spapr_hotplug_req_add_by_index(drc); > addr +=3D SPAPR_MEMORY_BLOCK_SIZE; > } > } > diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c > index 98bf7ae..744ea62 100644 > --- a/hw/ppc/spapr_events.c > +++ b/hw/ppc/spapr_events.c > @@ -386,7 +386,9 @@ static void spapr_powerdown_req(Notifier *n, void *op= aque) > qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq)= ); > } > =20 > -static void spapr_hotplug_req_event(sPAPRDRConnector *drc, uint8_t hp_ac= tion) > +static void spapr_hotplug_req_event(uint8_t hp_id, uint8_t hp_action, > + sPAPRDRConnectorType drc_type, > + uint32_t drc) > { > sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); > struct hp_log_full *new_hp; > @@ -395,8 +397,6 @@ static void spapr_hotplug_req_event(sPAPRDRConnector = *drc, uint8_t hp_action) > struct rtas_event_log_v6_maina *maina; > struct rtas_event_log_v6_mainb *mainb; > struct rtas_event_log_v6_hp *hp; > - sPAPRDRConnectorClass *drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); > - sPAPRDRConnectorType drc_type =3D drck->get_type(drc); > =20 > new_hp =3D g_malloc0(sizeof(struct hp_log_full)); > hdr =3D &new_hp->hdr; > @@ -427,8 +427,7 @@ static void spapr_hotplug_req_event(sPAPRDRConnector = *drc, uint8_t hp_action) > hp->hdr.section_length =3D cpu_to_be16(sizeof(*hp)); > hp->hdr.section_version =3D 1; /* includes extended modifier */ > hp->hotplug_action =3D hp_action; > - hp->drc.index =3D cpu_to_be32(drck->get_index(drc)); > - hp->hotplug_identifier =3D RTAS_LOG_V6_HP_ID_DRC_INDEX; > + hp->hotplug_identifier =3D hp_id; > =20 > switch (drc_type) { > case SPAPR_DR_CONNECTOR_TYPE_PCI: > @@ -445,19 +444,49 @@ static void spapr_hotplug_req_event(sPAPRDRConnecto= r *drc, uint8_t hp_action) > return; > } > =20 > + if (hp_id =3D=3D RTAS_LOG_V6_HP_ID_DRC_COUNT) { > + hp->drc.count =3D cpu_to_be32(drc); I'm a bit confused as to how this message can work with *only* a count and not some sort of base index. > + } else if (hp_id =3D=3D RTAS_LOG_V6_HP_ID_DRC_INDEX) { > + hp->drc.index =3D cpu_to_be32(drc); > + } > + > rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, new_hp, true); > =20 > qemu_irq_pulse(xics_get_qirq(spapr->icp, spapr->check_exception_irq)= ); > } > =20 > -void spapr_hotplug_req_add_event(sPAPRDRConnector *drc) > +void spapr_hotplug_req_add_by_index(sPAPRDRConnector *drc) > +{ > + sPAPRDRConnectorClass *drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); > + sPAPRDRConnectorType drc_type =3D drck->get_type(drc); > + uint32 index =3D drck->get_index(drc); > + > + spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_INDEX, > + RTAS_LOG_V6_HP_ACTION_ADD, drc_type, index); > +} > + > +void spapr_hotplug_req_remove_by_index(sPAPRDRConnector *drc) > +{ > + sPAPRDRConnectorClass *drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); > + sPAPRDRConnectorType drc_type =3D drck->get_type(drc); > + uint32 index =3D drck->get_index(drc); > + > + spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_INDEX, > + RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, inde= x); > +} > + > +void spapr_hotplug_req_add_by_count(sPAPRDRConnectorType drc_type, > + uint32_t count) > { > - spapr_hotplug_req_event(drc, RTAS_LOG_V6_HP_ACTION_ADD); > + spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_COUNT, > + RTAS_LOG_V6_HP_ACTION_ADD, drc_type, count); > } > =20 > -void spapr_hotplug_req_remove_event(sPAPRDRConnector *drc) > +void spapr_hotplug_req_remove_by_count(sPAPRDRConnectorType drc_type, > + uint32_t count) > { > - spapr_hotplug_req_event(drc, RTAS_LOG_V6_HP_ACTION_REMOVE); > + spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_COUNT, > + RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, coun= t); > } > =20 > static void check_exception(PowerPCCPU *cpu, sPAPRMachineState *spapr, > diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c > index cfd3b7b..9d41060 100644 > --- a/hw/ppc/spapr_pci.c > +++ b/hw/ppc/spapr_pci.c > @@ -1179,7 +1179,7 @@ static void spapr_phb_hot_plug_child(HotplugHandler= *plug_handler, > return; > } > if (plugged_dev->hotplugged) { > - spapr_hotplug_req_add_event(drc); > + spapr_hotplug_req_add_by_index(drc); > } > } > =20 > @@ -1207,7 +1207,7 @@ static void spapr_phb_hot_unplug_child(HotplugHandl= er *plug_handler, > error_propagate(errp, local_err); > return; > } > - spapr_hotplug_req_remove_event(drc); > + spapr_hotplug_req_remove_by_index(drc); > } > } > =20 > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index b6cb0d0..d87c6d4 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -588,8 +588,12 @@ int spapr_dma_dt(void *fdt, int node_off, const char= *propname, > int spapr_tcet_dma_dt(void *fdt, int node_off, const char *propname, > sPAPRTCETable *tcet); > void spapr_pci_switch_vga(bool big_endian); > -void spapr_hotplug_req_add_event(sPAPRDRConnector *drc); > -void spapr_hotplug_req_remove_event(sPAPRDRConnector *drc); > +void spapr_hotplug_req_add_by_index(sPAPRDRConnector *drc); > +void spapr_hotplug_req_remove_by_index(sPAPRDRConnector *drc); > +void spapr_hotplug_req_add_by_count(sPAPRDRConnectorType drc_type, > + uint32_t count); > +void spapr_hotplug_req_remove_by_count(sPAPRDRConnectorType drc_type, > + uint32_t count); > =20 > /* rtas-configure-connector state */ > struct sPAPRConfigureConnectorState { --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --4bRzO86E/ozDv8r1 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVvxBFAAoJEGw4ysog2bOSyIMP/3sg/AKu6cHTOPRKRmmba4aB LeTIru5oGLMjclUbtZc9lIb9sWMIbWuElGTM/Ww/vqJwjuIMa3PUp88Ez/8fQw8G kuwgFVy0zykFf+R2ab7dhj6es3ISbQijI7DRqaObCjpLOQNZhePN2tsZiWT1yrQ6 gYeNiYdhVyPm9Tpb1ZJZfnYUYglYOjpngrkxl32/ihgvd3FhBm817a0HbSjiY8Ob tswQb2L2+HXc9TSeUbBd4uNmXsBnHRzO2Gtp0S/aAvqG53XV6oIsX8H0zilpPZ5n HLVQoWOl540Y99gkIjxfuSYoo/cKx7Uhw2RPiyxZqr3Lxtz3LDurS2EU6Lkdk7AS YzjQGUpN0dS4WhuBG23Hj+bRkkQFFQb7BhgCV+e9Djr2fVdjXjyFDueu3K1JNgm3 6GITPswyfxCoKrH3T+z68sxA6VXUc92Sx88UP7LEzLVoTWVj5XmXe2Ad/etNJV1m ryAhKHlX0gmqoDhPuqiD074XzLHrW4o/MJsL0nCmi2kZ+Kf2FM66t9dFRDVGDkSp E77JT/bX6E5iBxtZyDN4HM1P7K2BhTkAYaGxRmjKbFEIK0pfy2LLCgnEeb1IQ+y/ RauJW6CBxeqLGSXfbbQ0akAYfnF+niUr5u3ZJ1qb5/a6par9mnGspSfkrdnW492I B54s6i7UL4MakqWrbdT6 =n2xa -----END PGP SIGNATURE----- --4bRzO86E/ozDv8r1--