Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1iTuUH-0007Jv-KC for mharc-qemu-riscv@gnu.org; Sun, 10 Nov 2019 16:11:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55993) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTuUB-0007Fo-RN for qemu-riscv@nongnu.org; Sun, 10 Nov 2019 16:11:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iTuUA-0004lv-Jk for qemu-riscv@nongnu.org; Sun, 10 Nov 2019 16:11:03 -0500 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:35913 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iTuU6-0004U7-JB; Sun, 10 Nov 2019 16:10:59 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 47B69g4d0Vz9sNx; Mon, 11 Nov 2019 08:10:47 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1573420247; bh=v5qDauUW5khZHryv3daXxIa4v7785PoQZ+Oopx4R+9M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g2d7WLEbUvvJd0WQk2hmTLsivIPdN1ibC41UUb+qVE89JCS8n4VSNOeQ9bFxTP8S8 NuxOF3aITwuQmOX1VmPoosq/RQAz1dP/KBL9dNMcx+bhZcjZD629Kkl8CB3R+liOVQ 7iloJzmcRSxWPXkHsXuQK21ZylP94TyCxK2q2fOw= Date: Sun, 10 Nov 2019 19:47:23 +0000 From: David Gibson To: Peter Maydell Cc: Palmer Dabbelt , Alistair Francis , QEMU Developers , "open list:RISC-V" Subject: Re: [PATCH v2 2/3] ARM/virt: Use fdt_setprop_strings() Message-ID: <20191110194723.GS2461@umbus.Home> References: <20191108194758.17813-1-palmer@dabbelt.com> <20191108194758.17813-3-palmer@dabbelt.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="A3RWl4qWgABmkY4K" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 X-BeenThere: qemu-riscv@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 21:11:05 -0000 --A3RWl4qWgABmkY4K Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 09, 2019 at 03:56:21PM +0000, Peter Maydell wrote: > On Fri, 8 Nov 2019 at 19:48, Palmer Dabbelt wrote: > > > > This new helper function encodes the idiom used by the ARM virt board to > > set a string array. I don't currently have a working ARM userspace, so= I haven't tested > > this, but I made the helper function because I wanted to use it for the > > RISC-V virt board where I have tested it. > > > > Signed-off-by: Palmer Dabbelt > > --- > > hw/arm/virt.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/hw/arm/virt.c b/hw/arm/virt.c > > index d4bedc2607..4dc00f54d5 100644 > > --- a/hw/arm/virt.c > > +++ b/hw/arm/virt.c > > @@ -304,9 +304,8 @@ static void fdt_add_timer_nodes(const VirtMachineSt= ate *vms) > > > > armcpu =3D ARM_CPU(qemu_get_cpu(0)); > > if (arm_feature(&armcpu->env, ARM_FEATURE_V8)) { > > - const char compat[] =3D "arm,armv8-timer\0arm,armv7-timer"; > > - qemu_fdt_setprop(vms->fdt, "/timer", "compatible", > > - compat, sizeof(compat)); > > + qemu_fdt_setprop_strings(vms->fdt, "/timer", "compatible", > > + "arm,armv8-timer\0arm,armv7-timer\0"); > > } else { >=20 >=20 > This seems to be changing the property we put in -- in > the old code it is 'foo\0bar\0', but in the new code > there will end up being two \0 at the end: 'foo\0bar\0\0'. In fact it's not because the setprop_strings() helper just uses the \0\0 to detect the end, but truncates what it actually puts into the dtb at the first \0. But I agree this is confusing enough not to really be an improvement over the original version. --=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 --A3RWl4qWgABmkY4K Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAl3IaUsACgkQbDjKyiDZ s5JNiQ//dQzJ3b9Z0jnIoeHqf7B+FFJvza+sCqMD0cN8MgVEA8az8w7jnDOpV8he Ui10nBm4fQAFWGPMVnz2pXDi8FZjzR7+ZRgWS1hgdEbKz3nck6724bZ01NLUm1lJ kVzSg+xKykkzFj2ez/D46FE2tmjhGic1UyaE4ScjdbsbJNZ5MQ+CWxdHeVVQ4pYb HgYR6JOxaRyqaZaTOt2xToUjTlwrbDWdwDpvrKbwRMEAAOXOosWLKBgHjkorEVEP MeX6GgUVXqt1AWhATKdw//G36sqOcGA0zXAK1cfacaDYN0kEOjyFYxpAhzBjLT1N lRMwfa3sOKggMuK35/XPiiN8/l/tK5haDYvVddgGdIyU1pYbjkwa0ocGqsKgJVtO RmN53IsaE4hEQywIGRu27PFy1QXw6KFmdlLo56GhpRkxCnFH3BeKZpo/oFHnXmPi 81c0c4NQCQzpRMq4itJBF6ewyA8jw3BVA6cUuFFVrGb131MUwHt29Wke4lRj0MjO 9imh1z84dvgs/g0aQsnKv+cv3znOcr7TSEq8o6UnhoYbv5rkXk69ftAnsAggHEN7 M9DrbESEjY8Ju6tShcyKFaFcx/XvM2z3b74MhNuXVLmaxb5rLGIWNCwACMVksXzb 25Db/m7JV+gv7Q6Mx/afvbEpFWzlGu0diWi0iru1FreMHMIUVvs= =E/uG -----END PGP SIGNATURE----- --A3RWl4qWgABmkY4K--