From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1VOi-0000YB-2r for qemu-devel@nongnu.org; Mon, 30 Jun 2014 02:49:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1VOY-0004h7-Fd for qemu-devel@nongnu.org; Mon, 30 Jun 2014 02:49:04 -0400 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:45275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1VOY-0004gd-7F for qemu-devel@nongnu.org; Mon, 30 Jun 2014 02:48:54 -0400 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Jun 2014 07:48:51 +0100 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 8300E1B08051 for ; Mon, 30 Jun 2014 07:49:22 +0100 (BST) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s5U6mmso11534410 for ; Mon, 30 Jun 2014 06:48:48 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 s5U6mjai028433 for ; Mon, 30 Jun 2014 00:48:47 -0600 Date: Mon, 30 Jun 2014 08:48:40 +0200 From: Greg Kurz Message-ID: <20140630084840.797a5a19@bahia.local> In-Reply-To: <20140629151353.GB29448@redhat.com> References: <20140624151955.17522.62537.stgit@bahia.local> <20140629151353.GB29448@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v9 00/22] legacy virtio support for cross-endian targets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Kevin Wolf , Peter Maydell , Anthony Liguori , Juan Quintela , Rusty Russell , qemu-devel@nongnu.org, Alexander Graf , aneesh.kumar@linux.vnet.ibm.com, Stefan Hajnoczi , Amit Shah , Paolo Bonzini , Andreas =?UTF-8?B?RsOkcmJlcg==?= On Sun, 29 Jun 2014 18:13:53 +0300 "Michael S. Tsirkin" wrote: > On Tue, Jun 24, 2014 at 07:06:58PM +0200, Greg Kurz wrote: > > The current legacy virtio devices have a fundamental flaw: they all sha= re > > data between host and guest with guest endianness ordering. This is ok = for > > nearly all architectures that have fixed endianness. Unfortunately, it = breaks > > for recent PPC64 and ARM targets that can change endianness at runtime. > > The virtio-1.0 specification fixes the issue by enforcing little-endian > > ordering. It may take some time though until the code for 1.0 gets avai= lable > > and supported, and all the users can migrate. There have been discussio= ns > > for some monthes about supporting such oddity: now we have little-endian > > PPC64 distros available, it is worth to propose something. > >=20 > > This patch set brings legacy virtio support for cross-endian targets. T= he > > rationale is that we add a new device_endianness property to VirtIODevi= ce. > > This property is used as a runtime indicator to decide wether we should > > do little-endian or big-endian conversion, as opposed to the compile ti= me > > choice we have now with TARGTE_WORDS_BIGENDIAN. The choice was made to > > sample the device endianness out of the endianness mode of the guest > > CPU that does the reset. It is an evil but logical consequence of the > > initial flaw in the virtio specification, and it was agreed that the co= ncept > > would be a good common base for ARM and PPC64 enablement at least. Plea= se > > note also that this new property is state and must be preserved across > > migrations. > >=20 > > There are several parts in the serie: > > - patches 1 and 2 are simple fixes > > - patches 3 to 9 introduce VMState based subsections in the virtio > > migration code. This is needed because we introduce a new property > > in VirtIODevice that we want to migrate without ruining compatibility > > efforts > > - patches 10 to 13 bring virtio device endianness and memory accessors > > to be used by the virtio code > > - patches 14 to 20 wire the new memory accessors everywhere accross the > > virtio code > > - patch 21 is the PPC64 enablement > > - patch 22 is a follow-up workaround to disable vhost-net acceleration > > in the case the host and guest have different endianness, because > > it is not supported for the moment > >=20 > > Changes since v8 are provided in each patch. > >=20 > > Cheers. >=20 > Applied, thanks everyone. >=20 \O/ Thanks Michael ! -- Greg > > --- > >=20 > > Alexander Graf (1): > > virtio-serial: don't migrate the config space > >=20 > > C=C3=A9dric Le Goater (1): > > virtio-net: byteswap virtio-net header > >=20 > > Greg Kurz (14): > > virtio: introduce device specific migration calls > > virtio-net: implement per-device migration calls > > virtio-blk: implement per-device migration calls > > virtio-serial: implement per-device migration calls > > virtio-balloon: implement per-device migration calls > > virtio-rng: implement per-device migration calls > > virtio: add subsections to the migration stream > > exec: introduce target_words_bigendian() helper > > cpu: introduce CPUClass::virtio_is_big_endian() > > virtio: add endian-ambivalent support to VirtIODevice > > virtio: memory accessors for endian-ambivalent targets > > virtio-9p: use virtio wrappers to access headers > > target-ppc: enable virtio endian ambivalent support > > vhost-net: disable when cross-endian > >=20 > > Rusty Russell (6): > > virtio: allow byte swapping for vring > > virtio-net: use virtio wrappers to access headers > > virtio-balloon: use virtio wrappers to access page frame numbers > > virtio-blk: use virtio wrappers to access headers > > virtio-scsi: use virtio wrappers to access headers > > virtio-serial-bus: use virtio wrappers to access headers > >=20 > >=20 > > exec.c | 8 - > > hw/9pfs/virtio-9p-device.c | 3 - > > hw/block/virtio-blk.c | 62 ++++++----- > > hw/char/virtio-serial-bus.c | 94 ++++++++++------ > > hw/net/vhost_net.c | 19 +++ > > hw/net/virtio-net.c | 56 +++++++--- > > hw/scsi/virtio-scsi.c | 40 ++++--- > > hw/virtio/virtio-balloon.c | 33 +++--- > > hw/virtio/virtio-pci.c | 11 +- > > hw/virtio/virtio-rng.c | 12 +- > > hw/virtio/virtio.c | 216 ++++++++++++++++++++++++++++-= -------- > > include/hw/virtio/virtio-access.h | 170 +++++++++++++++++++++++++++++ > > include/hw/virtio/virtio.h | 17 +++ > > include/qom/cpu.h | 1=20 > > qom/cpu.c | 6 + > > target-ppc/cpu.h | 2=20 > > target-ppc/translate_init.c | 15 +++ > > 17 files changed, 583 insertions(+), 182 deletions(-) > > create mode 100644 include/hw/virtio/virtio-access.h > >=20 > > -- > > Greg >=20