All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga
@ 2015-06-16  7:57 Gerd Hoffmann
  2015-06-16  7:57 ` [Qemu-devel] [PULL 1/5] virtio-gpu: fix error message Gerd Hoffmann
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2015-06-16  7:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

This pull request almost completes virtio-gpu support, by adding pci
support (virtio-gpu-pci) and a variant with vga compatibility
(virtio-vga).  The remaining missing bit is the vgabios for virtio-vga,
which will come with the seabios update later this week.

please pull,
  Gerd

The following changes since commit d8e3b729cf452d2689c8669f1ec18158db29fd5a:

  Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2015-06-11 15:33:38 +0100)

are available in the git repository at:


  git://git.kraxel.org/qemu tags/pull-vga-20150615-1

for you to fetch changes up to 7a4dfd1e4a741991df1acf31672b391648e0aa0c:

  virtio-vga: add vgabios configuration (2015-06-12 10:13:23 +0200)

----------------------------------------------------------------
virtio-gpu: pci support bits and virtio-vga.

----------------------------------------------------------------
Gerd Hoffmann (5):
      virtio-gpu: fix error message
      virtio-gpu-pci: add virtio pci support
      virtio-vga: add virtio gpu device with vga compatibility
      virtio-vga: add '-vga virtio' support
      virtio-vga: add vgabios configuration

 Makefile                           |   2 +-
 default-configs/x86_64-softmmu.mak |   1 +
 hw/display/Makefile.objs           |   2 +
 hw/display/vga-pci.c               |   8 +-
 hw/display/vga_int.h               |   6 ++
 hw/display/virtio-gpu-pci.c        |  68 ++++++++++++++
 hw/display/virtio-gpu.c            |   2 +-
 hw/display/virtio-vga.c            | 175 +++++++++++++++++++++++++++++++++++++
 hw/isa/isa-bus.c                   |   3 +
 hw/pci/pci.c                       |   2 +
 hw/virtio/virtio-pci.h             |  14 +++
 include/sysemu/sysemu.h            |   2 +-
 qemu-options.hx                    |   4 +-
 roms/Makefile                      |   2 +-
 roms/config.vga-virtio             |   6 ++
 vl.c                               |  13 +++
 16 files changed, 301 insertions(+), 9 deletions(-)
 create mode 100644 hw/display/virtio-gpu-pci.c
 create mode 100644 hw/display/virtio-vga.c
 create mode 100644 roms/config.vga-virtio

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

* [Qemu-devel] [PULL 1/5] virtio-gpu: fix error message
  2015-06-16  7:57 [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga Gerd Hoffmann
@ 2015-06-16  7:57 ` Gerd Hoffmann
  2015-06-16  7:57 ` [Qemu-devel] [PULL 2/5] virtio-gpu-pci: add virtio pci support Gerd Hoffmann
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2015-06-16  7:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin

iov limit was raised, but the error message still has the old limit ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/virtio-gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 4b10ca1..8c109b7 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -534,7 +534,7 @@ int virtio_gpu_create_mapping_iov(struct virtio_gpu_resource_attach_backing *ab,
 
     if (ab->nr_entries > 16384) {
         qemu_log_mask(LOG_GUEST_ERROR,
-                      "%s: nr_entries is too big (%d > 1024)\n",
+                      "%s: nr_entries is too big (%d > 16384)\n",
                       __func__, ab->nr_entries);
         return -1;
     }
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 2/5] virtio-gpu-pci: add virtio pci support
  2015-06-16  7:57 [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga Gerd Hoffmann
  2015-06-16  7:57 ` [Qemu-devel] [PULL 1/5] virtio-gpu: fix error message Gerd Hoffmann
@ 2015-06-16  7:57 ` Gerd Hoffmann
  2015-06-16  7:57 ` [Qemu-devel] [PULL 3/5] virtio-vga: add virtio gpu device with vga compatibility Gerd Hoffmann
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2015-06-16  7:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dave Airlie, Gerd Hoffmann, Michael S. Tsirkin

This patch adds virtio-gpu-pci, which is the pci proxy for the virtio
gpu device.  With this patch in place virtio-gpu is functional.  You
need a linux guest with a virtio-gpu driver though, and output will
appear pretty late in boot, once the kernel initialized drm and fbcon.

