qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.3] virtio-serial: fix virtio config size
@ 2015-03-25 11:41 Michael S. Tsirkin
  2015-03-25 11:45 ` Cole Robinson
  0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2015-03-25 11:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: Amit Shah, Peter Maydell, Cole Robinson

commit 9b70c1790acacae54d559d38ca69186a85040bb8
    virtio-serial: switch to standard-headers

changes virtio_console_config size from 8 to 12 bytes:
it adds an optional 4 byte emerg_wr field.

As this crosses a power of two boundary, this changes the PCI BAR size,
which breaks migration compatibility with old qemu machine types.
It's probably a problem for other transports as well.

As a temporary fix, as we don't yet support this new field anyway,
simply make the config size smaller at init time.

Long terms we probably want something along the lines
of virtio_net_set_config_size.

Reported-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

Cole, could you pls confirm the following fixes the
issue that you reported?

Thanks!

 hw/char/virtio-serial-bus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 9a029d2..d05473f 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -949,8 +949,10 @@ static void virtio_serial_device_realize(DeviceState *dev, Error **errp)
         return;
     }
 
+    /* We don't support emergency write, skip it for now. */
+    /* TODO: cleaner fix, depending on host features. */
     virtio_init(vdev, "virtio-serial", VIRTIO_ID_CONSOLE,
-                sizeof(struct virtio_console_config));
+                offsetof(struct virtio_console_config, emerg_wr));
 
     /* Spawn a new virtio-serial bus on which the ports will ride as devices */
     qbus_create_inplace(&vser->bus, sizeof(vser->bus), TYPE_VIRTIO_SERIAL_BUS,
-- 
MST

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.3] virtio-serial: fix virtio config size
  2015-03-25 11:41 [Qemu-devel] [PATCH for-2.3] virtio-serial: fix virtio config size Michael S. Tsirkin
@ 2015-03-25 11:45 ` Cole Robinson
  0 siblings, 0 replies; 2+ messages in thread
From: Cole Robinson @ 2015-03-25 11:45 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: Amit Shah, Peter Maydell

On 03/25/2015 07:41 AM, Michael S. Tsirkin wrote:
> commit 9b70c1790acacae54d559d38ca69186a85040bb8
>     virtio-serial: switch to standard-headers
> 
> changes virtio_console_config size from 8 to 12 bytes:
> it adds an optional 4 byte emerg_wr field.
> 
> As this crosses a power of two boundary, this changes the PCI BAR size,
> which breaks migration compatibility with old qemu machine types.
> It's probably a problem for other transports as well.
> 
> As a temporary fix, as we don't yet support this new field anyway,
> simply make the config size smaller at init time.
> 
> Long terms we probably want something along the lines
> of virtio_net_set_config_size.
> 
> Reported-by: Cole Robinson <crobinso@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
> Cole, could you pls confirm the following fixes the
> issue that you reported?
> 
> Thanks!
> 
>  hw/char/virtio-serial-bus.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
> index 9a029d2..d05473f 100644
> --- a/hw/char/virtio-serial-bus.c
> +++ b/hw/char/virtio-serial-bus.c
> @@ -949,8 +949,10 @@ static void virtio_serial_device_realize(DeviceState *dev, Error **errp)
>          return;
>      }
>  
> +    /* We don't support emergency write, skip it for now. */
> +    /* TODO: cleaner fix, depending on host features. */
>      virtio_init(vdev, "virtio-serial", VIRTIO_ID_CONSOLE,
> -                sizeof(struct virtio_console_config));
> +                offsetof(struct virtio_console_config, emerg_wr));
>  
>      /* Spawn a new virtio-serial bus on which the ports will ride as devices */
>      qbus_create_inplace(&vser->bus, sizeof(vser->bus), TYPE_VIRTIO_SERIAL_BUS,
> 

Fixes the migration failure for me, thanks!

Tested-by: Cole Robinson <crobinso@redhat.com>

- Cole

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-25 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-25 11:41 [Qemu-devel] [PATCH for-2.3] virtio-serial: fix virtio config size Michael S. Tsirkin
2015-03-25 11:45 ` Cole Robinson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).