@@ -1190,6 +1190,11 @@ static void pc_init1(ram_addr_t ram_size,
} else {
isa_vga_init();
}
+ } else if (virtio_fb_enabled) {
+ if (pci_enabled)
+ pci_create_simple(pci_bus, -1, "virtio-fb-pci");
+ else
+ fprintf(stderr, "%s: virtio_fb: no PCI bus\n", __FUNCTION__);
}
rtc_state = rtc_init(2000);
@@ -70,6 +70,7 @@ extern target_phys_addr_t pci_mem_base;
#define PCI_DEVICE_ID_VIRTIO_BLOCK 0x1001
#define PCI_DEVICE_ID_VIRTIO_BALLOON 0x1002
#define PCI_DEVICE_ID_VIRTIO_CONSOLE 0x1003
+#define PCI_DEVICE_ID_VIRTIO_FB 0x1004
typedef void PCIConfigWriteFunc(PCIDevice *pci_dev,
uint32_t address, uint32_t data, int len);
@@ -490,6 +490,25 @@ static int virtio_console_init_pci(PCIDevice *pci_dev)
return 0;
}
+static int virtio_fb_init_pci(PCIDevice *pci_dev)
+{
+ VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
+ VirtIODevice *vdev;
+
+ if (proxy->class_code != PCI_CLASS_DISPLAY_OTHER)
+ proxy->class_code = PCI_CLASS_DISPLAY_OTHER;
+
+ vdev = virtio_fb_init(&pci_dev->qdev);
+ if (!vdev) {
+ return -1;
+ }
+ virtio_init_pci(proxy, vdev,
+ PCI_VENDOR_ID_REDHAT_QUMRANET,
+ PCI_DEVICE_ID_VIRTIO_FB,
+ proxy->class_code, 0x00);
+ return 0;
+}
+
static int virtio_net_init_pci(PCIDevice *pci_dev)
{
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
@@ -574,6 +593,16 @@ static PCIDeviceInfo virtio_info[] = {
},
.qdev.reset = virtio_pci_reset,
},{
+ .qdev.name = "virtio-fb-pci",
+ .qdev.size = sizeof(VirtIOPCIProxy),
+ .init = virtio_fb_init_pci,
+ .exit = virtio_exit_pci,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_HEX32("class", VirtIOPCIProxy, class_code, 0),
+ DEFINE_PROP_END_OF_LIST(),
+ },
+ .qdev.reset = virtio_pci_reset,
+ },{
.qdev.name = "virtio-balloon-pci",
.qdev.size = sizeof(VirtIOPCIProxy),
.init = virtio_balloon_init_pci,
@@ -104,13 +104,14 @@ extern int autostart;
extern int bios_size;
typedef enum {
- VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB
+ VGA_NONE, VGA_STD, VGA_CIRRUS, VGA_VMWARE, VGA_XENFB, VGA_VIRTIO
} VGAInterfaceType;
extern int vga_interface_type;
#define cirrus_vga_enabled (vga_interface_type == VGA_CIRRUS)
#define std_vga_enabled (vga_interface_type == VGA_STD)
#define xenfb_enabled (vga_interface_type == VGA_XENFB)
+#define virtio_fb_enabled (vga_interface_type == VGA_VIRTIO)
#define vmsvga_enabled (vga_interface_type == VGA_VMWARE)
extern int graphic_width;
@@ -4297,6 +4297,8 @@ static void select_vgahw (const char *p)
vga_interface_type = VGA_VMWARE;
} else if (strstart(p, "xenfb", &opts)) {
vga_interface_type = VGA_XENFB;
+ } else if (strstart(p, "virtio", &opts)) {
+ vga_interface_type = VGA_VIRTIO;
} else if (!strstart(p, "none", &opts)) {
invalid_vga:
fprintf(stderr, "Unknown vga type: %s\n", p);