Written by Dave Airlie and Gerd Hoffmann.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/Makefile.objs    |  1 +
 hw/display/virtio-gpu-pci.c | 68 +++++++++++++++++++++++++++++++++++++++++++++
 hw/virtio/virtio-pci.h      | 14 ++++++++++
 3 files changed, 83 insertions(+)
 create mode 100644 hw/display/virtio-gpu-pci.c

diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs
index 61c80f3..26284a1 100644
--- a/hw/display/Makefile.objs
+++ b/hw/display/Makefile.objs
@@ -36,3 +36,4 @@ obj-$(CONFIG_VGA) += vga.o
 common-obj-$(CONFIG_QXL) += qxl.o qxl-logger.o qxl-render.o
 
 obj-$(CONFIG_VIRTIO) += virtio-gpu.o
+obj-$(CONFIG_VIRTIO_PCI) += virtio-gpu-pci.o
diff --git a/hw/display/virtio-gpu-pci.c b/hw/display/virtio-gpu-pci.c
new file mode 100644
index 0000000..f0f25c7
--- /dev/null
+++ b/hw/display/virtio-gpu-pci.c
@@ -0,0 +1,68 @@
+/*
+ * Virtio video device
+ *
+ * Copyright Red Hat
+ *
+ * Authors:
+ *  Dave Airlie
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+#include "hw/pci/pci.h"
+#include "hw/virtio/virtio.h"
+#include "hw/virtio/virtio-bus.h"
+#include "hw/virtio/virtio-pci.h"
+#include "hw/virtio/virtio-gpu.h"
+
+static Property virtio_gpu_pci_properties[] = {
+    DEFINE_VIRTIO_GPU_PROPERTIES(VirtIOGPUPCI, vdev.conf),
+    DEFINE_VIRTIO_GPU_PCI_PROPERTIES(VirtIOPCIProxy),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static void virtio_gpu_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
+{
+    VirtIOGPUPCI *vgpu = VIRTIO_GPU_PCI(vpci_dev);
+    DeviceState *vdev = DEVICE(&vgpu->vdev);
+
+    qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));
+    /* force virtio-1.0 */
+    vpci_dev->flags &= ~VIRTIO_PCI_FLAG_DISABLE_MODERN;
+    vpci_dev->flags |= VIRTIO_PCI_FLAG_DISABLE_LEGACY;
+    object_property_set_bool(OBJECT(vdev), true, "realized", errp);
+}
+
+static void virtio_gpu_pci_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
+    PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
+
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
+    dc->props = virtio_gpu_pci_properties;
+    k->realize = virtio_gpu_pci_realize;
+    pcidev_k->class_id = PCI_CLASS_DISPLAY_OTHER;
+}
+
+static void virtio_gpu_initfn(Object *obj)
+{
+    VirtIOGPUPCI *dev = VIRTIO_GPU_PCI(obj);
+    object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_GPU);
+    object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+}
+
+static const TypeInfo virtio_gpu_pci_info = {
+    .name = TYPE_VIRTIO_GPU_PCI,
+    .parent = TYPE_VIRTIO_PCI,
+    .instance_size = sizeof(VirtIOGPUPCI),
+    .instance_init = virtio_gpu_initfn,
+    .class_init = virtio_gpu_pci_class_init,
+};
+
+static void virtio_gpu_pci_register_types(void)
+{
+    type_register_static(&virtio_gpu_pci_info);
+}
+type_init(virtio_gpu_pci_register_types)
diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h
index d962125..96025ca 100644
--- a/hw/virtio/virtio-pci.h
+++ b/hw/virtio/virtio-pci.h
@@ -25,6 +25,7 @@
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-9p.h"
 #include "hw/virtio/virtio-input.h"
+#include "hw/virtio/virtio-gpu.h"
 #ifdef CONFIG_VIRTFS
 #include "hw/9pfs/virtio-9p.h"
 #endif
@@ -42,6 +43,7 @@ typedef struct VHostSCSIPCI VHostSCSIPCI;
 typedef struct VirtIORngPCI VirtIORngPCI;
 typedef struct VirtIOInputPCI VirtIOInputPCI;
 typedef struct VirtIOInputHIDPCI VirtIOInputHIDPCI;
