[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] libvhost-user: handle endianness as mandated by the spec
From: |
Marc Hartmayer |
Subject: |
Re: [PATCH 2/2] libvhost-user: handle endianness as mandated by the spec |
Date: |
Mon, 03 Aug 2020 16:17:27 +0200 |
On Sun, Aug 02, 2020 at 01:13 AM -0400, "Michael S. Tsirkin" <mst@redhat.com>
wrote:
> On Thu, Jul 30, 2020 at 04:07:31PM +0200, Marc Hartmayer wrote:
>> Since virtio existed even before it got standardized, the virtio
>> standard defines the following types of virtio devices:
>>
>> + legacy device (pre-virtio 1.0)
>> + non-legacy or VIRTIO 1.0 device
>> + transitional device (which can act both as legacy and non-legacy)
>>
>> Virtio 1.0 defines the fields of the virtqueues as little endian,
>> while legacy uses guest's native endian [1]. Currently libvhost-user
>> does not handle virtio endianness at all, i.e. it works only if the
>> native endianness matches with whatever is actually needed. That means
>> things break spectacularly on big-endian targets. Let us handle virtio
>> endianness for non-legacy as required by the virtio specification
>> [1]. The fencing of legacy virtio devices is done in
>> `vu_set_features_exec`.
>>
>> [1]
>> https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-210003
>>
>> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
>
>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Thanks.
[…snip]
--
Kind regards / Beste Grüße
Marc Hartmayer
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294