From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFtgU-0002Se-Vn for qemu-devel@nongnu.org; Tue, 18 Feb 2014 18:02:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFtgP-0006EB-Qt for qemu-devel@nongnu.org; Tue, 18 Feb 2014 18:02:38 -0500 Received: from cantor2.suse.de ([195.135.220.15]:35766 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFtgP-0006D5-LN for qemu-devel@nongnu.org; Tue, 18 Feb 2014 18:02:33 -0500 Message-ID: <5303E686.8080107@suse.de> Date: Wed, 19 Feb 2014 00:02:30 +0100 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <20140218123844.9849.58557.stgit@bahia.lab.toulouse-stg.fr.ibm.com> <20140218123849.9849.77875.stgit@bahia.lab.toulouse-stg.fr.ibm.com> <530372C6.70503@suse.de> In-Reply-To: <530372C6.70503@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/8] virtio_get_byteswap: function for endian-ambivalent targets using virtio. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: kwolf@redhat.com, peter.maydell@linaro.org, thuth@linux.vnet.ibm.com, mst@redhat.com, marc.zyngier@arm.com, rusty@rustcorp.com.au, qemu-devel@nongnu.org, stefanha@redhat.com, anthony@codemonkey.ws, pbonzini@redhat.com, Greg Kurz Am 18.02.2014 15:48, schrieb Alexander Graf: > On 02/18/2014 01:38 PM, Greg Kurz wrote: >> From: Rusty Russell >> >> virtio data structures are defined as "target endian", which assumes >> that's a fixed value. In fact, that actually means it's >> platform-specific. >> >> The OASIS virtio 1.0 spec will fix this. Meanwhile, create a hook for >> little endian ppc (and potentially ARM). This is called at device >> reset time (which is done before any driver is loaded) since it >> may involve a system call to get the status when running under kvm. >> >> [ fixed checkpatch.pl error with the virtio_byteswap initialisation, >> ldq_phys() API change, Greg Kurz ] >> Signed-off-by: Rusty Russell >> Signed-off-by: Greg Kurz >> --- >> hw/virtio/virtio.c | 6 ++ >> include/hw/virtio/virtio-access.h | 132 >> +++++++++++++++++++++++++++++++++++++ >> include/hw/virtio/virtio.h | 2 + >> stubs/Makefile.objs | 1 >> stubs/virtio_get_byteswap.c | 6 ++ >> 5 files changed, 147 insertions(+) >> create mode 100644 include/hw/virtio/virtio-access.h >> create mode 100644 stubs/virtio_get_byteswap.c >> >> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c >> index aeabf3a..4fd6ac2 100644 >> --- a/hw/virtio/virtio.c >> +++ b/hw/virtio/virtio.c >> @@ -19,6 +19,9 @@ >> #include "hw/virtio/virtio.h" >> #include "qemu/atomic.h" >> #include "hw/virtio/virtio-bus.h" >> +#include "hw/virtio/virtio-access.h" >> + >> +bool virtio_byteswap; >=20 > Could this be a virtio object property rather than a global? Imagine an > AMP guest system with a BE and an LE system running in parallel > accessing two separate virtio devices. With a single global that would > break. D=C3=A9j=C3=A0 vu... ;) http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg01043.html Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg