From: Christoffer Dall <christoffer.dall@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>,
kvm-devel <kvm@vger.kernel.org>, Alexander Graf <agraf@suse.de>,
QEMU Developers <qemu-devel@nongnu.org>,
"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>
Subject: Re: KVM and variable-endianness guest CPUs
Date: Fri, 17 Jan 2014 20:24:01 -0800 [thread overview]
Message-ID: <20140118042401.GB4021@cbox> (raw)
In-Reply-To: <CAFEAcA-v5NcC_dJv+wF0k-H4BMxwh7TZvkiCw+YoXCiSPDCDfA@mail.gmail.com>
On Fri, Jan 17, 2014 at 06:52:57PM +0000, Peter Maydell wrote:
> On 17 January 2014 17:53, Peter Maydell <peter.maydell@linaro.org> wrote:
> > Specifically, the KVM API says "here's a uint8_t[] byte
> > array and a length", and the current QEMU code treats that
> > as "this is a byte array written as if the guest CPU
> > (a) were in TARGET_WORDS_BIGENDIAN order and (b) wrote its
> > I/O access to this buffer rather than to the device".
> >
> > The KVM API docs don't actually specify the endianness
> > semantics of the byte array, but I think that that really
> > needs to be nailed down. I can think of a couple of options:
> > * always LE
> > * always BE
> > [these first two are non-starters because they would
> > break either x86 or PPC existing code]
> > * always the endianness the guest is at the time
> > * always some arbitrary endianness based purely on the
> > endianness the KVM implementation used historically
> > * always the endianness of the host QEMU binary
> > * something else?
> >
> > Any preferences? Current QEMU code basically assumes
> > "always the endianness of TARGET_WORDS_BIGENDIAN",
> > which is pretty random.
>
> Having thought a little more about this, my opinion is:
>
> * we should specify that the byte order of the mmio.data
> array is host kernel endianness (ie same endianness
> as the QEMU process itself) [this is what it actually
> is, I think, for all the cases that work today]
I completely agree, given that it's too late to be set on always LE/BE,
I think the natural choice is something that allows a user to cast the
byte array to an appropriate pointer type and dereference it.
And I think we need to amend the KVM API docs to specify this.
--
Christoffer
WARNING: multiple messages have this Message-ID (diff)
From: Christoffer Dall <christoffer.dall@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Thomas Falcon <tlfalcon@linux.vnet.ibm.com>,
kvm-devel <kvm@vger.kernel.org>, Alexander Graf <agraf@suse.de>,
QEMU Developers <qemu-devel@nongnu.org>,
"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>
Subject: Re: [Qemu-devel] KVM and variable-endianness guest CPUs
Date: Fri, 17 Jan 2014 20:24:01 -0800 [thread overview]
Message-ID: <20140118042401.GB4021@cbox> (raw)
In-Reply-To: <CAFEAcA-v5NcC_dJv+wF0k-H4BMxwh7TZvkiCw+YoXCiSPDCDfA@mail.gmail.com>
On Fri, Jan 17, 2014 at 06:52:57PM +0000, Peter Maydell wrote:
> On 17 January 2014 17:53, Peter Maydell <peter.maydell@linaro.org> wrote:
> > Specifically, the KVM API says "here's a uint8_t[] byte
> > array and a length", and the current QEMU code treats that
> > as "this is a byte array written as if the guest CPU
> > (a) were in TARGET_WORDS_BIGENDIAN order and (b) wrote its
> > I/O access to this buffer rather than to the device".
> >
> > The KVM API docs don't actually specify the endianness
> > semantics of the byte array, but I think that that really
> > needs to be nailed down. I can think of a couple of options:
> > * always LE
> > * always BE
> > [these first two are non-starters because they would
> > break either x86 or PPC existing code]
> > * always the endianness the guest is at the time
> > * always some arbitrary endianness based purely on the
> > endianness the KVM implementation used historically
> > * always the endianness of the host QEMU binary
> > * something else?
> >
> > Any preferences? Current QEMU code basically assumes
> > "always the endianness of TARGET_WORDS_BIGENDIAN",
> > which is pretty random.
>
> Having thought a little more about this, my opinion is:
>
> * we should specify that the byte order of the mmio.data
> array is host kernel endianness (ie same endianness
> as the QEMU process itself) [this is what it actually
> is, I think, for all the cases that work today]
I completely agree, given that it's too late to be set on always LE/BE,
I think the natural choice is something that allows a user to cast the
byte array to an appropriate pointer type and dereference it.
And I think we need to amend the KVM API docs to specify this.
--
Christoffer
next prev parent reply other threads:[~2014-01-18 4:24 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-17 17:53 KVM and variable-endianness guest CPUs Peter Maydell
2014-01-17 17:53 ` [Qemu-devel] " Peter Maydell
2014-01-17 18:52 ` Peter Maydell
2014-01-17 18:52 ` [Qemu-devel] " Peter Maydell
2014-01-18 4:24 ` Christoffer Dall [this message]
2014-01-18 4:24 ` Christoffer Dall
2014-01-18 7:32 ` Alexander Graf
2014-01-18 7:32 ` [Qemu-devel] " Alexander Graf
2014-01-18 10:15 ` Peter Maydell
2014-01-18 10:15 ` [Qemu-devel] " Peter Maydell
2014-01-20 14:20 ` Alexander Graf
2014-01-20 14:20 ` [Qemu-devel] " Alexander Graf
2014-01-20 14:31 ` Peter Maydell
2014-01-20 14:31 ` [Qemu-devel] " Peter Maydell
2014-01-20 14:22 ` Alexander Graf
2014-01-20 14:22 ` [Qemu-devel] " Alexander Graf
2014-01-20 19:19 ` Christoffer Dall
2014-01-20 19:19 ` [Qemu-devel] " Christoffer Dall
2014-01-22 5:39 ` Victor Kamensky
2014-01-22 5:39 ` [Qemu-devel] " Victor Kamensky
2014-01-22 6:31 ` Anup Patel
2014-01-22 6:31 ` [Qemu-devel] " Anup Patel
2014-01-22 6:41 ` [Qemu-ppc] " Alexander Graf
2014-01-22 6:41 ` [Qemu-devel] " Alexander Graf
2014-01-22 7:26 ` Victor Kamensky
2014-01-22 7:26 ` [Qemu-devel] " Victor Kamensky
2014-01-22 10:52 ` Alexander Graf
2014-01-22 10:52 ` [Qemu-devel] " Alexander Graf
2014-01-23 4:25 ` Victor Kamensky
2014-01-23 4:25 ` [Qemu-devel] " Victor Kamensky
2014-01-23 10:32 ` Alexander Graf
2014-01-23 10:32 ` [Qemu-devel] " Alexander Graf
2014-01-23 10:56 ` Greg Kurz
2014-01-23 10:56 ` [Qemu-devel] " Greg Kurz
2014-01-22 8:57 ` Anup Patel
2014-01-22 8:57 ` [Qemu-devel] " Anup Patel
2014-01-23 23:28 ` Christoffer Dall
2014-01-23 23:28 ` [Qemu-devel] " Christoffer Dall
2014-01-22 10:22 ` Peter Maydell
2014-01-22 10:22 ` [Qemu-devel] " Peter Maydell
2014-01-22 17:19 ` Victor Kamensky
2014-01-22 17:19 ` [Qemu-devel] " Victor Kamensky
2014-01-22 17:29 ` Peter Maydell
2014-01-22 17:29 ` [Qemu-devel] " Peter Maydell
2014-01-22 19:29 ` Victor Kamensky
2014-01-22 19:29 ` [Qemu-devel] " Victor Kamensky
2014-01-22 20:02 ` Peter Maydell
2014-01-22 20:02 ` [Qemu-devel] " Peter Maydell
2014-01-22 22:47 ` Victor Kamensky
2014-01-22 22:47 ` [Qemu-devel] " Victor Kamensky
2014-01-22 23:18 ` Peter Maydell
2014-01-22 23:18 ` [Qemu-devel] " Peter Maydell
2014-01-23 0:22 ` Victor Kamensky
2014-01-23 0:22 ` [Qemu-devel] " Victor Kamensky
2014-01-23 10:23 ` Peter Maydell
2014-01-23 10:23 ` [Qemu-devel] " Peter Maydell
2014-01-23 15:06 ` Victor Kamensky
2014-01-23 15:06 ` [Qemu-devel] " Victor Kamensky
2014-01-23 15:33 ` Peter Maydell
2014-01-23 15:33 ` [Qemu-devel] " Peter Maydell
2014-01-23 16:25 ` Victor Kamensky
2014-01-23 16:25 ` [Qemu-devel] " Victor Kamensky
2014-01-23 20:45 ` Christoffer Dall
2014-01-23 20:45 ` [Qemu-devel] " Christoffer Dall
2014-01-24 0:50 ` Victor Kamensky
2014-01-24 0:50 ` [Qemu-devel] " Victor Kamensky
2014-01-24 2:14 ` Christoffer Dall
2014-01-24 2:14 ` [Qemu-devel] " Christoffer Dall
2014-01-24 4:11 ` Victor Kamensky
2014-01-24 4:11 ` [Qemu-devel] " Victor Kamensky
2014-01-28 0:32 ` [Qemu-ppc] " Benjamin Herrenschmidt
2014-01-28 0:32 ` [Qemu-devel] " Benjamin Herrenschmidt
2014-01-28 0:40 ` Christoffer Dall
2014-01-28 0:40 ` [Qemu-devel] " Christoffer Dall
2014-01-28 0:15 ` Benjamin Herrenschmidt
2014-01-28 0:15 ` [Qemu-devel] " Benjamin Herrenschmidt
2014-01-24 0:09 ` Victor Kamensky
2014-01-24 0:09 ` [Qemu-devel] " Victor Kamensky
2014-01-28 0:07 ` [Qemu-ppc] " Benjamin Herrenschmidt
2014-01-28 0:07 ` [Qemu-devel] " Benjamin Herrenschmidt
2014-01-28 0:07 ` Benjamin Herrenschmidt
2014-01-28 0:07 ` [Qemu-devel] " Benjamin Herrenschmidt
2014-01-27 23:34 ` Benjamin Herrenschmidt
2014-01-27 23:34 ` [Qemu-devel] " Benjamin Herrenschmidt
2014-01-27 23:49 ` Peter Maydell
2014-01-27 23:49 ` [Qemu-devel] " Peter Maydell
2014-01-28 0:36 ` Benjamin Herrenschmidt
2014-01-28 0:36 ` [Qemu-devel] " Benjamin Herrenschmidt
2014-01-28 0:44 ` Christoffer Dall
2014-01-28 0:44 ` [Qemu-devel] " Christoffer Dall
2014-01-28 4:47 ` Benjamin Herrenschmidt
2014-01-28 4:47 ` [Qemu-devel] " Benjamin Herrenschmidt
2014-01-28 16:31 ` Christoffer Dall
2014-01-28 16:31 ` [Qemu-devel] " Christoffer Dall
2014-01-27 23:31 ` Benjamin Herrenschmidt
2014-01-27 23:31 ` [Qemu-devel] " Benjamin Herrenschmidt
2014-01-27 23:27 ` Benjamin Herrenschmidt
2014-01-27 23:27 ` [Qemu-devel] " Benjamin Herrenschmidt
2014-01-28 9:16 ` Avi Kivity
2014-01-28 9:16 ` [Qemu-devel] " Avi Kivity
2014-01-28 9:04 ` Avi Kivity
2014-01-28 9:04 ` [Qemu-devel] " Avi Kivity
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=20140118042401.GB4021@cbox \
--to=christoffer.dall@linaro.org \
--cc=agraf@suse.de \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=tlfalcon@linux.vnet.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.