From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37707) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkEFP-0005Ed-R5 for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:37:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xju2x-0005LE-Ni for qemu-devel@nongnu.org; Thu, 30 Oct 2014 14:02:16 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:60257) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xju2x-0005KB-GF for qemu-devel@nongnu.org; Thu, 30 Oct 2014 14:02:07 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 30 Oct 2014 18:02:06 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 434BA1B08023 for ; Thu, 30 Oct 2014 18:02:08 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id s9UI24sn16253310 for ; Thu, 30 Oct 2014 18:02:04 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s9UI234f005458 for ; Thu, 30 Oct 2014 12:02:04 -0600 Date: Thu, 30 Oct 2014 19:02:01 +0100 From: Cornelia Huck Message-ID: <20141030190201.41e8940d.cornelia.huck@de.ibm.com> In-Reply-To: <20141028164018.29d73d9f@bahia.local> References: <1412692807-12398-1-git-send-email-cornelia.huck@de.ibm.com> <1412692807-12398-6-git-send-email-cornelia.huck@de.ibm.com> <20141028164018.29d73d9f@bahia.local> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH RFC 05/11] virtio: introduce legacy virtio devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: thuth@linux.vnet.ibm.com, rusty@rustcorp.com.au, qemu-devel@nongnu.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org On Tue, 28 Oct 2014 16:40:18 +0100 Greg Kurz wrote: > On Tue, 7 Oct 2014 16:40:01 +0200 > Cornelia Huck wrote: > > > Introduce a helper function to indicate whether a virtio device is > > operating in legacy or virtio standard mode. > > > > It may be used to make decisions about the endianess of virtio accesses > > and other virtio-1 specific changes, enabling us to support transitional > > devices. > > > > Reviewed-by: Thomas Huth > > Signed-off-by: Cornelia Huck > > --- > > hw/virtio/virtio.c | 6 +++++- > > include/hw/virtio/virtio-access.h | 4 ++++ > > include/hw/virtio/virtio.h | 13 +++++++++++-- > > 3 files changed, 20 insertions(+), 3 deletions(-) > > > > diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c > > index 7aaa953..e6ae3a0 100644 > > --- a/hw/virtio/virtio.c > > +++ b/hw/virtio/virtio.c > > @@ -883,7 +883,11 @@ static bool virtio_device_endian_needed(void *opaque) > > VirtIODevice *vdev = opaque; > > > > assert(vdev->device_endian != VIRTIO_DEVICE_ENDIAN_UNKNOWN); > > - return vdev->device_endian != virtio_default_endian(); > > + if (virtio_device_is_legacy(vdev)) { > > + return vdev->device_endian != virtio_default_endian(); > > + } > > + /* Devices conforming to VIRTIO 1.0 or later are always LE. */ > > + return vdev->device_endian != VIRTIO_DEVICE_ENDIAN_LITTLE; > > } > > > > Shouldn't we have some code doing the following somewhere ? > > if (!virtio_device_is_legacy(vdev)) { > vdev->device_endian = VIRTIO_DEVICE_ENDIAN_LITTLE; > } > > also, since virtio-1 is LE only, do we expect device_endian to > be different from VIRTIO_DEVICE_ENDIAN_LITTLE ? device_endian should not depend on whether the device is legacy or not. virtio_is_big_endian always returns false for virtio-1 devices, though.