[PATCH 0/3] virtio-mmio: handle BE guests on LE hosts

Alexander Graf agraf at suse.de
Mon Oct 14 09:39:08 EDT 2013


On 14.10.2013, at 15:24, Marc Zyngier <marc.zyngier at arm.com> wrote:

> On 14/10/13 14:10, Alexander Graf wrote:
>> 
>> On 14.10.2013, at 15:03, Paolo Bonzini <pbonzini at 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?


Alex




More information about the linux-arm-kernel mailing list