All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Rusty Russell" <rusty@rustcorp.com.au>,
	"Andreas Färber" <afaerber@suse.de>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/7] virtio: allow byte swapping for vring and config access
Date: Thu, 08 Aug 2013 11:11:04 -0500	[thread overview]
Message-ID: <87mwosf9if.fsf@codemonkey.ws> (raw)
In-Reply-To: <CAFEAcA96v69h8EGouMSqU8CZ_JJZUwYoLQCpnwHkR2Q-V_m8ug@mail.gmail.com>

Peter Maydell <peter.maydell@linaro.org> writes:

> On 8 August 2013 16:40, Anthony Liguori <anthony@codemonkey.ws> wrote:
>> PPC64 is big endian.  AFAIK, there is no such thing as a little endian
>> PPC64 processor.
>
> What's your definition of "little endian processor" here if
> it isn't "one which is doing byte swaps of data"? I would
> describe a PPC64 with the relevant mode bit set as "little
> endian".

Let's focus this to QEMU.  PPC64 is still TARGET_WORDS_BIGENDIAN.  It
would be totally wrong to make this change to either a function call or
to TARGET_WORDS_LITTLEENDIAN.

>> This is just a processor mode where loads/stores are byte lane swapped.
>> Hence the name 'cpu_get_byteswap'.  It's just asking whether the
>> load/stores are being swapped or not.
>>
>> At least for PPC64, it's not possible to enable/disable byte lane
>> swapping for individual CPUs.  It's done through a system-wide hcall.
>>
>> FWIW, I think most bi-endian architectures are this way too so I think
>> this is equally applicable to ARM.  Peter, is that right?
>
> ARM's bi-endian story is complicated and depends on the CPU.
> Older CPUs didn't do byte-lane swapping of data; instead
> when the CPU was configured in "big endian" mode they would
> do address munging (XOR the address with 3 when doing a byte
> access; XOR with 1 for halfword access). New CPUs do byte-lane
> swapping (but only for data, not for instruction fetch).
> CPUs in the transition period can do either.
>
> In all cases, this is a per-cpu-core thing: you can have
> one core configured to be bigendian and the other little
> endian. You could in theory have the OS support both big
> and little endian userspace processes. We ideally would
> want to support "QEMU is a little endian process but the
> VM's vcpu is currently bigendian".

Eek.  Yeah, I guess we need to tie this to a CPUState then.

>
> Fuller writeup here:
> http://translatedcode.wordpress.com/2012/04/02/this-end-up/

Excellent, thanks!

Regards,

Anthony Liguori

>
> -- PMM

  reply	other threads:[~2013-08-08 16:11 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-08  5:15 [Qemu-devel] [PATCH 0/7] Virtio support for endian-curious guests Rusty Russell
2013-08-08  5:15 ` [Qemu-devel] [PATCH 1/7] virtio: allow byte swapping for vring and config access Rusty Russell
2013-08-08 13:31   ` Anthony Liguori
2013-08-08 14:28     ` Andreas Färber
2013-08-08 15:40       ` Anthony Liguori
2013-08-08 15:45         ` Daniel P. Berrange
2013-08-08 16:07           ` Anthony Liguori
2013-08-08 16:14             ` Peter Maydell
2013-08-08 16:25               ` Anthony Liguori
2013-08-08 16:30                 ` Peter Maydell
2013-08-09  2:58             ` Rusty Russell
2013-08-09  4:39               ` Anton Blanchard
2013-08-09  8:05               ` Peter Maydell
2013-08-09 14:16               ` Anthony Liguori
2013-08-08 15:48         ` Peter Maydell
2013-08-08 16:11           ` Anthony Liguori [this message]
2013-08-08 16:24         ` Andreas Färber
2013-08-09  7:35           ` Rusty Russell
2013-08-09  7:42             ` Peter Maydell
2013-08-12  7:49               ` Rusty Russell
2013-08-09  7:49             ` Benjamin Herrenschmidt
2013-08-12  0:28               ` Rusty Russell
2013-08-12  0:49                 ` Benjamin Herrenschmidt
2013-08-09 15:15             ` Andreas Färber
2013-08-09  0:08       ` Rusty Russell
2013-08-09  7:00       ` Rusty Russell
2013-08-09 14:24         ` Andreas Färber
2013-08-09  6:40     ` Rusty Russell
2013-08-09 14:10       ` Anthony Liguori
2013-08-11 23:46         ` Rusty Russell
2013-08-08  5:15 ` [Qemu-devel] [PATCH 2/7] target-ppc: ppc64 targets can be either endian Rusty Russell
2013-08-08  5:15 ` [Qemu-devel] [PATCH 3/7] hw/net/virtio-net: use virtio wrappers to access headers Rusty Russell
2013-08-08 13:32   ` Anthony Liguori
2013-08-08  5:15 ` [Qemu-devel] [PATCH 4/7] hw/net/virtio-balloon: use virtio wrappers to access page frame numbers Rusty Russell
2013-08-08 13:32   ` Anthony Liguori
2013-08-08  5:15 ` [Qemu-devel] [PATCH 5/7] hw/block/virtio-blk: use virtio wrappers to access headers Rusty Russell
2013-08-08  9:57   ` Peter Maydell
2013-08-08 13:32   ` Anthony Liguori
2013-08-08  5:15 ` [Qemu-devel] [PATCH 6/7] hw/scsi/virtio-scsi: " Rusty Russell
2013-08-08 13:33   ` Anthony Liguori
2013-08-08  5:15 ` [Qemu-devel] [PATCH 7/7] hw/char/virtio-serial-bus: " Rusty Russell
2013-08-08 13:34   ` Anthony Liguori
2013-08-08  5:15 ` [Qemu-devel] [PATCH 7/7] patch virtio-serial-biendian.patch Rusty Russell

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=87mwosf9if.fsf@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=afaerber@suse.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rusty@rustcorp.com.au \
    /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.