From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ag1i5-0006xV-BZ for qemu-devel@nongnu.org; Tue, 15 Mar 2016 23:01:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ag1i1-00060l-6L for qemu-devel@nongnu.org; Tue, 15 Mar 2016 23:01:21 -0400 Date: Wed, 16 Mar 2016 12:29:24 +1100 From: David Gibson Message-ID: <20160316012924.GB9032@voom> References: <1458016736-10544-1-git-send-email-bharata@linux.vnet.ibm.com> <1458016736-10544-2-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wNT7VBaN1rUIB9jO" Content-Disposition: inline In-Reply-To: <1458016736-10544-2-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v2 1/2] spapr: Add DRC count indexed hotplug identifier type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: thuth@redhat.com, qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, qemu-ppc@nongnu.org, nfont@linux.vnet.ibm.com, imammedo@redhat.com --wNT7VBaN1rUIB9jO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 15, 2016 at 10:08:55AM +0530, Bharata B Rao wrote: > Add support for DRC count indexed hotplug ID type which is primarily > needed for memory hot unplug. This type allows for specifying the > number of DRs that should be plugged/unplugged starting from a given > DRC index. >=20 > NOTE: This new hotplug identifier type is not yet part of PAPR. >=20 > Signed-off-by: Bharata B Rao Reviewed-by: David Gibson Looks correct, but obviously I won't apply until the change reaches PAPR. > --- > hw/ppc/spapr_events.c | 57 +++++++++++++++++++++++++++++++++++++-------= ------ > include/hw/ppc/spapr.h | 2 ++ > 2 files changed, 45 insertions(+), 14 deletions(-) >=20 > diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c > index 39f4682..5d1d13d 100644 > --- a/hw/ppc/spapr_events.c > +++ b/hw/ppc/spapr_events.c > @@ -171,6 +171,16 @@ struct epow_log_full { > struct rtas_event_log_v6_epow epow; > } QEMU_PACKED; > =20 > +union drc_id { > + uint32_t index; > + uint32_t count; > + struct count_index { > + uint32_t index; > + uint32_t count; > + } count_index; > + char name[1]; > +} QEMU_PACKED; > + > struct rtas_event_log_v6_hp { > #define RTAS_LOG_V6_SECTION_ID_HOTPLUG 0x4850 /* HP */ > struct rtas_event_log_v6_section_header hdr; > @@ -187,12 +197,9 @@ struct rtas_event_log_v6_hp { > #define RTAS_LOG_V6_HP_ID_DRC_NAME 1 > #define RTAS_LOG_V6_HP_ID_DRC_INDEX 2 > #define RTAS_LOG_V6_HP_ID_DRC_COUNT 3 > +#define RTAS_LOG_V6_HP_ID_DRC_COUNT_INDEXED 4 > uint8_t reserved; > - union { > - uint32_t index; > - uint32_t count; > - char name[1]; > - } drc; > + union drc_id drc_id; > } QEMU_PACKED; > =20 > struct hp_log_full { > @@ -389,7 +396,7 @@ static void spapr_powerdown_req(Notifier *n, void *op= aque) > =20 > static void spapr_hotplug_req_event(uint8_t hp_id, uint8_t hp_action, > sPAPRDRConnectorType drc_type, > - uint32_t drc) > + union drc_id *drc_id) > { > sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); > struct hp_log_full *new_hp; > @@ -446,9 +453,12 @@ static void spapr_hotplug_req_event(uint8_t hp_id, u= int8_t hp_action, > } > =20 > if (hp_id =3D=3D RTAS_LOG_V6_HP_ID_DRC_COUNT) { > - hp->drc.count =3D cpu_to_be32(drc); > + hp->drc_id.count =3D cpu_to_be32(drc_id->count); > } else if (hp_id =3D=3D RTAS_LOG_V6_HP_ID_DRC_INDEX) { > - hp->drc.index =3D cpu_to_be32(drc); > + hp->drc_id.index =3D cpu_to_be32(drc_id->index); > + } else if (hp_id =3D=3D RTAS_LOG_V6_HP_ID_DRC_COUNT_INDEXED) { > + hp->drc_id.count_index.count =3D cpu_to_be32(drc_id->count_index= =2Ecount); > + hp->drc_id.count_index.index =3D cpu_to_be32(drc_id->count_index= =2Eindex); > } > =20 > rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, new_hp, true); > @@ -460,34 +470,53 @@ void spapr_hotplug_req_add_by_index(sPAPRDRConnecto= r *drc) > { > sPAPRDRConnectorClass *drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); > sPAPRDRConnectorType drc_type =3D drck->get_type(drc); > - uint32_t index =3D drck->get_index(drc); > + union drc_id drc_id; > + drc_id.index =3D drck->get_index(drc); > =20 > spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_INDEX, > - RTAS_LOG_V6_HP_ACTION_ADD, drc_type, index); > + RTAS_LOG_V6_HP_ACTION_ADD, drc_type, &drc_id= ); > } > =20 > 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_t index =3D drck->get_index(drc); > + union drc_id drc_id; > + drc_id.index =3D drck->get_index(drc); > =20 > spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_INDEX, > - RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, inde= x); > + RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, &drc= _id); > } > =20 > void spapr_hotplug_req_add_by_count(sPAPRDRConnectorType drc_type, > uint32_t count) > { > + union drc_id drc_id; > + drc_id.count =3D count; > + > spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_COUNT, > - RTAS_LOG_V6_HP_ACTION_ADD, drc_type, count); > + RTAS_LOG_V6_HP_ACTION_ADD, drc_type, &drc_id= ); > } > =20 > void spapr_hotplug_req_remove_by_count(sPAPRDRConnectorType drc_type, > uint32_t count) > { > + union drc_id drc_id; > + drc_id.count =3D count; > + > spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_COUNT, > - RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, coun= t); > + RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, &drc= _id); > +} > + > +void spapr_hotplug_req_remove_by_count_indexed(sPAPRDRConnectorType drc_= type, > + uint32_t count, uint32_t = index) > +{ > + union drc_id drc_id; > + drc_id.count_index.count =3D count; > + drc_id.count_index.index =3D index; > + > + spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_COUNT_INDEXED, > + RTAS_LOG_V6_HP_ACTION_REMOVE, drc_type, &drc= _id); > } > =20 > static void check_exception(PowerPCCPU *cpu, sPAPRMachineState *spapr, > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index 098d85d..f0c426b 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -585,6 +585,8 @@ void spapr_hotplug_req_add_by_count(sPAPRDRConnectorT= ype drc_type, > uint32_t count); > void spapr_hotplug_req_remove_by_count(sPAPRDRConnectorType drc_type, > uint32_t count); > +void spapr_hotplug_req_remove_by_count_indexed(sPAPRDRConnectorType drc_= type, > + uint32_t count, uint32_t = index); > =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 --wNT7VBaN1rUIB9jO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJW6Lb0AAoJEGw4ysog2bOS/isP/1gFJVIQoPqZ8JS+g61YNnm0 px9tzfQj7YZc+55oT+LmvpqFzLT9gXWAUsEJdn4xfTr1TF4zSzEsMOdp1F7pOlys n0l1rR24vta04gy6vGaPoFLQ/wPYeuYzw/whPtjtK9+nQI8u4sQ/es2kWST1tVLz y5fObdSLwZUk68FI0UvLNt/cZZwhgrsaIK1xhdK0c4v/ycd3qY0mEO43jxhQoFwI TwQi1pEv4yi3PXshOtlO+ZDH+8z0UKWuZMWKvskYRh6321XHd/H0wA2K80dVYcxI Ex7IZMMAzIbIDHCiMJfRH22SU1z6Tk4U5uv+b6/s4fNi9OP/MAmKlNwNizcfVEjr UPvHJyCb2tdZv/wWiJhToJoCsu5tXWHW9Uf7S93V8LvbBzkBrqL5KTK5sy3keQMD f3dRzCUrALG0hm0PD1yR9/qfZvy1Btn1ygfQpgCrkM7VToHG4tgj4n/NLde8G+vI IDGt64rnjtKnSOU2Mkfr88DgsR4F+EBDjK18UDbxFAgJGOOrUqQARDpdczPb2sza mzvnsHoFxlR/G2wlKGCHZY97VJhX7QRk8O6aN8Vqa/VVhTuhY2mlYr1zm16QD1gZ edGrI60dtcAEHBUoxn8WZdAXXlCaxvL7tPQ0XUrmxJF6pHRCpZkBPd3ROWofXpfk 9eSQRyDj+sAgFlORttjV =kQr/ -----END PGP SIGNATURE----- --wNT7VBaN1rUIB9jO--