diff mbox series

Fix coredump when using virtio-vga

Message ID 1551413588-36475-1-git-send-email-08005325@163.com
State New
Headers show
Series Fix coredump when using virtio-vga | expand

Commit Message

08005325@163.com March 1, 2019, 4:13 a.m. UTC
From: Michael Qiu <qiudayu@huayun.com>


When using command -device virtio-vga,virgl=on
the default max_outputs is 0, this will lead coredump,

    (con=0x0, hw_ops=0x5555564452e0 <virtio_vga_ops>,
     opaque=0x55555754ec60) at ui/console.c:1872
    (vpci_dev=0x55555754ec60, errp=0x7fffffffdbb8)
     at qemu/hw/display/virtio-vga.c:160
    (pci_dev=0x55555754ec60, errp=0x7fffffffdbb8)
     at hw/virtio/virtio-pci.c:1786
...

This patch force ths max_outputs to 1 when it not greater
than 0.

Signed-off-by: Michael Qiu <qiudayu@huayun.com>

---
 hw/display/virtio-gpu-pci.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
1.8.3.1
diff mbox series

Patch

diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c
index bdcd33c..59b571d 100644
--- a/hw/display/virtio-gpu-pci.c
+++ b/hw/display/virtio-gpu-pci.c
@@ -46,6 +46,11 @@  static void virtio_gpu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
     int i;
     Error *local_error = NULL;
 
+    if (g->conf.max_outputs <= 0) {
+        qemu_log("WARNING: virtio gpu max_outputs must greater than 1");
+        g->conf.max_outputs = 1;
+    }
+
     qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
     virtio_pci_force_virtio_1(vpci_dev);
     object_property_set_bool(OBJECT(vdev), true, "realized", &local_error);