public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Alexander Graf <agraf@suse.de>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"kvm@vger.kernel.org mailing list" <kvm@vger.kernel.org>,
	Pawel Moll <Pawel.Moll@arm.com>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 0/3] virtio-mmio: handle BE guests on LE hosts
Date: Mon, 14 Oct 2013 15:52:04 +0100	[thread overview]
Message-ID: <525C0514.5030103@arm.com> (raw)
In-Reply-To: <8C68DB9E-8391-4CF2-BB82-A49BDA26998B@suse.de>

On 14/10/13 15:16, Alexander Graf wrote:
> 
> On 14.10.2013, at 16:13, Marc Zyngier <marc.zyngier@arm.com> wrote:
> 
>> On 14/10/13 15:05, Michael S. Tsirkin wrote:
>>> On Mon, Oct 14, 2013 at 02:49:10PM +0100, Marc Zyngier wrote:
>>>> On 14/10/13 14:39, Alexander Graf wrote:
>>>>>
>>>>> On 14.10.2013, at 15:24, Marc Zyngier <marc.zyngier@arm.com> wrote:
>>>>>
>>>>>> On 14/10/13 14:10, Alexander Graf wrote:
>>>>>>>
>>>>>>> On 14.10.2013, at 15:03, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>>>>>
>>>>>>>> Il 11/10/2013 16:36, Marc Zyngier ha scritto:
>>>>>>>>> This small patch series adds just enough kernel infrastructure and
>>>>>>>>> fixes to allow a BE guest to use virtio-mmio on a LE host, provided
>>>>>>>>> that the host actually supports such madness.
>>>>>>>>
>>>>>>>> More precisely, it allows the guest drivers to pick the endianness they
>>>>>>>> prefer.  Mixed-endian virtio works fine on QEMU with e.g. a mips guest
>>>>>>>> in emulation mode, because then any given QEMU binary will always use
>>>>>>>> the same endianness (e.g. big for qemu-system-mips).
>>>>>>>
>>>>>>> We have the same problem (runtime switchable endianness) on PowerPC. IBM POWER is gaining Little Endian support in Linux now, so we could easily end up with an LE guest on a BE host.
>>>>>>>
>>>>>>> IIRC the way we're going to solve this is to hack up virtio_is_big_endian() to evaluate the first CPU's endianness mode (which will always be the same as all other CPU's endianness mode due to hypercall restrictions).
>>>>>>
>>>>>> I have implemented something similar for MMIO emulation in KVM/arm
>>>>>> (except that I only care about the faulting CPU).
>>>>>>
>>>>>> See my initial patch for that:
>>>>>> https://lists.cs.columbia.edu/pipermail/kvmarm/2013-October/007359.html
>>>>>>
>>>>>> That doesn't really change the non-trapping virtio accesses, though.
>>>>>> Where is this virtio_is_big_endian() thing?
>>>>>
>>>>> It's in QEMU's exec.c. It only gets used for config space access that goes through PCI though. Is there any other place where virtio specifies native endianness today?
>>>>
>>>> That's the main problem. Today's virtio flavour doesn't specify anything
>>>> about endianness, and that is what I'm adding. Or rather (as Paolo put
>>>> it), the prefered endianness of the virtio driver.
>>>>
>>>> So once (and if) this flags are in place, you always know what you're
>>>> dealing with. And because it is virtio-centric, you can implement it in
>>>> an architecture independent way.
>>>>
>>>> Also, most of my life revolves around kvmtool. QEMU is hardly on my
>>>> radar, these days (for reasons that are neither technical, nor relevant
>>>> to this forum). So it is important to me that the solution is platform
>>>> emulation agnostic.
>>>>
>>>> 	M.
>>>
>>> f you like, you should be able to implement virtio_is_big_endian
>>> in kvmtool too.
>>
>> Sure. And I imagine this traps back into the kernel to read some
>> register and find out what the endianness of the accessing CPU is?
> 
> Not yet. To be exact, it does the below today. But all virtio device
> emulation is 100% guest endianness unaware. This helper is the only
> piece of code where it gets any idea what endianness the guest has. So
> by checking for references to it in the code you know where endianness
> is an issue. And that's only in the config space.

Only config space? How do you deal with virtio ring descriptors, for
example?

	M.
-- 
Jazz is not dead. It just smells funny...


  reply	other threads:[~2013-10-14 14:52 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-11 14:36 [PATCH 0/3] virtio-mmio: handle BE guests on LE hosts Marc Zyngier
2013-10-11 14:36 ` [PATCH 1/3] virtio: let the guest report its endianess if advertized by the host Marc Zyngier
2013-10-11 14:36 ` [PATCH 2/3] virtio: mmio: fix signature checking for BE guests Marc Zyngier
2013-10-14  8:46   ` Pawel Moll
2013-10-14  9:11     ` Rusty Russell
2013-11-05  3:36       ` Rusty Russell
2013-11-05 10:45         ` Pawel Moll
2013-11-07  0:36           ` Rusty Russell
2013-10-11 14:36 ` [PATCH 3/3] virtio: mmio: access configuration space as little-endian Marc Zyngier
2013-10-14  8:44   ` Pawel Moll
2013-10-12 18:28 ` [PATCH 0/3] virtio-mmio: handle BE guests on LE hosts Michael S. Tsirkin
2013-10-14  8:24   ` Marc Zyngier
2013-10-14  8:59     ` Michael S. Tsirkin
2013-10-14  9:04       ` Pawel Moll
2013-10-14 10:46         ` Michael S. Tsirkin
2013-10-14 10:50           ` Pawel Moll
2013-10-14 23:02             ` Rusty Russell
2013-10-14  9:13     ` Rusty Russell
2013-10-14  8:21 ` Rusty Russell
2013-10-14 12:36   ` Marc Zyngier
2013-10-14 12:51     ` Michael S. Tsirkin
2013-10-17  0:27     ` Rusty Russell
2013-10-14 13:03 ` Paolo Bonzini
2013-10-14 13:10   ` Alexander Graf
2013-10-14 13:13     ` Paolo Bonzini
2013-10-14 13:24     ` Marc Zyngier
2013-10-14 13:29       ` Paolo Bonzini
2013-10-14 13:39       ` Alexander Graf
2013-10-14 13:49         ` Marc Zyngier
2013-10-14 14:05           ` Michael S. Tsirkin
2013-10-14 14:13             ` Marc Zyngier
2013-10-14 14:16               ` Alexander Graf
2013-10-14 14:52                 ` Marc Zyngier [this message]
2013-10-14 14:56                   ` Paolo Bonzini
2013-10-14 15:12                     ` Marc Zyngier
2013-10-14 15:22                       ` Paolo Bonzini
2013-10-14 15:36                         ` Marc Zyngier
2013-10-14 16:50                           ` Paolo Bonzini
2013-10-14 17:10                             ` Michael S. Tsirkin
2013-10-14 23:23                               ` Rusty Russell
2013-10-15  6:38                                 ` Michael S. Tsirkin
2013-10-15  9:19                                   ` Marc Zyngier
2013-10-14 15:45                         ` Anup Patel

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=525C0514.5030103@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=Pawel.Moll@arm.com \
    --cc=agraf@suse.de \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.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