Commit d6beee993810b80d7a7f51d05d4f8e08e485b2b2

Authored by Gerd Hoffmann
Committed by Anthony Liguori
1 parent eb54b6dc

qdev/compat: virtio-console-pci 0.10 compatibility.

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 <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 2 changed files with 20 additions and 1 deletions
... ... @@ -1529,6 +1529,10 @@ static QEMUMachine pc_machine_v0_10 = {
1529 1529 .driver = "virtio-blk-pci",
1530 1530 .property = "class",
1531 1531 .value = stringify(PCI_CLASS_STORAGE_OTHER),
  1532 + },{
  1533 + .driver = "virtio-console-pci",
  1534 + .property = "class",
  1535 + .value = stringify(PCI_CLASS_DISPLAY_OTHER),
1532 1536 },
1533 1537 { /* end of list */ }
1534 1538 },
... ...
hw/virtio-pci.c
... ... @@ -465,7 +465,14 @@ static void virtio_console_init_pci_with_class(PCIDevice *pci_dev,
465 465  
466 466 static void virtio_console_init_pci(PCIDevice *pci_dev)
467 467 {
468   - virtio_console_init_pci_with_class(pci_dev, PCI_CLASS_SERIAL_OTHER);
  468 + VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
  469 +
  470 + if (proxy->class_code != PCI_CLASS_COMMUNICATION_OTHER &&
  471 + proxy->class_code != PCI_CLASS_DISPLAY_OTHER && /* qemu 0.10 */
  472 + proxy->class_code != PCI_CLASS_OTHERS) /* qemu-kvm */
  473 + proxy->class_code = PCI_CLASS_COMMUNICATION_OTHER;
  474 +
  475 + virtio_console_init_pci_with_class(pci_dev, proxy->class_code);
469 476 }
470 477  
471 478 static void virtio_console_init_pci_0_10(PCIDevice *pci_dev)
... ... @@ -520,6 +527,14 @@ static PCIDeviceInfo virtio_info[] = {
520 527 .qdev.name = "virtio-console-pci",
521 528 .qdev.size = sizeof(VirtIOPCIProxy),
522 529 .init = virtio_console_init_pci,
  530 + .qdev.props = (Property[]) {
  531 + {
  532 + .name = "class",
  533 + .info = &qdev_prop_hex32,
  534 + .offset = offsetof(VirtIOPCIProxy, class_code),
  535 + },
  536 + {/* end of list */}
  537 + },
523 538 },{
524 539 .qdev.name = "virtio-balloon-pci",
525 540 .qdev.size = sizeof(VirtIOPCIProxy),
... ...