qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	"Andreas Färber" <andreas.faerber@web.de>,
	"Hervé Poussineau" <hpoussin@reactos.org>,
	"Alexander Graf" <agraf@suse.de>,
	"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PULL for-2.0 2/7] raven: Implement non-contiguous I/O region
Date: Tue, 8 Apr 2014 21:56:38 +0100	[thread overview]
Message-ID: <CAFEAcA8YNQ9ZND6xZQBZ6N9eHSr8U03g0N8hBU_K3vDMFUZNWQ@mail.gmail.com> (raw)
In-Reply-To: <53445BCE.3030504@redhat.com>

On 8 April 2014 21:27, Paolo Bonzini <pbonzini@redhat.com> wrote:
> I agree, and in fact we should also use DEVICE_NATIVE_ENDIAN less, not more.
> Unfortunately, forwarding accesses from one address space to another via
> MMIO accessors requires DEVICE_NATIVE_ENDIAN, and that in turn requires
> target-endianness ldl_p/stl_p.

I don't think this is correct. If we're purely forwarding
then you can just use DEVICE_LITTLE_ENDIAN and ldl_le_p.
There are three places in the sequence of calls from CPU to
outer MMIO accessor to stl_le_p to memory_space_write
that might insert bswaps:
 1 before the call to the outer MMIO accessor we will bswap
   if the guest endianness is not LE (because we're calling an
   MMIO accessor that was marked DEVICE_LITTLE_ENDIAN)
 2 in the stl_le_p we will bswap if the host endianness is not LE
   (because that's what stl_le_p means)
 3 in memory_space_write when we read out of the buffer we
   do a ldl_q, which will bswap if the host endianness is not
   the target endianness (because we get the cpu-all.h version
   of ldl_q, which does a target-endian load)

So:
host = guest = LE: no swapping
host = LE, guest = BE: swap 1 and 3 active
host = BE, guest = LE: swap 2 and 3 active
host = guest = BE: swap 1 and 2 active

In all cases we do an even number of swaps and the whole thing
cancels out :-)

You can use DEVICE_BIG_ENDIAN and stl_be_p if you like,
for equivalent effect.

I'm pretty sure this wasn't an intentional design property, though...

thanks
-- PMM

  reply	other threads:[~2014-04-08 20:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19 23:35 [Qemu-devel] [PULL for-2.0-rc1 0/7] PReP patch queue 2014-03-20 Andreas Färber
2014-03-19 23:36 ` [Qemu-devel] [PULL for-2.0 1/7] raven: Rename intack region to pci_intack Andreas Färber
2014-03-19 23:36 ` [Qemu-devel] [PULL for-2.0 2/7] raven: Implement non-contiguous I/O region Andreas Färber
2014-04-05 15:41   ` Andreas Färber
2014-04-05 20:26     ` Hervé Poussineau
2014-04-05 20:34       ` Alexander Graf
2014-04-05 20:50         ` Hervé Poussineau
2014-04-05 23:20           ` Peter Maydell
2014-04-07 19:31             ` Paolo Bonzini
2014-04-08 14:37               ` Peter Maydell
2014-04-08 18:39                 ` Paolo Bonzini
2014-04-08 18:55                   ` Peter Maydell
2014-04-08 20:27                     ` Paolo Bonzini
2014-04-08 20:56                       ` Peter Maydell [this message]
2014-04-07 19:32       ` Andreas Färber
2014-04-07 20:40         ` Andreas Färber
2014-04-07 21:21           ` Peter Maydell
2014-03-19 23:36 ` [Qemu-devel] [PULL for-2.0 3/7] raven: Set a correct PCI I/O memory region Andreas Färber
2014-03-19 23:36 ` [Qemu-devel] [PULL for-2.0 4/7] raven: Set a correct PCI " Andreas Färber
2014-03-19 23:36 ` [Qemu-devel] [PULL for-2.0 5/7] raven: Add PCI bus mastering address space Andreas Färber
2014-03-19 23:36 ` [Qemu-devel] [PULL for-2.0 6/7] raven: Fix PCI bus accesses with size > 1 Andreas Färber
2014-03-19 23:36 ` [Qemu-devel] [PULL for-2.0 7/7] raven: Use raven_ for all function prefixes Andreas Färber
2014-03-20  0:22 ` [Qemu-devel] [PULL for-2.0-rc1 0/7] PReP patch queue 2014-03-20 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=CAFEAcA8YNQ9ZND6xZQBZ6N9eHSr8U03g0N8hBU_K3vDMFUZNWQ@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=agraf@suse.de \
    --cc=andreas.faerber@web.de \
    --cc=hpoussin@reactos.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).