diff mbox

[v8,01/20] virtio-serial: don't migrate the config space

Message ID 20140613111808.22108.65439.stgit@bahia.local
State New
Headers show

Commit Message

Greg Kurz June 13, 2014, 11:18 a.m. UTC
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 <agraf@suse.de>
[ added missing casts to uint16_t *,
  added SoB and commit message,
  Greg Kurz <gkurz@linux.vnet.ibm.com> ]
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
---
 hw/char/virtio-serial-bus.c |   16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

Comments

Alexander Graf June 13, 2014, 11:33 a.m. UTC | #1
On 13.06.14 13:18, 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 <agraf@suse.de>
> [ added missing casts to uint16_t *,
>    added SoB and commit message,
>    Greg Kurz <gkurz@linux.vnet.ibm.com> ]
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>

Legally you would have to ask me for my SoB line and are not allowed to 
add it yourself, but here it is:

  Signed-off-by: Alexander Graf <agraf@suse.de>

So we're all good now ;).


Thanks!

Alex
Amit Shah June 19, 2014, 10:40 a.m. UTC | #2
On (Fri) 13 Jun 2014 [13:18:42], 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 <agraf@suse.de>

The author field should also mention Alex instead of you, I suppose,
since it was authored by him.

Patch looks good.

		Amit
Greg Kurz June 19, 2014, 11:17 a.m. UTC | #3
On Thu, 19 Jun 2014 16:10:15 +0530
Amit Shah <amit.shah@redhat.com> wrote:

> On (Fri) 13 Jun 2014 [13:18:42], 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 <agraf@suse.de>
> 
> The author field should also mention Alex instead of you, I suppose,
> since it was authored by him.
> 

I'll add a From: line.

> Patch looks good.
> 
> 		Amit
> 

Thanks for the review.
Michael S. Tsirkin June 19, 2014, 11:32 a.m. UTC | #4
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 <agraf@suse.de>
> [ added missing casts to uint16_t *,
>   added SoB and commit message,
>   Greg Kurz <gkurz@linux.vnet.ibm.com> ]
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>

This one is definitely a good thing to have, regardless.
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  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);
>
diff mbox

Patch

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);