From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEPC8-0002yF-59 for qemu-devel@nongnu.org; Thu, 22 Jan 2015 16:21:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEPC3-0004Z2-0o for qemu-devel@nongnu.org; Thu, 22 Jan 2015 16:21:40 -0500 Received: from e31.co.us.ibm.com ([32.97.110.149]:46382) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEPC2-0004Yj-QF for qemu-devel@nongnu.org; Thu, 22 Jan 2015 16:21:34 -0500 Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Jan 2015 14:21:31 -0700 Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id CBBFF3E4003B for ; Thu, 22 Jan 2015 14:21:27 -0700 (MST) Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t0MLKAEl29622294 for ; Thu, 22 Jan 2015 14:20:10 -0700 Received: from d03av05.boulder.ibm.com (localhost [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t0MLLRXu014561 for ; Thu, 22 Jan 2015 14:21:27 -0700 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1420697420-16053-3-git-send-email-bharata@linux.vnet.ibm.com> References: <1420697420-16053-1-git-send-email-bharata@linux.vnet.ibm.com> <1420697420-16053-3-git-send-email-bharata@linux.vnet.ibm.com> Message-ID: <20150122212126.30063.7632@loki> Date: Thu, 22 Jan 2015 15:21:26 -0600 Subject: Re: [Qemu-devel] [RFC PATCH v1 02/13] spapr: Add DRC dt entries for CPUs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao , qemu-devel@nongnu.org Cc: imammedo@redhat.com, agraf@suse.de Quoting Bharata B Rao (2015-01-08 00:10:09) > Advertise CPU DR-capability to the guest via device tree. > = > Signed-off-by: Bharata B Rao > Signed-off-by: Michael Roth > [spapr_drc_reset implementation] > --- > hw/ppc/spapr.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > = > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 71e7052..98a32d0 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -807,6 +807,14 @@ static void spapr_finalize_fdt(sPAPREnvironment *spa= pr, > spapr_populate_chosen_stdout(fdt, spapr->vio_bus); > } > = > + if (spapr->dr_cpu_enabled) { > + int offset =3D fdt_path_offset(fdt, "/cpus"); > + ret =3D spapr_drc_populate_dt(fdt, offset, SPAPR_DR_CONNECTOR_TY= PE_CPU); > + if (ret < 0) { > + fprintf(stderr, "Couldn't set up CPU DR device tree properti= es\n"); > + } > + } > + Doesn't hurt to add the check, but spapr_drc_populate_dt() tries to be smart enough to no-op if there's no drc's that have been created for resources of the specified type, so spapr_dr_connector_new() *should* be the only spots where it's necessary to check spapr->dr_cpu_enabled. > _FDT((fdt_pack(fdt))); > = > if (fdt_totalsize(fdt) > FDT_MAX_SIZE) { > @@ -1358,6 +1366,16 @@ static SaveVMHandlers savevm_htab_handlers =3D { > .load_state =3D htab_load, > }; > = > +static void spapr_drc_reset(void *opaque) > +{ > + sPAPRDRConnector *drc =3D opaque; > + DeviceState *d =3D DEVICE(drc); > + > + if (d) { > + device_reset(d); > + } > +} > + > /* pSeries LPAR / sPAPR hardware init */ > static void ppc_spapr_init(MachineState *machine) > { > @@ -1383,6 +1401,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(); > = > msi_supported =3D true; > = > @@ -1526,6 +1545,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; > = > + 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); > + } > + = > + > /* Set up PCI */ > spapr_pci_rtas_init(); > = > -- = > 2.1.0