summary refs log tree commit diff stats
path: root/hw/virtio-pci.c
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2009-07-07 12:09:10 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-07-16 08:28:10 -0500
commit5c634ef30d75fd7024929b34d383eea1bae732d7 (patch)
tree8d630026b5d07234c13698581e72b46b046762e4 /hw/virtio-pci.c
parent6f6260c7d68fffe349fbe134b1ef2cebb5bb5a1e (diff)
downloadfocaccia-qemu-5c634ef30d75fd7024929b34d383eea1bae732d7.tar.gz
focaccia-qemu-5c634ef30d75fd7024929b34d383eea1bae732d7.zip
Change default PCI class of virtio-blk to PCI_CLASS_STORAGE_SCSI
Windows virtio driver cannot pass DTM (certification) tests while the
storage class is PCI_CLASS_STORAGE_UNKNOWN.

A new qdev type is introduced to allow devices using the old class
to be created for compatibility with qemu-0.10.x.

Reported-by: Dor Laor <dlaor@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-pci.c')
-rw-r--r--hw/virtio-pci.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 3b9bfd1756..6052c1671c 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -426,7 +426,8 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
     virtio_bind_device(vdev, &virtio_pci_bindings, proxy);
 }
 
-static void virtio_blk_init_pci(PCIDevice *pci_dev)
+static void virtio_blk_init_pci_with_class(PCIDevice *pci_dev,
+                                           uint16_t class_code)
 {
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
     VirtIODevice *vdev;
@@ -435,8 +436,17 @@ static void virtio_blk_init_pci(PCIDevice *pci_dev)
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
                     PCI_DEVICE_ID_VIRTIO_BLOCK,
-                    PCI_CLASS_STORAGE_OTHER,
-                    0x00);
+                    class_code, 0x00);
+}
+
+static void virtio_blk_init_pci(PCIDevice *pci_dev)
+{
+    virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_SCSI);
+}
+
+static void virtio_blk_init_pci_0_10(PCIDevice *pci_dev)
+{
+    virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_OTHER);
 }
 
 static void virtio_console_init_pci(PCIDevice *pci_dev)
@@ -496,6 +506,11 @@ static PCIDeviceInfo virtio_info[] = {
         .qdev.size = sizeof(VirtIOPCIProxy),
         .init      = virtio_balloon_init_pci,
     },{
+        /* For compatibility with 0.10 */
+        .qdev.name = "virtio-blk-pci-0-10",
+        .qdev.size = sizeof(VirtIOPCIProxy),
+        .init      = virtio_blk_init_pci_0_10,
+    },{
         /* end of list */
     }
 };