Commit 5c634ef30d75fd7024929b34d383eea1bae732d7
Committed by
Anthony Liguori
1 parent
6f6260c7
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>
Showing
1 changed file
with
18 additions
and
3 deletions
hw/virtio-pci.c
| ... | ... | @@ -426,7 +426,8 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev, |
| 426 | 426 | virtio_bind_device(vdev, &virtio_pci_bindings, proxy); |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | -static void virtio_blk_init_pci(PCIDevice *pci_dev) | |
| 429 | +static void virtio_blk_init_pci_with_class(PCIDevice *pci_dev, | |
| 430 | + uint16_t class_code) | |
| 430 | 431 | { |
| 431 | 432 | VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); |
| 432 | 433 | VirtIODevice *vdev; |
| ... | ... | @@ -435,8 +436,17 @@ static void virtio_blk_init_pci(PCIDevice *pci_dev) |
| 435 | 436 | virtio_init_pci(proxy, vdev, |
| 436 | 437 | PCI_VENDOR_ID_REDHAT_QUMRANET, |
| 437 | 438 | PCI_DEVICE_ID_VIRTIO_BLOCK, |
| 438 | - PCI_CLASS_STORAGE_OTHER, | |
| 439 | - 0x00); | |
| 439 | + class_code, 0x00); | |
| 440 | +} | |
| 441 | + | |
| 442 | +static void virtio_blk_init_pci(PCIDevice *pci_dev) | |
| 443 | +{ | |
| 444 | + virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_SCSI); | |
| 445 | +} | |
| 446 | + | |
| 447 | +static void virtio_blk_init_pci_0_10(PCIDevice *pci_dev) | |
| 448 | +{ | |
| 449 | + virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_OTHER); | |
| 440 | 450 | } |
| 441 | 451 | |
| 442 | 452 | static void virtio_console_init_pci(PCIDevice *pci_dev) |
| ... | ... | @@ -496,6 +506,11 @@ static PCIDeviceInfo virtio_info[] = { |
| 496 | 506 | .qdev.size = sizeof(VirtIOPCIProxy), |
| 497 | 507 | .init = virtio_balloon_init_pci, |
| 498 | 508 | },{ |
| 509 | + /* For compatibility with 0.10 */ | |
| 510 | + .qdev.name = "virtio-blk-pci-0-10", | |
| 511 | + .qdev.size = sizeof(VirtIOPCIProxy), | |
| 512 | + .init = virtio_blk_init_pci_0_10, | |
| 513 | + },{ | |
| 499 | 514 | /* end of list */ |
| 500 | 515 | } |
| 501 | 516 | }; | ... | ... |