From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bzDAn-0003TT-LC 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 1bzDAk-0006Kd-DM for qemu-devel@nongnu.org; Tue, 25 Oct 2016 21:38:33 -0400 Date: Wed, 26 Oct 2016 10:58:09 +1100 From: David Gibson Message-ID: <20161025235809.GI11052@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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="W8NyRpvKkamwD9y8" Content-Disposition: inline In-Reply-To: <1477370856-8940-5-git-send-email-mdroth@linux.vnet.ibm.com> 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 --W8NyRpvKkamwD9y8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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; > + } Just asserting offset >=3D 0 would be fine here. We always create a /chosen node. > + } > + 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 *spapr= , 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_cmd= line)); > _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_default= _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 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 --W8NyRpvKkamwD9y8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYD/GRAAoJEGw4ysog2bOS9ZsP/2mi2v0iqiC/nRxwZ+ljnWFm emDAf4EBlI9Apl3pAmHcehHESpxsuXr4CZ9bvw0xPdXPT7jwWkp4SdzyVdmbx1kL N7Ff2HX7fgue1qHAivImBtx4KPCR4f15N4oFJsrcBcYfLhe/VjHMa8t7BCV/Bp+G 8y9A+g4Vljf9oreXgWxHt0tQS0L9f/GwbaJxJByJB2lIvWYzeLSQ7auCwsNyRovv 9rybc8jh4o4TTIgynLE1ymMaeOIsC3TzkxaCR3s+/A4pF7hJGrHXvHXjL2Z4c05Q 4D0pL4Yu81JpIIkoFu/T1xiEOyJZ1cT372z1emnm8hQV+FXw9EYa5SBH/ToIhLad y6e8n5IhIMfSX78sU0RfOiaPLSqCwGFHnEPU5TcHXtQS7RfAUznHJZuATdF98Zz3 Q6Uw8hLWP4x9qPHz5zfRVFzJF9OxFllFdJJNxTfucRnwkRTtxv1Y3lgHMhnicHxB EjjTyoTWpOj/JQmqJcIIm2uz35bfwf5LOhSONypn7803GrqPf82nexsSEpqeRID3 uyahmM9b7ZD3ML9/TWu8EyRW/8EdYwKZXzNpF+XZ1i+HL2NyA7SM3zYHlPSqbcRd QsmHnlztLF13+gFbZhSfJ/PaKje/Cqh0U/OMMNnjAx2shaKPvfvirO7+3kq118qV zzIuoJ2RsdOToNn8vAOr =mMd5 -----END PGP SIGNATURE----- --W8NyRpvKkamwD9y8--