qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: Laurent Vivier <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org, David Gibson <david@gibson.dropbear.id.au>,
	Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PATCH v2] qtest: ask endianness of the target in qtest_init()
Date: Fri, 7 Oct 2016 14:27:38 +0200	[thread overview]
Message-ID: <20161007142738.73a94338@bahia> (raw)
In-Reply-To: <a68bd356-1d8b-3cf3-8fd6-987e561f87c6@redhat.com>

On Fri, 7 Oct 2016 12:57:41 +0200
Laurent Vivier <lvivier@redhat.com> wrote:

> On 07/10/2016 12:48, Greg Kurz wrote:
> > On Fri,  7 Oct 2016 12:14:27 +0200
> > Laurent Vivier <lvivier@redhat.com> 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 <lvivier@redhat.com>
> >> CC: Greg Kurz <groug@kaod.org>
> >> CC: David Gibson <david@gibson.dropbear.id.au>
> >> CC: Peter Maydell <peter.maydell@linaro.org>
> >> ---
> >> 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

  reply	other threads:[~2016-10-07 12:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 10:14 [Qemu-devel] [PATCH v2] qtest: ask endianness of the target in qtest_init() Laurent Vivier
2016-10-07 10:48 ` Greg Kurz
2016-10-07 10:57   ` Laurent Vivier
2016-10-07 12:27     ` Greg Kurz [this message]
2016-10-07 12:31       ` Peter Maydell
2016-10-07 12:45         ` Greg Kurz
2016-10-07 12:52           ` Peter Maydell
2016-10-07 12:56             ` Laurent Vivier
2016-10-07 13:08               ` Greg Kurz
2016-10-10  4:55   ` David Gibson
2016-10-10  9:18     ` Peter Maydell
2016-10-10 13:39       ` David Gibson
2016-10-10 14:10         ` Peter Maydell
2016-10-11  1:24           ` David Gibson
2016-10-11  3:56             ` David Gibson
2016-10-11  8:55             ` Peter Maydell
2016-10-11  9:56               ` David Gibson
2016-10-10  4:52 ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161007142738.73a94338@bahia \
    --to=groug@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).