From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpHT8-0005z6-MV for qemu-devel@nongnu.org; Mon, 04 May 2015 10:35:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpHT4-0007JB-UP for qemu-devel@nongnu.org; Mon, 04 May 2015 10:35:38 -0400 Date: Mon, 4 May 2015 21:46:00 +1000 From: David Gibson Message-ID: <20150504114600.GC14090@voom.redhat.com> References: <1429858066-12088-1-git-send-email-bharata@linux.vnet.ibm.com> <1429858066-12088-3-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uXxzq0nDebZQVNAZ" Content-Disposition: inline In-Reply-To: <1429858066-12088-3-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v3 02/24] spapr: Add DRC dt entries for CPUs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: mdroth@linux.vnet.ibm.com, aik@ozlabs.ru, agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, imammedo@redhat.com, afaerber@suse.de --uXxzq0nDebZQVNAZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Apr 24, 2015 at 12:17:24PM +0530, Bharata B Rao wrote: > Advertise CPU DR-capability to the guest via device tree. >=20 > Signed-off-by: Bharata B Rao > Signed-off-by: Michael Roth > [spapr_drc_reset implementation] > --- > hw/ppc/spapr.c | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 981814d..9ea3a38 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -807,6 +807,15 @@ static void spapr_finalize_fdt(sPAPREnvironment *spa= pr, > spapr_populate_chosen_stdout(fdt, spapr->vio_bus); > } > =20 > + if (spapr->dr_cpu_enabled) { > + int offset =3D fdt_path_offset(fdt, "/cpus"); > + ret =3D spapr_drc_populate_dt(fdt, offset, NULL, > + SPAPR_DR_CONNECTOR_TYPE_CPU); > + if (ret < 0) { > + fprintf(stderr, "Couldn't set up CPU DR device tree properti= es\n"); > + } > + } > + > _FDT((fdt_pack(fdt))); > =20 > if (fdt_totalsize(fdt) > FDT_MAX_SIZE) { > @@ -1393,6 +1402,16 @@ static SaveVMHandlers savevm_htab_handlers =3D { > .load_state =3D htab_load, > }; > =20 > +static void spapr_drc_reset(void *opaque) > +{ > + sPAPRDRConnector *drc =3D opaque; > + DeviceState *d =3D DEVICE(drc); > + > + if (d) { > + device_reset(d); > + } > +} Why do these need an explicit reset, rather than having their reset hook automatically called by the qdev infrastructure? I'm guessing it's something to do with how these are linked into the qdev tree, but it could do with a comment clarifying this. > /* pSeries LPAR / sPAPR hardware init */ > static void ppc_spapr_init(MachineState *machine) > { > @@ -1418,6 +1437,7 @@ static void ppc_spapr_init(MachineState *machine) > long load_limit, fw_size; > bool kernel_le =3D false; > char *filename; > + int smt =3D kvmppc_smt_threads(); > =20 > msi_supported =3D true; > =20 > @@ -1482,6 +1502,15 @@ static void ppc_spapr_init(MachineState *machine) > spapr->dr_cpu_enabled =3D smc->dr_cpu_enabled; > spapr->dr_lmb_enabled =3D smc->dr_lmb_enabled; > =20 > + if (spapr->dr_cpu_enabled) { > + for (i =3D 0; i < max_cpus/smp_threads; i++) { > + sPAPRDRConnector *drc =3D > + spapr_dr_connector_new(OBJECT(machine), > + SPAPR_DR_CONNECTOR_TYPE_CPU, i * = smt); > + qemu_register_reset(spapr_drc_reset, drc); > + } > + } > + > /* init CPUs */ > if (cpu_model =3D=3D NULL) { > cpu_model =3D kvm_enabled() ? "host" : "POWER7"; --=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 --uXxzq0nDebZQVNAZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVR1v4AAoJEGw4ysog2bOSrwoQALJJF2jMlzda5PpLM0siKANe wc8QU3FfXGRbWVe3BmfY4s81EDLggXgIKNpSbDCXlcDpLFlvO//qqWMNJvK+Ixce rXzWfd5xXu3IhC1/FAq5g2+hzgzJ5HgLyaAsVQN+N6hXaR7QzdbNzguxJPQzcTM9 iQYpXslROsR2kaafplR/2rnBznbe/mUOIap3c4xKehOoTLh+Wosnb52097bQOs0K mbi14X8K7gc5ZyDf4hS7XPTNYoYQWBsC+HuDYscUF+DERQA+xX3n/ZfMH3l3YAho 0w8Y+Y8yf0F0GtBN93rb5s6goCVWVyaOwaO/yHOFKs+DUV1rLktTdlrqbIpCcBJ7 7GZs8nWbtcllLqTfcyORDuMRUL3B6G2y7jI/HM2jCuJ11O+qt+kb3jFbRQ2jNlb5 u0dmTG7yuGPmsMPfELwujY8/8wq8lU3nf5Z6Rmk6SDnH8yfK40y0ljSLZXFOaGcE B/M+BT8FQQEA5XqJsHRAtGtaYLKllQ2ZaS03Mcf4tz4S/hPdbC1ZNFrfMXuOofkq osnsd36ApfiCOG9gBpZBljkgvGEI7EmZGUMizZc010h58yh25j00u2pG690RawFG eaoqFqaCvhEbjf3ww7PhMQjDe6iclT8p/shwhYeVaiC01JGpGap9LJARhWwP8O92 YtqrVvaqY9dFQtfQcPuB =qawS -----END PGP SIGNATURE----- --uXxzq0nDebZQVNAZ--