From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxOz7-0001fN-5l for qemu-devel@nongnu.org; Thu, 20 Oct 2016 21:51:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxOz4-0001GA-3z for qemu-devel@nongnu.org; Thu, 20 Oct 2016 21:51:01 -0400 Date: Fri, 21 Oct 2016 12:41:43 +1100 From: David Gibson Message-ID: <20161021014142.GB3706@umbus.fritz.box> References: <1476940330-27705-1-git-send-email-david@gibson.dropbear.id.au> <1476940330-27705-9-git-send-email-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XOIedfhf+7KOe/yw" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 08/13] spapr: Consolidate construction of /chosen device tree node List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth Cc: aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, groug@kaod.org, agraf@suse.de, lvivier@redhat.com, qemu-ppc@nongnu.org, qemu-devel@nongnu.org --XOIedfhf+7KOe/yw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 20, 2016 at 09:49:42AM +0200, Thomas Huth wrote: > On 20.10.2016 07:12, David Gibson wrote: > > For historical reasons, building the /chosen node in the guest device t= ree > > is split across several places and includes both parts which write the = DT > > sequentially and others which use random access functions. > >=20 > > This patch consolidates construction of the node into one place, using > > random access functions throughout. > >=20 > > Signed-off-by: David Gibson > > --- > > hw/ppc/spapr.c | 131 ++++++++++++++++++++++---------------= -------- > > hw/ppc/spapr_vio.c | 17 ++---- > > include/hw/ppc/spapr_vio.h | 2 +- > > 3 files changed, 70 insertions(+), 80 deletions(-) > >=20 > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > index 2faae32..c608ec8 100644 > > --- a/hw/ppc/spapr.c > > +++ b/hw/ppc/spapr.c > > @@ -273,14 +273,10 @@ static void add_str(GString *s, const gchar *s1) > > =20 > > static void *spapr_create_fdt_skel(sPAPRMachineState *spapr) > > { > > - MachineState *machine =3D MACHINE(spapr); > > void *fdt; > > - uint32_t start_prop =3D cpu_to_be32(spapr->initrd_base); > > - uint32_t end_prop =3D cpu_to_be32(spapr->initrd_base + spapr->init= rd_size); > > GString *hypertas =3D g_string_sized_new(256); > > GString *qemu_hypertas =3D g_string_sized_new(256); > > uint32_t refpoints[] =3D {cpu_to_be32(0x4), cpu_to_be32(0x4)}; > > - unsigned char vec5[] =3D {0x0, 0x0, 0x0, 0x0, 0x0, 0x80}; > > char *buf; > > =20 > > add_str(hypertas, "hcall-pft"); > > @@ -337,35 +333,6 @@ static void *spapr_create_fdt_skel(sPAPRMachineSta= te *spapr) > > _FDT((fdt_property_cell(fdt, "#address-cells", 0x2))); > > _FDT((fdt_property_cell(fdt, "#size-cells", 0x2))); > > =20 > > - /* /chosen */ > > - _FDT((fdt_begin_node(fdt, "chosen"))); > > - > > - /* Set Form1_affinity */ > > - _FDT((fdt_property(fdt, "ibm,architecture-vec-5", vec5, sizeof(vec= 5)))); > > - > > - _FDT((fdt_property_string(fdt, "bootargs", machine->kernel_cmdline= ))); > > - _FDT((fdt_property(fdt, "linux,initrd-start", > > - &start_prop, sizeof(start_prop)))); > > - _FDT((fdt_property(fdt, "linux,initrd-end", > > - &end_prop, sizeof(end_prop)))); > > - if (spapr->kernel_size) { > > - uint64_t kprop[2] =3D { cpu_to_be64(KERNEL_LOAD_ADDR), > > - cpu_to_be64(spapr->kernel_size) }; > > - > > - _FDT((fdt_property(fdt, "qemu,boot-kernel", &kprop, sizeof(kpr= op)))); > > - if (spapr->kernel_le) { > > - _FDT((fdt_property(fdt, "qemu,boot-kernel-le", NULL, 0))); > > - } > > - } > > - if (boot_menu) { > > - _FDT((fdt_property_cell(fdt, "qemu,boot-menu", boot_menu))); > > - } > > - _FDT((fdt_property_cell(fdt, "qemu,graphic-width", graphic_width))= ); > > - _FDT((fdt_property_cell(fdt, "qemu,graphic-height", graphic_height= ))); > > - _FDT((fdt_property_cell(fdt, "qemu,graphic-depth", graphic_depth))= ); > > - > > - _FDT((fdt_end_node(fdt))); > > - > > /* RTAS */ > > _FDT((fdt_begin_node(fdt, "rtas"))); > > =20 > > @@ -873,6 +840,68 @@ int spapr_h_cas_compose_response(sPAPRMachineState= *spapr, > > return 0; > > } > > =20 > > +static void spapr_dt_chosen(sPAPRMachineState *spapr, void *fdt) > > +{ > > + MachineState *machine =3D MACHINE(spapr); > > + int chosen; > > + const char *boot_device =3D machine->boot_order; > > + char *stdout =3D spapr_vio_stdout_path(spapr->vio_bus); >=20 > Ah, by the way, calling a variable "stdout" like the FILE* from stdio.h > feels somewhat wrong ... could you maybe use another name here instead? Ah.. a very good idea. Given the troubles I've seen with variables called 'index' shadowing the standard library function, calling it stdout is a terrible idea. --=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 --XOIedfhf+7KOe/yw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYCXJUAAoJEGw4ysog2bOSp/cP/iEVSij56g+qswG2GZehN59u ZQ3Hq2N/UM636lclReYR8pfTje8Drb9TWSUjd72v7D7VMViBbOvNZTEXMaB3rBQq t0rCho6e/B2Sa5GMuR8hTKW4qINMAdY7N+CsHiW664LigluH5IXBpDqLFnu05xt7 K89zGGtcg/N+RY7Jvt9WQR26ktlM0zL1O+XEfIoijykPyXl86oHPTNRdBE9xQy4P bDYlWGmwlh3/YhosPnKWqbwERLjLuBGR61eynll17c5Utk++bxtwFXExFEomCqyd LfodSHRnTradc1GOx3GnvfoboyM/7sVWU1AhkB750m4A83fEE7BtP4ewp4B77YSL nXDDDjkyaX3AYtR26DJYw5LcBjWfTJt3cb1uMM+mxC/6SP/Z8EYkTB3Y81olRLw/ 7POjMlqgwDHyMqYRTNqLs9B721XGZyJE37sFIUglvkVD61e9Bfsv40tr6vrbvdcU o7gSvccCVMh2IZ5LCaBFlQig7ntMJcOeskbT0OcNKCfwk+0oqkdAEfzdf3VBfxTJ +yHTIaz7bD/zaKIvOc75EXQMdD8+P3lYxIsBBalXf8yfffbNZ466aNOSG6shIhGc BDG0Qlhe6KU3NWQkRyI+H0FJSBeM8nI4pvylfeyWcSz6DWcJKkYv4jpF2lDRaKv3 UpQJU+1UTwPrBM1Gcr3v =7eMU -----END PGP SIGNATURE----- --XOIedfhf+7KOe/yw--