From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsAEK-00088F-NM for qemu-devel@nongnu.org; Tue, 12 May 2015 09:28:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsABm-00025n-2r for qemu-devel@nongnu.org; Tue, 12 May 2015 09:25:43 -0400 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:47849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsABl-00025d-La for qemu-devel@nongnu.org; Tue, 12 May 2015 09:25:37 -0400 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 12 May 2015 14:25:36 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id D3CEE1B08023 for ; Tue, 12 May 2015 14:26:18 +0100 (BST) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t4CDPXg04063528 for ; Tue, 12 May 2015 13:25:33 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t4CDPWhr006527 for ; Tue, 12 May 2015 07:25:33 -0600 Date: Tue, 12 May 2015 15:25:30 +0200 From: Cornelia Huck Message-ID: <20150512152530.4ab0c56f.cornelia.huck@de.ibm.com> In-Reply-To: <20150506120801.8607.64278.stgit@bahia.huguette.org> References: <20150506120729.8607.23404.stgit@bahia.huguette.org> <20150506120801.8607.64278.stgit@bahia.huguette.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC 4/7] vhost: set vring endianness for legacy virtio List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: Jason Wang , virtualization@lists.linux-foundation.org, qemu-devel@nongnu.org, Stefan Hajnoczi , "Michael S. Tsirkin" On Wed, 06 May 2015 14:08:02 +0200 Greg Kurz wrote: > Legacy virtio is native endian: if the guest and host endianness differ, > we have to tell vhost so it can swap bytes where appropriate. This is > done through a vhost ring ioctl. > > Signed-off-by: Greg Kurz > --- > hw/virtio/vhost.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 49 insertions(+), 1 deletion(-) > > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c > index 54851b7..1d7b939 100644 > --- a/hw/virtio/vhost.c > +++ b/hw/virtio/vhost.c (...) > @@ -677,6 +700,16 @@ static int vhost_virtqueue_start(struct vhost_dev *dev, > return -errno; > } > > + if (!virtio_has_feature(vdev, VIRTIO_F_VERSION_1) && I think this should either go in after the virtio-1 base support (more feature bits etc.) or get a big fat comment and be touched up later. I'd prefer the first solution so it does not get forgotten, but I'm not sure when Michael plans to proceed with the virtio-1 patches (I think they're mostly fine already). > + virtio_legacy_is_cross_endian(vdev)) { > + r = vhost_virtqueue_set_vring_endian_legacy(dev, > + virtio_is_big_endian(vdev), > + vhost_vq_index); > + if (r) { > + return -errno; > + } > + } > + > s = l = virtio_queue_get_desc_size(vdev, idx); > a = virtio_queue_get_desc_addr(vdev, idx); > vq->desc = cpu_physical_memory_map(a, &l, 0);