From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btoMx-0006F2-0F for qemu-devel@nongnu.org; Tue, 11 Oct 2016 00:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btoMr-0002lj-UH for qemu-devel@nongnu.org; Tue, 11 Oct 2016 00:08:45 -0400 Received: from ozlabs.org ([103.22.144.67]:41715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btoMr-0002kB-80 for qemu-devel@nongnu.org; Tue, 11 Oct 2016 00:08:41 -0400 Date: Tue, 11 Oct 2016 14:56:23 +1100 From: David Gibson Message-ID: <20161011035623.GD8952@umbus.fritz.box> References: <1475835267-7300-1-git-send-email-lvivier@redhat.com> <20161007124849.7c867d79@bahia> <20161010045552.GC22498@umbus.fritz.box> <20161010133954.GJ22498@umbus.fritz.box> <20161011012429.GA8952@umbus.fritz.box> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Hf61M2y+wYpnELGG" Content-Disposition: inline In-Reply-To: <20161011012429.GA8952@umbus.fritz.box> Subject: Re: [Qemu-devel] [PATCH v2] qtest: ask endianness of the target in qtest_init() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Greg Kurz , Laurent Vivier , QEMU Developers --Hf61M2y+wYpnELGG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 11, 2016 at 12:24:29PM +1100, David Gibson wrote: > On Mon, Oct 10, 2016 at 03:10:33PM +0100, Peter Maydell wrote: > > On 10 October 2016 at 14:39, David Gibson = wrote: > > > In the overwhelming majority of cases the endianness of the device is > > > known independent of the guest CPU and board. > >=20 > > We don't seem to model things that way: > >=20 > > $ git grep '.endianness =3D DEVICE_NATIVE' |wc -l > > 341 > > $ git grep '.endianness =3D DEVICE_BIG' |wc -l > > 18 > > $ git grep '.endianness =3D DEVICE_LITTLE' |wc -l > > 172 >=20 > Sigh. So, most of these are themselves mistakes. >=20 > A lot of these are target specific devices that should be tagged with > their target's (notional) endianness, rather than NATIVE. That > covers: A couple of points of clarification here. When I say the "device" endianness is known, that's a little sloppy. I mean that the endianness of each specific register (or DMA field) has a known endianness. The device as a whole does not have well defined endianness except insofar as one device will generally use the same endianness for all its >8bit registers and/or DMA fields. There are a few exceptions of course. virtio-balloon (pre 1.0) on a notionally BE platform is a horrible example: its PCI config space is LE, the generic part of the virtio config space is BE ("native") and the balloon specific part is LE again (due to a screwup in the spec). Intermediate bridges in the system (on or off chip) won't affect this, *as long as* they preserve byte address invariance. If they *don't* preserve byte address invariance, then: 1) Shoot your HW designer 2) Grudgingly work around with special cases in your tests --=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 --Hf61M2y+wYpnELGG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJX/GLkAAoJEGw4ysog2bOSNv0QAKPW5jScjL6B844if6OTXRw5 LNgRvQCzDyntLy5I8pGjW26QOOe117MHibu1s2dQwexAgkCXHwp8v4RmE/c+Jcg3 1D7oC9XBt5pCw+sBKxCr83sOj/+48f1Zrmd8/OrM6ZD+ke8pxETK4AB+xP1ZxLXy ge9wFD61Tzl2Bo1SWey/VonQHX9UUXayhsA/6Nmwe8Mne1nhE2sMD+N5kELNV3D6 jZVhA9A88k71N6vPwHmw9xyREAPeF3cEGH0nspy13FWdZbvJfco0wyqMtGhZjo9a tSAF/PEvNOCpERewg3g2lcznsk6gIHWKDX7+klOng+/b5C1m7J4VIwl6FM1eAIG0 3qnL9S3H+/S3a9QAXYG+pfT+BawiQjnUOE/FHKSrly7sKSV2TsaP0DsO5nUUYHCB W0CshcphRTEsEa/kZZYpGEt4vDvCG0rNhCLmI9ctHqK88ELBkQ16oUNYh3zgjluY B4opHiIA+44jYLXa/F5J6c1bcvZziWDXdQ7r5hb0cqgNLeJFeQ9jBR495hvDRP48 vZS3D/vp6u4Nnno9HDRCAGFpaNhP5say0CnqoaFNFS1SctUtsOvoP1g+1wOM98Ma wwv4pgzpHXuqIjNLc27HYttHKdDODpB4qLZxwLJPVQ3Npk82hmNiObVXvkyCsbkQ 8OYow9W4xHwk+cUtd/yN =bCHA -----END PGP SIGNATURE----- --Hf61M2y+wYpnELGG--