[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 1/2] vhost: add VHOST_VRING_F_BYTESWAP flag
From: |
Cornelia Huck |
Subject: |
Re: [Qemu-devel] [RFC PATCH 1/2] vhost: add VHOST_VRING_F_BYTESWAP flag |
Date: |
Mon, 3 Nov 2014 16:29:31 +0100 |
On Wed, 29 Oct 2014 09:42:09 +0100
Cédric Le Goater <address@hidden> wrote:
> When the guest and the host have a different endian order, the data
> being accessed in the vring queues needs to be byteswapped.
>
> This patch adds a VHOST_VRING_F_BYTESWAP flag to inform the vhost
> kernel backend to byteswap vring data.
>
> Signed-off-by: Cédric Le Goater <address@hidden>
> ---
> hw/virtio/vhost.c | 25 ++++++++++++++++++++++++-
> include/hw/virtio/vhost.h | 1 +
> linux-headers/linux/vhost.h | 3 +++
> 3 files changed, 28 insertions(+), 1 deletion(-)
> +static bool vhost_virtqueue_needs_byteswap(VirtIODevice *vdev)
> +{
> +#ifdef TARGET_IS_BIENDIAN
> +#ifdef HOST_WORDS_BIGENDIAN
> + return !virtio_is_big_endian(vdev);
> +#else
> + return virtio_is_big_endian(vdev);
> +#endif
> +
> +#else
> + return false;
> +#endif
> +}
*thinks aloud*
We call this function after features have been negotiated, so we should
be able to reuse this interface for virtio-1 by checking for
VIRTIO_F_VERSION_1, right?
- Re: [Qemu-devel] [RFC PATCH 1/2] vhost: add VHOST_VRING_F_BYTESWAP flag,
Cornelia Huck <=