Received: from eggs.gnu.org ([2001:4830:134:3::10]:43585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brpor-0005cI-4G for qemu-devel@nongnu.org; Wed, 05 Oct 2016 13:17:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1brpok-0003l3-VC for qemu-devel@nongnu.org; Wed, 05 Oct 2016 13:17:23 -0400 Received: from 18.mo1.mail-out.ovh.net ([46.105.35.72]:53780) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1brpok-0003ko-P1 for qemu-devel@nongnu.org; Wed, 05 Oct 2016 13:17:18 -0400 Received: from player726.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id 82C9E1015E for ; Wed, 5 Oct 2016 19:17:16 +0200 (CEST) References: <1475583448-21013-1-git-send-email-clg@kaod.org> <20161004234352.GE18648@umbus.fritz.box> <65e1a873-c9a2-b93e-4680-d1fa5f86316d@kaod.org> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: <20cfbe4b-cc12-6445-3a7a-208ce916697e@kaod.org> Date: Wed, 5 Oct 2016 19:17:10 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] qtest: add read/write accessors with a specific endianness List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: David Gibson , QEMU Developers , Greg Kurz , Laurent Vivier On 10/05/2016 04:20 PM, Peter Maydell wrote: > On 5 October 2016 at 07:00, C=C3=A9dric Le Goater wrote: >> On 10/05/2016 03:53 PM, Peter Maydell wrote: >>> Which tswap? Last time I worked through the stack of >>> what happens I thought that we had the right set of >>> swaps in the right places. >> >> The one I am talking about are under qtest_process_command(), >> see below. >=20 > Those are correct and required, and they do not change > the overall behaviour of the system depending on the host > endianness. (They convert 32-bit values to "bag of > bytes in guest order" which is what the cpu_physical_memory_* > functions want.) >=20 > https://lists.gnu.org/archive/html/qemu-arm/2016-07/msg00037.html > is the explanation from last time around, I think. >=20 > If your test is giving different answers on different > host endiannesses, it is presumably because it is > incorrectly issuing different readl/etc commands > in the two cases. OK. I think my brain is starting to see things from the right=20 angle. Let's try that : my test is simulating a Little Endian CPU which is writing a Big Endian value, so it *always* needs to bswap()=20 that value. cpu_to_be32 is incorrect as it implies the endianness of the host which can be wrong (when running BE). The qtest layer is a just fixing layer. Thanks, C.