Received: from eggs.gnu.org ([2001:4830:134:3::10]:57644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bs6AC-00006D-4P for qemu-devel@nongnu.org; Thu, 06 Oct 2016 06:44:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bs6A7-0001Ew-76 for qemu-devel@nongnu.org; Thu, 06 Oct 2016 06:44:32 -0400 Received: from mo1.mail-out.ovh.net ([178.32.228.1]:59321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bs6A7-0001Em-0S for qemu-devel@nongnu.org; Thu, 06 Oct 2016 06:44:27 -0400 Received: from player726.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id 088E61037D for ; Thu, 6 Oct 2016 12:44:25 +0200 (CEST) References: <1475583448-21013-1-git-send-email-clg@kaod.org> <20161004234352.GE18648@umbus.fritz.box> <65e1a873-c9a2-b93e-4680-d1fa5f86316d@kaod.org> <20161006034543.GE18733@umbus.fritz.box> <2a42ae88-0bb1-7967-8d92-0cb60f3779a1@redhat.com> <20161006083709.GO18733@umbus.fritz.box> <873f2c4a-75e4-dce4-0cc9-0d9274bece29@redhat.com> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: Date: Thu, 6 Oct 2016 12:44:16 +0200 MIME-Version: 1.0 In-Reply-To: <873f2c4a-75e4-dce4-0cc9-0d9274bece29@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: Paolo Bonzini , David Gibson Cc: Laurent Vivier , Peter Maydell , QEMU Developers , Greg Kurz On 10/06/2016 11:40 AM, Paolo Bonzini wrote: > > > On 06/10/2016 10:37, David Gibson wrote: >> On Thu, Oct 06, 2016 at 09:23:11AM +0200, Paolo Bonzini wrote: >>> >>> >>> On 06/10/2016 05:45, David Gibson wrote: >>>> qtest is about testing hardware, not the guest cpu, and whether you're >>>> accessing MMIO space or buffers the hardware will read via DMA, it's >>>> the hardware which determines the correct endianness, not the guest >>>> cpu. >>> >>> Well, sort of... qtest writes are definitely injecting things from the >>> point of view of the guest CPU. For example see Laurent's patches that >>> add RTAS commands to qtest. >> >> Sure. My point is that any guest CPU can do both LE and BE accesses >> pretty simply, so we might as well specify which we want. > > On this I do agree. Yes. It is pretty confusing today from the test side. To clarify things a little, I came up with this : +static inline uint32_t make_be32(uint32_t data) +{ + return bswap32(data); +} ... + writel(ASPEED_FLASH_BASE, make_be32(some_page_addr)); Which is what a Little Endian CPU would do to write a BE value. So it should probably be called, make_b32_on_le_cpu() to be correct. I am not sure there is a good interface for these accesses ... C.