From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsUFh-00070E-Ft for qemu-devel@nongnu.org; Fri, 07 Oct 2016 08:27:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsUFd-0002tU-7c for qemu-devel@nongnu.org; Fri, 07 Oct 2016 08:27:48 -0400 Received: from 16.mo6.mail-out.ovh.net ([87.98.139.208]:41427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsUFd-0002t2-1p for qemu-devel@nongnu.org; Fri, 07 Oct 2016 08:27:45 -0400 Received: from player738.ha.ovh.net (b7.ovh.net [213.186.33.57]) by mo6.mail-out.ovh.net (Postfix) with ESMTP id 3F6F23676C for ; Fri, 7 Oct 2016 14:27:43 +0200 (CEST) Date: Fri, 7 Oct 2016 14:27:38 +0200 From: Greg Kurz Message-ID: <20161007142738.73a94338@bahia> In-Reply-To: References: <1475835267-7300-1-git-send-email-lvivier@redhat.com> <20161007124849.7c867d79@bahia> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: Laurent Vivier Cc: qemu-devel@nongnu.org, David Gibson , Peter Maydell On Fri, 7 Oct 2016 12:57:41 +0200 Laurent Vivier wrote: > On 07/10/2016 12:48, Greg Kurz wrote: > > On Fri, 7 Oct 2016 12:14:27 +0200 > > Laurent Vivier wrote: > > > >> The target endianness is not deduced anymore from > >> the architecture name but asked directly to the guest, > >> using a new qtest command: "endianness". As it can't > >> change (this is the value of TARGET_WORDS_BIGENDIAN), > >> we store it to not have to ask every time we want to > >> know if we have to byte-swap a value. > >> > >> Signed-off-by: Laurent Vivier > >> CC: Greg Kurz > >> CC: David Gibson > >> CC: Peter Maydell > >> --- > >> v2: > >> - move the "endianness" command to a function and > >> don't move the qtest_init()/qtest_quit() functions > >> > > > > Not speaking about the current discussion on TARGET_WORDS_BIGENDIAN, > > I guess a consensus could be that this only makes sense when testing > > legacy virtio. People should not be tempted to use this anywhere else > > actually. > > I can rename target_big_endian() into qvirtio_is_big_endian() on the > test side (and put it in libqos/virtio.h). > Yes. > I'd like to keep the qtest_big_endian() as it returns > TARGET_WORDS_BIGENDIAN, and qvirtio_is_big_endian() will depend also on > virtio-1.0 or not. > Indeed but my suggestion is to open code this in qvirtio_is_big_endian(), and even rename QTestState::big_endian to virtio_big_endian to make it really obvious it should not be used elsewhere. I now remember this is what I was resolutely suggested to do in include/qom/cpu.h at the time we started to support ppc64le: bool (*virtio_is_big_endian)(CPUState *cpu); Cheers. -- Greg > Laurent