From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzDAp-0003UX-G8 for qemu-devel@nongnu.org; Tue, 25 Oct 2016 21:38:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bzDAn-0006Mq-Pu for qemu-devel@nongnu.org; Tue, 25 Oct 2016 21:38:35 -0400 Date: Wed, 26 Oct 2016 12:34:47 +1100 From: David Gibson Message-ID: <20161026013447.GS11052@umbus.fritz.box> References: <1477370856-8940-1-git-send-email-mdroth@linux.vnet.ibm.com> <1477370856-8940-5-git-send-email-mdroth@linux.vnet.ibm.com> <20161025235809.GI11052@umbus.fritz.box> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="/0GU/Wxy4LypDMTk" Content-Disposition: inline In-Reply-To: <20161025235809.GI11052@umbus.fritz.box> Subject: Re: [Qemu-devel] [PATCH 04/10] spapr: improve ibm, architecture-vec-5 property handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Roth Cc: qemu-devel@nongnu.org, nfont@linux.vnet.ibm.com, qemu-ppc@nongnu.org, jallen@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com --/0GU/Wxy4LypDMTk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 26, 2016 at 10:58:09AM +1100, David Gibson wrote: > On Mon, Oct 24, 2016 at 11:47:30PM -0500, Michael Roth wrote: > > ibm,architecture-vec-5 is supposed to encode all option vector 5 bits > > negotiated between platform/guest. Currently we hardcode this property > > in the boot-time device tree to advertise a single negotiated > > capability, "Form 1" NUMA Affinity, regardless of whether or not CAS > > has been invoked or that capability has actually been negotiated. > >=20 > > Improve this by generating ibm,architecture-vec-5 based on the full > > set of option vector 5 capabilities negotiated via CAS. > >=20 > > Signed-off-by: Michael Roth > > --- > > hw/ppc/spapr.c | 23 +++++++++++++++++------ > > include/hw/ppc/spapr_ovec.h | 1 + > > 2 files changed, 18 insertions(+), 6 deletions(-) > >=20 > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > index 3b64580..828072a 100644 > > --- a/hw/ppc/spapr.c > > +++ b/hw/ppc/spapr.c > > @@ -659,14 +659,28 @@ static int spapr_dt_cas_updates(sPAPRMachineState= *spapr, void *fdt, > > sPAPROptionVector *ov5_updates) > > { > > sPAPRMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(spapr); > > - int ret =3D 0; > > + int ret =3D 0, offset; > > =20 > > /* Generate ibm,dynamic-reconfiguration-memory node if required */ > > if (spapr_ovec_test(ov5_updates, OV5_DRCONF_MEMORY)) { > > g_assert(smc->dr_lmb_enabled); > > ret =3D spapr_populate_drconf_memory(spapr, fdt); > > + if (ret) { > > + goto out; > > + } > > } > > =20 > > + offset =3D fdt_path_offset(fdt, "/chosen"); > > + if (offset < 0) { > > + offset =3D fdt_add_subnode(fdt, 0, "chosen"); > > + if (offset < 0) { > > + return offset; > > + } >=20 > Just asserting offset >=3D 0 would be fine here. We always create a > /chosen node. Duh. Realised during testing that of course this *is* necessary for the case where we're just making a CAS patch to the tree, rather than building the whole tree. I've reverted my ill-considered change in my tree back to your original patch. >=20 > > + } > > + ret =3D spapr_ovec_populate_dt(fdt, offset, spapr->ov5_cas, > > + "ibm,architecture-vec-5"); > > + > > +out: > > return ret; > > } > > =20 > > @@ -792,14 +806,9 @@ static void spapr_dt_chosen(sPAPRMachineState *spa= pr, void *fdt) > > char *stdout_path =3D spapr_vio_stdout_path(spapr->vio_bus); > > size_t cb =3D 0; > > char *bootlist =3D get_boot_devices_list(&cb, true); > > - unsigned char vec5[] =3D {0x0, 0x0, 0x0, 0x0, 0x0, 0x80}; > > =20 > > _FDT(chosen =3D fdt_add_subnode(fdt, 0, "chosen")); > > =20 > > - /* Set Form1_affinity */ > > - _FDT(fdt_setprop(fdt, chosen, "ibm,architecture-vec-5", > > - vec5, sizeof(vec5))); > > - > > _FDT(fdt_setprop_string(fdt, chosen, "bootargs", machine->kernel_c= mdline)); > > _FDT(fdt_setprop_cell(fdt, chosen, "linux,initrd-start", > > spapr->initrd_base)); > > @@ -1778,6 +1787,8 @@ static void ppc_spapr_init(MachineState *machine) > > spapr_validate_node_memory(machine, &error_fatal); > > } > > =20 > > + spapr_ovec_set(spapr->ov5, OV5_FORM1_AFFINITY); > > + > > /* init CPUs */ > > if (machine->cpu_model =3D=3D NULL) { > > machine->cpu_model =3D kvm_enabled() ? "host" : smc->tcg_defau= lt_cpu; > > diff --git a/include/hw/ppc/spapr_ovec.h b/include/hw/ppc/spapr_ovec.h > > index 09afd59..47fa04c 100644 > > --- a/include/hw/ppc/spapr_ovec.h > > +++ b/include/hw/ppc/spapr_ovec.h > > @@ -44,6 +44,7 @@ typedef struct sPAPROptionVector sPAPROptionVector; > > =20 > > /* option vector 5 */ > > #define OV5_DRCONF_MEMORY OV_BIT(2, 2) > > +#define OV5_FORM1_AFFINITY OV_BIT(5, 0) > > =20 > > /* interfaces */ > > sPAPROptionVector *spapr_ovec_new(void); >=20 --=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 --/0GU/Wxy4LypDMTk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYEAg1AAoJEGw4ysog2bOS6fkP/36TZfmEdRi+4/mOzLeMZcf1 Tj1HnDMSu0LiOCy46kFdxYpCP0XBKUPcR2KhpNY9dKLkhlPpTcwmYFJCZ6LPTapQ iUZi/h2e5g158uLZK2gV0F+EiD5rj8KK8ZkgCMZPL4ItO36jT9amoCPg6K56lNyt 1sV+hNNyO2+sRnODBjoXCWjhMKS67to912Tgknq8AETrP/5kk2n54ZMXsJIdmqbc dzHdnAZmMwpxOJt+YWb4uy9fx9kBxsqs0gZobIV6/q6QCmbB+YiKli8Grge9xAoV Le0BDDqZ2M2vjGiVE6KAtjmw1wmft//zhG4jCUxVvoxXAMK3IgvyuFmFuI6qsZ0W bj6sRvI0VfhF0A0YCGhNgo1qib2wgDnfKk9BRO6ckgcjjxBxf0MAqGi6vVSi1Esn yJULkwpQsl+u4C6EpRdLrnqU29P7J4aj8EtrM8Gka7lRrQEh9VhBUKz/ToP+QdRF i5jzm+Qap3KK7hiqO+aTqfF7idk6xnCw+MQk+M8poMnYDnPlSWSskAMLgV3BW9N9 +KyfqiD9eYvl7/xvk1YR2yM2wYjXxnRVsURzmoYRW/Pu6xrAiEOTg2xpQEjXTw3J qPTJpsIh1D35yeLOiLC2MXCx5+RO3J41EhZjifAV+mbSbWzLYLSros8xEhsU9qH8 j8Y8fV50ougBy/zdHQvw =mVMh -----END PGP SIGNATURE----- --/0GU/Wxy4LypDMTk--