]> git.proxmox.com Git - mirror_qemu.git/commitdiff
virtio-serial: fix virtio config size
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 25 Mar 2015 11:33:55 +0000 (12:33 +0100)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 25 Mar 2015 12:39:25 +0000 (13:39 +0100)
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>
Tested-by: Cole Robinson <crobinso@redhat.com>
hw/char/virtio-serial-bus.c

index d14e872d34e89ec404c334972343756c408d084b..e336bdb4a98e8483480e0a76a9b924284f8740b1 100644 (file)
@@ -980,8 +980,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,