From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlJZp-0000VS-Rp for qemu-devel@nongnu.org; Mon, 03 Nov 2014 10:30:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XlJZd-0000Tk-2I for qemu-devel@nongnu.org; Mon, 03 Nov 2014 10:29:53 -0500 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:48484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XlJZc-0000Ta-Op for qemu-devel@nongnu.org; Mon, 03 Nov 2014 10:29:40 -0500 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 3 Nov 2014 15:29:39 -0000 Date: Mon, 3 Nov 2014 16:29:31 +0100 From: Cornelia Huck Message-ID: <20141103162931.4edbed1f.cornelia.huck@de.ibm.com> In-Reply-To: <1414572130-17014-2-git-send-email-clg@fr.ibm.com> References: <1414572130-17014-1-git-send-email-clg@fr.ibm.com> <1414572130-17014-2-git-send-email-clg@fr.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH 1/2] vhost: add VHOST_VRING_F_BYTESWAP flag List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?Q8OpZHJpYw==?= Le Goater Cc: mst@redhat.com, aik@ozlabs.ru, agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, paulus@samba.org On Wed, 29 Oct 2014 09:42:09 +0100 C=C3=A9dric Le Goater wrote: > When the guest and the host have a different endian order, the data=20 > being accessed in the vring queues needs to be byteswapped. >=20 > This patch adds a VHOST_VRING_F_BYTESWAP flag to inform the vhost=20 > kernel backend to byteswap vring data. >=20 > Signed-off-by: C=C3=A9dric Le Goater > --- > 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?