From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wxaa8-0005LY-91 for qemu-devel@nongnu.org; Thu, 19 Jun 2014 07:32:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wxaa3-0003Gx-C1 for qemu-devel@nongnu.org; Thu, 19 Jun 2014 07:32:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wxaa3-0003Gf-45 for qemu-devel@nongnu.org; Thu, 19 Jun 2014 07:32:35 -0400 Date: Thu, 19 Jun 2014 14:32:53 +0300 From: "Michael S. Tsirkin" Message-ID: <20140619113253.GB5777@redhat.com> References: <20140613111703.22108.14322.stgit@bahia.local> <20140613111808.22108.65439.stgit@bahia.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140613111808.22108.65439.stgit@bahia.local> Subject: Re: [Qemu-devel] [PATCH v8 01/20] virtio-serial: don't migrate the config space List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: Kevin Wolf , Peter Maydell , Stefan Hajnoczi , Juan Quintela , Rusty Russell , qemu-devel@nongnu.org, Alexander Graf , aneesh.kumar@linux.vnet.ibm.com, Anthony Liguori , Amit Shah , Paolo Bonzini , Andreas =?iso-8859-1?Q?F=E4rber?= On Fri, Jun 13, 2014 at 01:18:42PM +0200, Greg Kurz wrote: > The device configuration is set at realize time and never changes. It > should not be migrated as it is done today. For the sake of compatibility, > let's just skip them at load time. > > Signed-off-by: Alexander Graf > [ added missing casts to uint16_t *, > added SoB and commit message, > Greg Kurz ] > Signed-off-by: Greg Kurz This one is definitely a good thing to have, regardless. Reviewed-by: Michael S. Tsirkin > --- > hw/char/virtio-serial-bus.c | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) > > diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c > index 2b647b6..ee1ba16 100644 > --- a/hw/char/virtio-serial-bus.c > +++ b/hw/char/virtio-serial-bus.c > @@ -670,6 +670,7 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id) > uint32_t max_nr_ports, nr_active_ports, ports_map; > unsigned int i; > int ret; > + uint32_t tmp; > > if (version_id > 3) { > return -EINVAL; > @@ -685,17 +686,12 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id) > return 0; > } > > - /* The config space */ > - qemu_get_be16s(f, &s->config.cols); > - qemu_get_be16s(f, &s->config.rows); > - > - qemu_get_be32s(f, &max_nr_ports); > - tswap32s(&max_nr_ports); > - if (max_nr_ports > tswap32(s->config.max_nr_ports)) { > - /* Source could have had more ports than us. Fail migration. */ > - return -EINVAL; > - } > + /* Unused */ > + qemu_get_be16s(f, (uint16_t *) &tmp); > + qemu_get_be16s(f, (uint16_t *) &tmp); > + qemu_get_be32s(f, &tmp); > > + max_nr_ports = tswap32(s->config.max_nr_ports); > for (i = 0; i < (max_nr_ports + 31) / 32; i++) { > qemu_get_be32s(f, &ports_map); >