qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [COMMIT d6beee9] qdev/compat: virtio-console-pci 0.10 co


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT d6beee9] qdev/compat: virtio-console-pci 0.10 compatibility.
Date: Thu, 16 Jul 2009 23:12:51 -0000

From: Gerd Hoffmann <address@hidden>

Add class property to virtio-console-pci allowing to specify the PCI class.
Add compat property to pc-0.10 to set the old PCI class.

Signed-off-by: Gerd Hoffmann <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>

diff --git a/hw/pc.c b/hw/pc.c
index ba1f3d5..8a1582c 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1529,6 +1529,10 @@ static QEMUMachine pc_machine_v0_10 = {
             .driver   = "virtio-blk-pci",
             .property = "class",
             .value    = stringify(PCI_CLASS_STORAGE_OTHER),
+        },{
+            .driver   = "virtio-console-pci",
+            .property = "class",
+            .value    = stringify(PCI_CLASS_DISPLAY_OTHER),
         },
         { /* end of list */ }
     },
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index b135fcc..1afc425 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -465,7 +465,14 @@ static void virtio_console_init_pci_with_class(PCIDevice 
*pci_dev,
 
 static void virtio_console_init_pci(PCIDevice *pci_dev)
 {
-    virtio_console_init_pci_with_class(pci_dev, PCI_CLASS_SERIAL_OTHER);
+    VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
+  
+    if (proxy->class_code != PCI_CLASS_COMMUNICATION_OTHER &&
+        proxy->class_code != PCI_CLASS_DISPLAY_OTHER && /* qemu 0.10 */
+        proxy->class_code != PCI_CLASS_OTHERS)          /* qemu-kvm  */
+        proxy->class_code = PCI_CLASS_COMMUNICATION_OTHER;
+
+    virtio_console_init_pci_with_class(pci_dev, proxy->class_code);
 }
 
 static void virtio_console_init_pci_0_10(PCIDevice *pci_dev)
@@ -520,6 +527,14 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.name = "virtio-console-pci",
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_console_init_pci,
+        .qdev.props = (Property[]) {
+            {
+                .name   = "class",
+                .info   = &qdev_prop_hex32,
+                .offset = offsetof(VirtIOPCIProxy, class_code),
+            },
+            {/* end of list */}
+        },
     },{
         .qdev.name = "virtio-balloon-pci",
         .qdev.size = sizeof(VirtIOPCIProxy),




reply via email to

[Prev in Thread] Current Thread [Next in Thread]