Commit 5c634ef3 authored by Mark McLoughlin's avatar Mark McLoughlin Committed by Anthony Liguori
Browse files

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: default avatarDor Laor <dlaor@redhat.com>
Signed-off-by: default avatarMark McLoughlin <markmc@redhat.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent 6f6260c7
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -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)
@@ -495,6 +505,11 @@ static PCIDeviceInfo virtio_info[] = {
        .qdev.name = "virtio-balloon-pci",
        .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 */
    }