diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-07-15 13:48:23 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-07-16 17:28:53 -0500 |
commit | ab73ff29ceb785aad3fc182e09d702ccee2e5559 (patch) | |
tree | 01f545a42c90f4ada8e5f7fb3e1820d0780ac298 /hw | |
parent | ccb63de38e63bd8cdcd3db7aeaebc8a34a02ded8 (diff) |
qdev/compat: virtio-blk-pci 0.10 compatibility.
Add class property to virtio-blk-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>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/pc.c | 5 | ||||
-rw-r--r-- | hw/virtio-pci.c | 17 |
2 files changed, 21 insertions, 1 deletions
@@ -1525,6 +1525,11 @@ static QEMUMachine pc_machine_v0_10 = { .init = pc_init_pci, .max_cpus = 255, .compat_props = (CompatProperty[]) { + { + .driver = "virtio-blk-pci", + .property = "class", + .value = stringify(PCI_CLASS_STORAGE_OTHER), + }, { /* end of list */ } }, }; diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 0f676b877..b135fcc0f 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -86,6 +86,7 @@ typedef struct { PCIDevice pci_dev; VirtIODevice *vdev; uint32_t addr; + uint32_t class_code; } VirtIOPCIProxy; /* virtio device */ @@ -435,7 +436,13 @@ static void virtio_blk_init_pci_with_class(PCIDevice *pci_dev, static void virtio_blk_init_pci(PCIDevice *pci_dev) { - virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_SCSI); + VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); + + if (proxy->class_code != PCI_CLASS_STORAGE_SCSI && + proxy->class_code != PCI_CLASS_STORAGE_OTHER) + proxy->class_code = PCI_CLASS_STORAGE_SCSI; + + virtio_blk_init_pci_with_class(pci_dev, proxy->class_code); } static void virtio_blk_init_pci_0_10(PCIDevice *pci_dev) @@ -497,6 +504,14 @@ static PCIDeviceInfo virtio_info[] = { .qdev.name = "virtio-blk-pci", .qdev.size = sizeof(VirtIOPCIProxy), .init = virtio_blk_init_pci, + .qdev.props = (Property[]) { + { + .name = "class", + .info = &qdev_prop_hex32, + .offset = offsetof(VirtIOPCIProxy, class_code), + }, + {/* end of list */} + }, },{ .qdev.name = "virtio-net-pci", .qdev.size = sizeof(VirtIOPCIProxy), |