public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoffer Dall <christoffer.dall@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Alexander Graf <agraf@suse.de>,
	Scott Wood <scottwood@freescale.com>,
	kvm-devel <kvm@vger.kernel.org>,
	kvm-ppc <kvm-ppc@vger.kernel.org>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	Patch Tracking <patches@linaro.org>,
	Marc Zyngier <marc.zyngier@arm.com>
Subject: Re: [PATCH v2] KVM: Specify byte order for KVM_EXIT_MMIO
Date: Sat, 25 Jan 2014 10:31:42 -0800	[thread overview]
Message-ID: <20140125183142.GA2950@lvm> (raw)
In-Reply-To: <CAFEAcA8pumMGe2jx0WtWtOwri6Le3_rA0RDvgjyP6szXC_in1A@mail.gmail.com>

On Sat, Jan 25, 2014 at 04:23:00PM +0000, Peter Maydell wrote:
> On 25 January 2014 02:15, Alexander Graf <agraf@suse.de> wrote:
> > Ok, let's go through the combinations for a 32-bit write of 0x01020304 on PPC and what data[] looks like
> >
> > your proposal:
> >
> >   BE guest, BE host: { 0x01, 0x02, 0x03, 0x04 }
> >   LE guest, BE host: { 0x04, 0x03, 0x02, 0x01 }
> >   BE guest, LE host:  { 0x01, 0x02, 0x03, 0x04 }
> >   LE guest, LE host:  { 0x04, 0x03, 0x02, 0x01 }
> >
> > -> ldw_p() will give us the correct value to work with
> >
> > current proposal:
> >
> >   BE guest, BE host: { 0x01, 0x02, 0x03, 0x04 }
> >   LE guest, BE host: { 0x04, 0x03, 0x02, 0x01 }
> >   BE guest, LE host:  { 0x04, 0x03, 0x02, 0x01 }
> >   LE guest, LE host:  { 0x01, 0x02, 0x03, 0x04 }
> >
> > -> *(uint32_t*)data will give us the correct value to work with
> 
> For completeness, ditto, ARM:
> Scott's proposal (you end up with the same values in
> the data array as for PPC, so userspace has to know the
> "default" endianness so it can do a byteswap if the
> process endianness doesn't match it; on QEMU
> ldl_p() handles this for us, as you say):
> 
>    BE guest, BE host: { 0x01, 0x02, 0x03, 0x04 }
>    LE guest, BE host: { 0x04, 0x03, 0x02, 0x01 }
>    BE guest, LE host:  { 0x01, 0x02, 0x03, 0x04 }
>    LE guest, LE host:  { 0x04, 0x03, 0x02, 0x01 }
> 
> current proposal:
> 
>    BE guest, BE host: { 0x04, 0x03, 0x02, 0x01 }
>    LE guest, BE host: { 0x01, 0x02, 0x03, 0x04 }
>    BE guest, LE host:  { 0x01, 0x02, 0x03, 0x04 }
>    LE guest, LE host:  { 0x04, 0x03, 0x02, 0x01 }
> 
> The values in the data array are different than on
> PPC, reflecting the fact that the "default" endianness
> is different; userspace does
> 
>  -> *(uint32_t*)data will give us the correct value to work with
> 
> regardless of what the guest CPU arch is.
> 
> > There are pros and cons for both approaches.
> >
> > Pro approach 1 is that it fits the way data[] is read today,
> > so no QEMU changes are required. However, it means
> > that user space needs to have awareness of the
> > "default endianness".
> > With approach 2 you don't care about endianness at all
> > anymore - you just get a payload that the host process
> > can read in.
> >
> > Obviously both approaches would work as long as they're
> > properly defined :).
> 
> Agreed with all of that.
> 
Agreed as well.

How do we settle on one versus the other?

And if we agree on the current proposal (from Alex/Peter/Me) is the
current suggested wording ok, or can someone suggest a better wording?

We could for example include the the matrices as above for all known
architectures, but that does seem overly verbose.

-Christoffer

  reply	other threads:[~2014-01-25 18:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-24 23:39 [PATCH v2] KVM: Specify byte order for KVM_EXIT_MMIO Christoffer Dall
2014-01-24 23:51 ` Scott Wood
2014-01-25  0:05   ` Victor Kamensky
2014-01-25  0:24   ` Peter Maydell
2014-01-25  1:56     ` Christoffer Dall
2014-01-25  2:04       ` Scott Wood
2014-01-25  2:16         ` Alexander Graf
2014-01-25  1:58     ` Scott Wood
2014-01-25  2:15       ` Alexander Graf
2014-01-25  2:34         ` Christoffer Dall
2014-01-25  9:13           ` Alexander Graf
2014-01-25  2:37         ` Victor Kamensky
2014-01-25  9:20           ` Alexander Graf
2014-01-25 15:36             ` Victor Kamensky
2014-01-25 16:12               ` Alexander Graf
2014-01-25 16:23         ` Peter Maydell
2014-01-25 18:31           ` Christoffer Dall [this message]
2014-01-26  3:46             ` Victor Kamensky
2014-01-26  5:43               ` Victor Kamensky
2014-01-27  7:52                 ` Alexander Graf
2014-01-27  9:42                   ` Peter Maydell
2014-01-27  7:41               ` Alexander Graf
2014-01-28  1:59         ` Scott Wood
2014-01-28  8:55           ` Peter Maydell

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=20140125183142.GA2950@lvm \
    --to=christoffer.dall@linaro.org \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=marc.zyngier@arm.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=scottwood@freescale.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox