Преглед на файлове

virtio-vga: add '-vga virtio' support

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>
Gerd Hoffmann преди 11 години
родител
ревизия
a94f0c5ca2
променени са 5 файла, в които са добавени 22 реда и са изтрити 2 реда
  1. 3 0
      hw/isa/isa-bus.c
  2. 2 0
      hw/pci/pci.c
  3. 1 1
      include/sysemu/sysemu.h
  4. 3 1
      qemu-options.hx
  5. 13 0
      vl.c

+ 3 - 0
hw/isa/isa-bus.c

@@ -179,6 +179,9 @@ ISADevice *isa_vga_init(ISABus *bus)
     case VGA_VMWARE:
     case VGA_VMWARE:
         fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __func__);
         fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __func__);
         return NULL;
         return NULL;
+    case VGA_VIRTIO:
+        fprintf(stderr, "%s: virtio-vga: no PCI bus\n", __func__);
+        return NULL;
     case VGA_NONE:
     case VGA_NONE:
     default:
     default:
         return NULL;
         return NULL;

+ 2 - 0
hw/pci/pci.c

@@ -1698,6 +1698,8 @@ PCIDevice *pci_vga_init(PCIBus *bus)
         return pci_create_simple(bus, -1, "VGA");
         return pci_create_simple(bus, -1, "VGA");
     case VGA_VMWARE:
     case VGA_VMWARE:
         return pci_create_simple(bus, -1, "vmware-svga");
         return pci_create_simple(bus, -1, "vmware-svga");
+    case VGA_VIRTIO:
+        return pci_create_simple(bus, -1, "virtio-vga");
     case VGA_NONE:
     case VGA_NONE:
     default: /* Other non-PCI types. Checking for unsupported types is already
     default: /* Other non-PCI types. Checking for unsupported types is already
                 done in vl.c. */
                 done in vl.c. */

+ 1 - 1
include/sysemu/sysemu.h

@@ -104,7 +104,7 @@ extern int autostart;
 
 
 typedef enum {
 typedef enum {
     VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_QXL,
     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;
 } VGAInterfaceType;
 
 
 extern int vga_interface_type;
 extern int vga_interface_type;

+ 3 - 1
qemu-options.hx

@@ -1103,7 +1103,7 @@ Rotate graphical output some deg left (only PXA LCD).
 ETEXI
 ETEXI
 
 
 DEF("vga", HAS_ARG, QEMU_OPTION_vga,
 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)
     "                select video card type\n", QEMU_ARCH_ALL)
 STEXI
 STEXI
 @item -vga @var{type}
 @item -vga @var{type}
@@ -1136,6 +1136,8 @@ fixed resolution of 1024x768.
 (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit framebuffer
 (sun4m only) Sun cgthree framebuffer. This is a simple 8-bit framebuffer
 for sun4m machines available in both 1024x768 (OpenBIOS) and 1152x900 (OBP)
 for sun4m machines available in both 1024x768 (OpenBIOS) and 1152x900 (OBP)
 resolutions aimed at people wishing to run older Solaris versions.
 resolutions aimed at people wishing to run older Solaris versions.
+@item virtio
+Virtio VGA card.
 @item none
 @item none
 Disable VGA card.
 Disable VGA card.
 @end table
 @end table

+ 13 - 0
vl.c

@@ -231,6 +231,7 @@ static struct {
     { .driver = "isa-cirrus-vga",       .flag = &default_vga       },
     { .driver = "isa-cirrus-vga",       .flag = &default_vga       },
     { .driver = "vmware-svga",          .flag = &default_vga       },
     { .driver = "vmware-svga",          .flag = &default_vga       },
     { .driver = "qxl-vga",              .flag = &default_vga       },
     { .driver = "qxl-vga",              .flag = &default_vga       },
+    { .driver = "virtio-vga",           .flag = &default_vga       },
 };
 };
 
 
 static QemuOptsList qemu_rtc_opts = {
 static QemuOptsList qemu_rtc_opts = {
@@ -1884,6 +1885,11 @@ static bool cg3_vga_available(void)
     return object_class_by_name("cgthree");
     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)
 static void select_vgahw (const char *p)
 {
 {
     const char *opts;
     const char *opts;
@@ -1910,6 +1916,13 @@ static void select_vgahw (const char *p)
             fprintf(stderr, "Error: VMWare SVGA not available\n");
             fprintf(stderr, "Error: VMWare SVGA not available\n");
             exit(0);
             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)) {
     } else if (strstart(p, "xenfb", &opts)) {
         vga_interface_type = VGA_XENFB;
         vga_interface_type = VGA_XENFB;
     } else if (strstart(p, "qxl", &opts)) {
     } else if (strstart(p, "qxl", &opts)) {