+typedef struct VirtIOGPUPCI VirtIOGPUPCI;
 
 /* virtio-pci-bus */
 
@@ -261,6 +263,18 @@ struct VirtIOInputHIDPCI {
     VirtIOInputHID vdev;
 };
 
+/*
+ * virtio-gpu-pci: This extends VirtioPCIProxy.
+ */
+#define TYPE_VIRTIO_GPU_PCI "virtio-gpu-pci"
+#define VIRTIO_GPU_PCI(obj) \
+        OBJECT_CHECK(VirtIOGPUPCI, (obj), TYPE_VIRTIO_GPU_PCI)
+
+struct VirtIOGPUPCI {
+    VirtIOPCIProxy parent_obj;
+    VirtIOGPU vdev;
+};
+
 /* Virtio ABI version, if we increment this, we break the guest driver. */
 #define VIRTIO_PCI_ABI_VERSION          0
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 3/5] virtio-vga: add virtio gpu device with vga compatibility
  2015-06-16  7:57 [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga Gerd Hoffmann
  2015-06-16  7:57 ` [Qemu-devel] [PULL 1/5] virtio-gpu: fix error message Gerd Hoffmann
  2015-06-16  7:57 ` [Qemu-devel] [PULL 2/5] virtio-gpu-pci: add virtio pci support Gerd Hoffmann
@ 2015-06-16  7:57 ` Gerd Hoffmann
  2015-06-16  7:57 ` [Qemu-devel] [PULL 4/5] virtio-vga: add '-vga virtio' support Gerd Hoffmann
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2015-06-16  7:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dave Airlie, Gerd Hoffmann, Michael S. Tsirkin

This patch adds a virtio-vga device.  It is simliar to virtio-gpu-pci,
but it also adds in vga compatibility, so guests without native
virtio-gpu support can drive the device in vga mode.  It is compatible
with stdvga.

Written by Dave Airlie and Gerd Hoffmann.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 default-configs/x86_64-softmmu.mak |   1 +
 hw/display/Makefile.objs           |   1 +
 hw/display/vga-pci.c               |   8 +-
 hw/display/vga_int.h               |   6 ++
 hw/display/virtio-vga.c            | 175 +++++++++++++++++++++++++++++++++++++
 5 files changed, 187 insertions(+), 4 deletions(-)
 create mode 100644 hw/display/virtio-vga.c

diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
index 2f2955b..62575eb 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -7,6 +7,7 @@ CONFIG_QXL=$(CONFIG_SPICE)
 CONFIG_VGA_ISA=y
 CONFIG_VGA_CIRRUS=y
 CONFIG_VMWARE_VGA=y
+CONFIG_VIRTIO_VGA=y
 CONFIG_VMMOUSE=y
 CONFIG_SERIAL=y
 CONFIG_PARALLEL=y
diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs
index 26284a1..dd8ea76 100644
--- a/hw/display/Makefile.objs
+++ b/hw/display/Makefile.objs
@@ -37,3 +37,4 @@ common-obj-$(CONFIG_QXL) += qxl.o qxl-logger.o qxl-render.o
 
 obj-$(CONFIG_VIRTIO) += virtio-gpu.o
 obj-$(CONFIG_VIRTIO_PCI) += virtio-gpu-pci.o
+obj-$(CONFIG_VIRTIO_VGA) += virtio-vga.o
diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c
index 0ed44c7..1dfa331 100644
--- a/hw/display/vga-pci.c
+++ b/hw/display/vga-pci.c
@@ -204,10 +204,10 @@ static const MemoryRegionOps pci_vga_qext_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
-static void pci_std_vga_mmio_region_init(VGACommonState *s,
-                                         MemoryRegion *parent,
-                                         MemoryRegion *subs,
-                                         bool qext)
+void pci_std_vga_mmio_region_init(VGACommonState *s,
+                                  MemoryRegion *parent,
+                                  MemoryRegion *subs,
+                                  bool qext)
 {
     memory_region_init_io(&subs[0], NULL, &pci_vga_ioport_ops, s,
                           "vga ioports remapped", PCI_VGA_IOPORT_SIZE);
diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h
index fcfcc5f..40ba6a4 100644
--- a/hw/display/vga_int.h
+++ b/hw/display/vga_int.h
@@ -219,4 +219,10 @@ extern const uint8_t gr_mask[16];
 
 extern const MemoryRegionOps vga_mem_ops;
 
+/* vga-pci.c */
+void pci_std_vga_mmio_region_init(VGACommonState *s,
+                                  MemoryRegion *parent,
+                                  MemoryRegion *subs,
+                                  bool qext);
+
 #endif
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
new file mode 100644
index 0000000..94f9d0e
--- /dev/null
+++ b/hw/display/virtio-vga.c
@@ -0,0 +1,175 @@
+#include "hw/hw.h"
+#include "hw/pci/pci.h"
+#include "ui/console.h"
+#include "vga_int.h"
+#include "hw/virtio/virtio-pci.h"
+
+/*
+ * virtio-vga: This extends VirtioPCIProxy.
+ */
+#define TYPE_VIRTIO_VGA "virtio-vga"
+#define VIRTIO_VGA(obj) \
+        OBJECT_CHECK(VirtIOVGA, (obj), TYPE_VIRTIO_VGA)
+
+typedef struct VirtIOVGA {
+    VirtIOPCIProxy parent_obj;
+    VirtIOGPU      vdev;
+    VGACommonState vga;
+    MemoryRegion   vga_mrs[3];
+} VirtIOVGA;
+
+static void virtio_vga_invalidate_display(void *opaque)
+{
+    VirtIOVGA *vvga = opaque;
+
+    if (vvga->vdev.enable) {
+        virtio_gpu_ops.invalidate(&vvga->vdev);
+    } else {
+        vvga->vga.hw_ops->invalidate(&vvga->vga);
+    }
+}
+
+static void virtio_vga_update_display(void *opaque)
+{
+    VirtIOVGA *vvga = opaque;
+
+    if (vvga->vdev.enable) {
+        virtio_gpu_ops.gfx_update(&vvga->vdev);
+    } else {
+        vvga->vga.hw_ops->gfx_update(&vvga->vga);
+    }
+}
+
+static void virtio_vga_text_update(void *opaque, console_ch_t *chardata)
+{
+    VirtIOVGA *vvga = opaque;
+
+    if (vvga->vdev.enable) {
+        if (virtio_gpu_ops.text_update) {
+            virtio_gpu_ops.text_update(&vvga->vdev, chardata);
+        }
+    } else {
+        if (vvga->vga.hw_ops->text_update) {
+            vvga->vga.hw_ops->text_update(&vvga->vga, chardata);
+        }
+    }
+}
+
+static int virtio_vga_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
+{
+    VirtIOVGA *vvga = opaque;
+
+    if (virtio_gpu_ops.ui_info) {
+        return virtio_gpu_ops.ui_info(&vvga->vdev, idx, info);
+    }
+    return -1;
+}
+
+static const GraphicHwOps virtio_vga_ops = {
+    .invalidate = virtio_vga_invalidate_display,
+    .gfx_update = virtio_vga_update_display,
+    .text_update = virtio_vga_text_update,
+    .ui_info = virtio_vga_ui_info,
+};
+
+/* VGA device wrapper around PCI device around virtio GPU */
+static void virtio_vga_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
+{
+    VirtIOVGA *vvga = VIRTIO_VGA(vpci_dev);
+    VirtIOGPU *g = &vvga->vdev;
+    VGACommonState *vga = &vvga->vga;
+    uint32_t offset;
+
+    /* init vga compat bits */
+    vga->vram_size_mb = 8;
+    vga_common_init(vga, OBJECT(vpci_dev), false);
+    vga_init(vga, OBJECT(vpci_dev), pci_address_space(&vpci_dev->pci_dev),
+             pci_address_space_io(&vpci_dev->pci_dev), true);
+    pci_register_bar(&vpci_dev->pci_dev, 0,
+                     PCI_BASE_ADDRESS_MEM_PREFETCH, &vga->vram);
+
+    /*
+     * Configure virtio bar and regions
+     *
+     * We use bar #2 for the mmio regions, to be compatible with stdvga.
+     * virtio regions are moved to the end of bar #2, to make room for
+     * the stdvga mmio registers at the start of bar #2.
+     */
+    vpci_dev->modern_mem_bar = 2;
+    vpci_dev->msix_bar = 4;
+    offset = memory_region_size(&vpci_dev->modern_bar);
+    offset -= vpci_dev->notify.size;
+    vpci_dev->notify.offset = offset;
+    offset -= vpci_dev->device.size;
+    vpci_dev->device.offset = offset;
+    offset -= vpci_dev->isr.size;
+    vpci_dev->isr.offset = offset;
+    offset -= vpci_dev->common.size;
+    vpci_dev->common.offset = offset;
+
+    /* init virtio bits */
+    qdev_set_parent_bus(DEVICE(g), BUS(&vpci_dev->bus));
+    /* force virtio-1.0 */
+    vpci_dev->flags &= ~VIRTIO_PCI_FLAG_DISABLE_MODERN;
+    vpci_dev->flags |= VIRTIO_PCI_FLAG_DISABLE_LEGACY;
+    object_property_set_bool(OBJECT(g), true, "realized", errp);
+
+    /* add stdvga mmio regions */
+    pci_std_vga_mmio_region_init(vga, &vpci_dev->modern_bar,
+                                 vvga->vga_mrs, true);
+
+    vga->con = g->scanout[0].con;
+    graphic_console_set_hwops(vga->con, &virtio_vga_ops, vvga);
+}
+
+static void virtio_vga_reset(DeviceState *dev)
+{
+    VirtIOVGA *vvga = VIRTIO_VGA(dev);
+    vvga->vdev.enable = 0;
+
+    vga_dirty_log_start(&vvga->vga);
+}
+
+static Property virtio_vga_properties[] = {
+    DEFINE_VIRTIO_GPU_PROPERTIES(VirtIOVGA, vdev.conf),
+    DEFINE_VIRTIO_GPU_PCI_PROPERTIES(VirtIOPCIProxy),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static void virtio_vga_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass);
+    PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass);
+
+    set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
+    dc->props = virtio_vga_properties;
+    dc->reset = virtio_vga_reset;
+    dc->hotpluggable = false;
+
+    k->realize = virtio_vga_realize;
+    pcidev_k->romfile = "vgabios-virtio.bin";
+    pcidev_k->class_id = PCI_CLASS_DISPLAY_VGA;
+}
+
+static void virtio_vga_inst_initfn(Object *obj)
+{
+    VirtIOVGA *dev = VIRTIO_VGA(obj);
+    object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_GPU);
+    object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+}
+
+static TypeInfo virtio_vga_info = {
+    .name          = TYPE_VIRTIO_VGA,
+    .parent        = TYPE_VIRTIO_PCI,
+    .instance_size = sizeof(struct VirtIOVGA),
+    .instance_init = virtio_vga_inst_initfn,
+    .class_init    = virtio_vga_class_init,
+};
+
+static void virtio_vga_register_types(void)
+{
+    type_register_static(&virtio_vga_info);
+}
+
+type_init(virtio_vga_register_types)
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 4/5] virtio-vga: add '-vga virtio' support
  2015-06-16  7:57 [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2015-06-16  7:57 ` [Qemu-devel] [PULL 3/5] virtio-vga: add virtio gpu device with vga compatibility Gerd Hoffmann
@ 2015-06-16  7:57 ` Gerd Hoffmann
  2015-06-16  7:57 ` [Qemu-devel] [PULL 5/5] virtio-vga: add vgabios configuration Gerd Hoffmann
  2015-06-16 11:00 ` [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga Peter Maydell
  5 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2015-06-16  7:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Dave Airlie, Paolo Bonzini, Gerd Hoffmann, Michael S. Tsirkin

Some convinience fluff:  Add support for '-vga virtio', also add
virtio-vga to the list of vga cards so '-device virtio-vga' will
turn off the default vga.

Written by Dave Airlie and Gerd Hoffmann.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/isa/isa-bus.c        |  3 +++
 hw/pci/pci.c            |  2 ++
 include/sysemu/sysemu.h |  2 +-
 qemu-options.hx         |  4 +++-
 vl.c                    | 13 +++++++++++++
 5 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c
index ec8e7de..43e0cd8 100644
--- a/hw/isa/isa-bus.c
+++ b/hw/isa/isa-bus.c
@@ -179,6 +179,9 @@ ISADevice *isa_vga_init(ISABus *bus)
     case VGA_VMWARE:
         fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __func__);
         return NULL;
+    case VGA_VIRTIO:
+        fprintf(stderr, "%s: virtio-vga: no PCI bus\n", __func__);
+        return NULL;
     case VGA_NONE:
     default:
         return NULL;
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 750f3da..2158043 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1698,6 +1698,8 @@ PCIDevice *pci_vga_init(PCIBus *bus)
         return pci_create_simple(bus, -1, "VGA");
     case VGA_VMWARE:
         return pci_create_simple(bus, -1, "vmware-svga");
+    case VGA_VIRTIO:
+        return pci_create_simple(bus, -1, "virtio-vga");
     case VGA_NONE:
     default: /* Other non-PCI types. Checking for unsupported types is already
                 done in vl.c. */
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 853d90a..7beb926 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -104,7 +104,7 @@ extern int autostart;
 
 typedef enum {
     VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
-    VGA_TCX, VGA_CG3, VGA_DEVICE
+    VGA_TCX, VGA_CG3, VGA_DEVICE, VGA_VIRTIO,
 } VGAInterfaceType;
 
 extern int vga_interface_type;
diff --git a/qemu-options.hx b/qemu-options.hx
index 1d281f6..c6221d4 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1103,7 +1103,7 @@ Rotate graphical output some deg left (only PXA LCD).
 ETEXI
 
 DEF("vga", HAS_ARG, QEMU_OPTION_vga,
-    "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|none]\n"
+    "-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]\n"
     "                select video card type\n", QEMU_ARCH_ALL)
 STEXI
 @item -vga @var{type}
@@ -1136,6 +1136,8 @@ fixed resolution of 1024x768.
 (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit framebuffer
 for sun4m machines available in both 1024x768 (OpenBIOS) and 1152x900 (OBP)
 resolutions aimed at people wishing to run older Solaris versions.
+@item virtio
+Virtio VGA card.
 @item none
 Disable VGA card.
 @end table
diff --git a/vl.c b/vl.c
index 9542095..2201e27 100644
--- a/vl.c
+++ b/vl.c
@@ -231,6 +231,7 @@ static struct {
     { .driver = "isa-cirrus-vga",       .flag = &default_vga       },
     { .driver = "vmware-svga",          .flag = &default_vga       },
     { .driver = "qxl-vga",              .flag = &default_vga       },
+    { .driver = "virtio-vga",           .flag = &default_vga       },
 };
 
 static QemuOptsList qemu_rtc_opts = {
@@ -1884,6 +1885,11 @@ static bool cg3_vga_available(void)
     return object_class_by_name("cgthree");
 }
 
+static bool virtio_vga_available(void)
+{
+    return object_class_by_name("virtio-vga");
+}
+
 static void select_vgahw (const char *p)
 {
     const char *opts;
@@ -1910,6 +1916,13 @@ static void select_vgahw (const char *p)
             fprintf(stderr, "Error: VMWare SVGA not available\n");
             exit(0);
         }
+    } else if (strstart(p, "virtio", &opts)) {
+        if (virtio_vga_available()) {
+            vga_interface_type = VGA_VIRTIO;
+        } else {
+            fprintf(stderr, "Error: Virtio VGA not available\n");
+            exit(0);
+        }
     } else if (strstart(p, "xenfb", &opts)) {
         vga_interface_type = VGA_XENFB;
     } else if (strstart(p, "qxl", &opts)) {
-- 
1.8.3.1

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

* [Qemu-devel] [PULL 5/5] virtio-vga: add vgabios configuration
  2015-06-16  7:57 [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2015-06-16  7:57 ` [Qemu-devel] [PULL 4/5] virtio-vga: add '-vga virtio' support Gerd Hoffmann
@ 2015-06-16  7:57 ` Gerd Hoffmann
  2015-06-16 11:00 ` [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga Peter Maydell
  5 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2015-06-16  7:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Add seavgabios configuration for virtio-vga,
hook up the new vgabios in the makefiles.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 Makefile               | 2 +-
 roms/Makefile          | 2 +-
 roms/config.vga-virtio | 6 ++++++
 3 files changed, 8 insertions(+), 2 deletions(-)
 create mode 100644 roms/config.vga-virtio

diff --git a/Makefile b/Makefile
index 2d52536..3f97904 100644
--- a/Makefile
+++ b/Makefile
@@ -342,7 +342,7 @@ bepo    cz
 
 ifdef INSTALL_BLOBS
 BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
-vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin \
+vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
 acpi-dsdt.aml q35-acpi-dsdt.aml \
 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
 pxe-e1000.rom pxe-eepro100.rom pxe-ne2k_pci.rom \
diff --git a/roms/Makefile b/roms/Makefile
index 610b534..c76cd5b 100644
--- a/roms/Makefile
+++ b/roms/Makefile
@@ -1,5 +1,5 @@
 
-vgabios_variants := stdvga cirrus vmware qxl isavga
+vgabios_variants := stdvga cirrus vmware qxl isavga virtio
 vgabios_targets  := $(subst -isavga,,$(patsubst %,vgabios-%.bin,$(vgabios_variants)))
 pxerom_variants  := e1000 eepro100 ne2k_pci pcnet rtl8139 virtio
 pxerom_targets   := 8086100e 80861209 10500940 10222000 10ec8139 1af41000
diff --git a/roms/config.vga-virtio b/roms/config.vga-virtio
new file mode 100644
index 0000000..aa7a15b
--- /dev/null
+++ b/roms/config.vga-virtio
@@ -0,0 +1,6 @@
+CONFIG_BUILD_VGABIOS=y
+CONFIG_VGA_BOCHS=y
+CONFIG_VGA_PCI=y
+CONFIG_OVERRIDE_PCI_ID=y
+CONFIG_VGA_VID=0x1af4
+CONFIG_VGA_DID=0x1050
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga
  2015-06-16  7:57 [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2015-06-16  7:57 ` [Qemu-devel] [PULL 5/5] virtio-vga: add vgabios configuration Gerd Hoffmann
@ 2015-06-16 11:00 ` Peter Maydell
  2015-06-16 15:16   ` Dr. David Alan Gilbert
  5 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2015-06-16 11:00 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 16 June 2015 at 08:57, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
> This pull request almost completes virtio-gpu support, by adding pci
> support (virtio-gpu-pci) and a variant with vga compatibility
> (virtio-vga).  The remaining missing bit is the vgabios for virtio-vga,
> which will come with the seabios update later this week.
>
> please pull,
>   Gerd
>
> The following changes since commit d8e3b729cf452d2689c8669f1ec18158db29fd5a:
>
>   Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2015-06-11 15:33:38 +0100)
>
> are available in the git repository at:
>
>
>   git://git.kraxel.org/qemu tags/pull-vga-20150615-1
>
> for you to fetch changes up to 7a4dfd1e4a741991df1acf31672b391648e0aa0c:
>
>   virtio-vga: add vgabios configuration (2015-06-12 10:13:23 +0200)
>
> ----------------------------------------------------------------
> virtio-gpu: pci support bits and virtio-vga.
>
> ----------------------------------------------------------------
> Gerd Hoffmann (5):
>       virtio-gpu: fix error message
>       virtio-gpu-pci: add virtio pci support
>       virtio-vga: add virtio gpu device with vga compatibility
>       virtio-vga: add '-vga virtio' support
>       virtio-vga: add vgabios configuration
>

Applied, thanks.

-- PMM

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

* Re: [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga
  2015-06-16 11:00 ` [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga Peter Maydell
@ 2015-06-16 15:16   ` Dr. David Alan Gilbert
  2015-06-17  6:42     ` Gerd Hoffmann
  0 siblings, 1 reply; 9+ messages in thread
From: Dr. David Alan Gilbert @ 2015-06-16 15:16 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Gerd Hoffmann, QEMU Developers

* Peter Maydell (peter.maydell@linaro.org) wrote:
> On 16 June 2015 at 08:57, Gerd Hoffmann <kraxel@redhat.com> wrote:
> >   Hi,
> >
> > This pull request almost completes virtio-gpu support, by adding pci
> > support (virtio-gpu-pci) and a variant with vga compatibility
> > (virtio-vga).  The remaining missing bit is the vgabios for virtio-vga,
> > which will come with the seabios update later this week.

I'm hitting:
install: cannot stat ‘/home/dgilbert/git/qemu-world3/pc-bios/vgabios-virtio.bin’: No such file or directory

on a make install even after a reconfigure and make clean.

Dave

> >
> > please pull,
> >   Gerd
> >
> > The following changes since commit d8e3b729cf452d2689c8669f1ec18158db29fd5a:
> >
> >   Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2015-06-11 15:33:38 +0100)
> >
> > are available in the git repository at:
> >
> >
> >   git://git.kraxel.org/qemu tags/pull-vga-20150615-1
> >
> > for you to fetch changes up to 7a4dfd1e4a741991df1acf31672b391648e0aa0c:
> >
> >   virtio-vga: add vgabios configuration (2015-06-12 10:13:23 +0200)
> >
> > ----------------------------------------------------------------
> > virtio-gpu: pci support bits and virtio-vga.
> >
> > ----------------------------------------------------------------
> > Gerd Hoffmann (5):
> >       virtio-gpu: fix error message
> >       virtio-gpu-pci: add virtio pci support
> >       virtio-vga: add virtio gpu device with vga compatibility
> >       virtio-vga: add '-vga virtio' support
> >       virtio-vga: add vgabios configuration
> >
> 
> Applied, thanks.
> 
> -- PMM
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga
  2015-06-16 15:16   ` Dr. David Alan Gilbert
@ 2015-06-17  6:42     ` Gerd Hoffmann
  0 siblings, 0 replies; 9+ messages in thread
From: Gerd Hoffmann @ 2015-06-17  6:42 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: Peter Maydell, QEMU Developers

On Di, 2015-06-16 at 16:16 +0100, Dr. David Alan Gilbert wrote:
> * Peter Maydell (peter.maydell@linaro.org) wrote:
> > On 16 June 2015 at 08:57, Gerd Hoffmann <kraxel@redhat.com> wrote:
> > >   Hi,
> > >
> > > This pull request almost completes virtio-gpu support, by adding pci
> > > support (virtio-gpu-pci) and a variant with vga compatibility
> > > (virtio-vga).  The remaining missing bit is the vgabios for virtio-vga,
> > > which will come with the seabios update later this week.
> 
> I'm hitting:
> install: cannot stat ‘/home/dgilbert/git/qemu-world3/pc-bios/vgabios-virtio.bin’: No such file or directory

Oops.  Try "touch pc-bios/vgabios-virtio.bin" as workaround.

I'm busy doing the seabios 1.8.2 release right now, the pull request
bringing the seabios update and the real virtio vgabios (and fixing this
one as side effect) should be only hours away.

cheers,
  Gerd

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

end of thread, other threads:[~2015-06-17  6:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-16  7:57 [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga Gerd Hoffmann
2015-06-16  7:57 ` [Qemu-devel] [PULL 1/5] virtio-gpu: fix error message Gerd Hoffmann
2015-06-16  7:57 ` [Qemu-devel] [PULL 2/5] virtio-gpu-pci: add virtio pci support Gerd Hoffmann
2015-06-16  7:57 ` [Qemu-devel] [PULL 3/5] virtio-vga: add virtio gpu device with vga compatibility Gerd Hoffmann
2015-06-16  7:57 ` [Qemu-devel] [PULL 4/5] virtio-vga: add '-vga virtio' support Gerd Hoffmann
2015-06-16  7:57 ` [Qemu-devel] [PULL 5/5] virtio-vga: add vgabios configuration Gerd Hoffmann
2015-06-16 11:00 ` [Qemu-devel] [PULL 0/5] virtio-gpu: pci support bits and virtio-vga Peter Maydell
2015-06-16 15:16   ` Dr. David Alan Gilbert
2015-06-17  6:42     ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.