[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160121105539.63093cb6.cornelia.huck@de.ibm.com>
Date: Thu, 21 Jan 2016 10:55:39 +0100
From: Cornelia Huck <cornelia.huck@...ibm.com>
To: Greg Kurz <gkurz@...ux.vnet.ibm.com>
Cc: "Michael S. Tsirkin" <mst@...hat.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH 1/2] vhost: helpers to enable/disable vring endianness
On Wed, 13 Jan 2016 18:09:41 +0100
Greg Kurz <gkurz@...ux.vnet.ibm.com> wrote:
> The default use case for vhost is when the host and the vring have the
> same endianness (default native endianness). But there are cases where
> they differ and vhost should byteswap when accessing the vring:
> - the host is big endian and the vring comes from a virtio 1.0 device
> which is always little endian
> - the architecture is bi-endian and the vring comes from a legacy virtio
> device with a different endianness than the endianness of the host (aka
> legacy cross-endian)
>
> These cases are handled by the vq->is_le and the optional vq->user_be,
> with the following logic:
> - if none of the fields is enabled, vhost access the vring without byteswap
> - if the vring is virtio 1.0 and the host is big endian, vq->is_le is
> enabled to enforce little endian access to the vring
> - if the vring is legacy cross-endian, userspace enables vq->user_be
> to inform vhost about the vring endianness. This endianness is then
> enforced for vring accesses through vq->is_le again
>
> The logic is unclear in the current code.
>
> This patch introduces helpers with explicit enable and disable semantics,
> for better clarity.
>
> No behaviour change.
>
> Signed-off-by: Greg Kurz <gkurz@...ux.vnet.ibm.com>
> ---
> drivers/vhost/vhost.c | 28 +++++++++++++++++++---------
> 1 file changed, 19 insertions(+), 9 deletions(-)
Reviewed-by: Cornelia Huck <cornelia.huck@...ibm.com>
Powered by blists - more mailing lists