From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buuby-0008VW-6Z for qemu-devel@nongnu.org; Fri, 14 Oct 2016 01:00:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buubt-00039R-Rl for qemu-devel@nongnu.org; Fri, 14 Oct 2016 01:00:49 -0400 Date: Fri, 14 Oct 2016 15:59:37 +1100 From: David Gibson Message-ID: <20161014045937.GK28562@umbus> References: <1476314039-9520-1-git-send-email-mdroth@linux.vnet.ibm.com> <1476314039-9520-10-git-send-email-mdroth@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QxIEt88oQPsT6QmF" Content-Disposition: inline In-Reply-To: <1476314039-9520-10-git-send-email-mdroth@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH 09/11] spapr: Add DRC count indexed hotplug identifier type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, jallen@linux.vnet.ibm.com --QxIEt88oQPsT6QmF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 12, 2016 at 06:13:57PM -0500, Michael Roth wrote: > From: Bharata B Rao >=20 > 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 > Signed-off-by: Bharata B Rao > * updated rtas_event_log_v6_hp to reflect count/index field ordering > used in PAPR hotplug ACR > Signed-off-by: Michael Roth > --- > hw/ppc/spapr_events.c | 74 ++++++++++++++++++++++++++++++++++++++++----= ------ > include/hw/ppc/spapr.h | 4 +++ > 2 files changed, 63 insertions(+), 15 deletions(-) >=20 > diff --git a/hw/ppc/spapr_events.c b/hw/ppc/spapr_events.c > index f8bbec6..eeca800 100644 > --- a/hw/ppc/spapr_events.c > +++ b/hw/ppc/spapr_events.c > @@ -175,6 +175,16 @@ struct epow_log_full { > struct rtas_event_log_v6_epow epow; > } QEMU_PACKED; > =20 > +union drc_identifier { > + uint32_t index; > + uint32_t count; > + struct { > + uint32_t count; > + uint32_t index; > + } count_indexed; > + 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; > @@ -191,12 +201,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_identifier drc_id; > } QEMU_PACKED; > =20 > struct hp_log_full { > @@ -457,7 +464,7 @@ static void spapr_hotplug_set_signalled(uint32_t drc_= index) > =20 > static void spapr_hotplug_req_event(uint8_t hp_id, uint8_t hp_action, > sPAPRDRConnectorType drc_type, > - uint32_t drc) > + union drc_identifier *drc_id) > { > sPAPRMachineState *spapr =3D SPAPR_MACHINE(qdev_get_machine()); > struct hp_log_full *new_hp; > @@ -502,7 +509,7 @@ static void spapr_hotplug_req_event(uint8_t hp_id, ui= nt8_t hp_action, > case SPAPR_DR_CONNECTOR_TYPE_PCI: > hp->hotplug_type =3D RTAS_LOG_V6_HP_TYPE_PCI; > if (hp->hotplug_action =3D=3D RTAS_LOG_V6_HP_ACTION_ADD) { > - spapr_hotplug_set_signalled(drc); > + spapr_hotplug_set_signalled(drc_id->index); > } > break; > case SPAPR_DR_CONNECTOR_TYPE_LMB: > @@ -520,9 +527,16 @@ 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) { > + /* we should not be using count_indexed value unless the guest > + * supports dedicated hotplug event source > + */ > + g_assert(spapr_ovec_test(spapr->ov5_cas, OV5_HP_EVT)); > + hp->drc_id.count_indexed.count =3D cpu_to_be32(drc_id->count_ind= exed.count); > + hp->drc_id.count_indexed.index =3D cpu_to_be32(drc_id->count_ind= exed.index); > } > =20 > rtas_event_log_queue(RTAS_LOG_TYPE_HOTPLUG, new_hp, true); > @@ -535,34 +549,64 @@ 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_identifier drc_id; > =20 > + drc_id.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); > + 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_identifier drc_id; > =20 > + drc_id.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); > + 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_identifier 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_identifier 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_add_by_count_indexed(sPAPRDRConnectorType drc_typ= e, > + uint32_t count, uint32_t ind= ex) > +{ > + union drc_identifier drc_id; > + > + drc_id.count_indexed.count =3D count; > + drc_id.count_indexed.index =3D index; > + spapr_hotplug_req_event(RTAS_LOG_V6_HP_ID_DRC_COUNT_INDEXED, > + RTAS_LOG_V6_HP_ACTION_ADD, drc_type, &drc_id= ); > +} > + > +void spapr_hotplug_req_remove_by_count_indexed(sPAPRDRConnectorType drc_= type, > + uint32_t count, uint32_t = index) > +{ > + union drc_identifier drc_id; > + > + drc_id.count_indexed.count =3D count; > + drc_id.count_indexed.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 2295ac6..11a2597 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -602,6 +602,10 @@ void spapr_hotplug_req_add_by_count(sPAPRDRConnector= Type drc_type, > uint32_t count); > void spapr_hotplug_req_remove_by_count(sPAPRDRConnectorType drc_type, > uint32_t count); > +void spapr_hotplug_req_add_by_count_indexed(sPAPRDRConnectorType drc_typ= e, > + uint32_t count, uint32_t ind= ex); > +void spapr_hotplug_req_remove_by_count_indexed(sPAPRDRConnectorType drc_= type, > + uint32_t count, uint32_t = index); > void spapr_cpu_init(sPAPRMachineState *spapr, PowerPCCPU *cpu, Error **e= rrp); > void *spapr_populate_hotplug_cpu_dt(CPUState *cs, int *fdt_offset, > sPAPRMachineState *spapr); --=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 --QxIEt88oQPsT6QmF Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYAGY5AAoJEGw4ysog2bOSEx8P/j5hHP/kykll6S0TphlkTgOb 9xeKboMvRAAjHVAyFlO740sdiH1E3mhISsHWJ31o+QkDxOe+pMJlFZCLDEiF3iZL 8H/z6SCJSdNSvsmOiP8uix5vQGOEuiLFrk1DwXadCJHgINqxW25Hj92HkfsePBkQ O+lbS7reKIXrmT9nw+C0UftkXkh4fEje4lfuRyPmk4IrIbzTd7WmYaBmZdYg+e5O cNWzkUgfKdjDiF8d/pOGYGakYzRMjsINI9sz3nbGYpJSjLDMQPkyyX8kTsHTIVlv BKH68FnpGZp/9BxYSlqdw0BgJrysgPFJ9xE6p8ItxI9ZNQeGiStzyaMzG4KesIUE EMvsAG48yq07RJbF1towHIcAYGRDMoRQcvr/tmgveUK22sglGFWXMAaPcrJ6RSUy YW4miqZmZZjF6j3Q8u8nTDPD1eL/BDcM4O1zvL1E2Txh9sFv5Db8ZzaLQCwIarPJ fK2IVbHiKDdcN8RPNRQ5dVNB4EupDrscrowJvCDMpBTbVoHDoI3RwPV7n6IHb6mg 7mlkhC07K3AbWaOlxsbEhHENHUouwlqO9BBwfxLhTHd2n1lP/j2JfwKh3ZGcTy4W 2btfLatEQRCEi2rMDTuNVx4/E3gtUmA+15wn7NvTftI58XZZ/6ZVbVAe2lL71DjO MyaHAViTnqUSJif9BXkp =nd/G -----END PGP SIGNATURE----- --QxIEt88oQPsT6QmF--