qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 4/6] qdev/compat: virtio-blk-pci 0.10 compatibility.


From: Gerd Hoffmann
Subject: [Qemu-devel] [PATCH 4/6] qdev/compat: virtio-blk-pci 0.10 compatibility.
Date: Mon, 13 Jul 2009 17:30:03 +0200

Signed-off-by: Gerd Hoffmann <address@hidden>
---
 hw/pc.c         |    5 +++++
 hw/virtio-pci.c |   16 ++++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/hw/pc.c b/hw/pc.c
index 6ba6b25..a4000dd 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1463,6 +1463,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 0671967..41ba574 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 */
@@ -425,12 +426,15 @@ static void virtio_blk_init_pci(PCIDevice *pci_dev)
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
     VirtIODevice *vdev;
 
+    if (proxy->class_code != PCI_CLASS_STORAGE_SCSI &&
+        proxy->class_code != PCI_CLASS_STORAGE_OTHER)
+        proxy->class_code = PCI_CLASS_STORAGE_SCSI;
+
     vdev = virtio_blk_init(&pci_dev->qdev);
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,
                     PCI_DEVICE_ID_VIRTIO_BLOCK,
-                    PCI_CLASS_STORAGE_OTHER,
-                    0x00);
+                    proxy->class_code, 0x00);
 }
 
 static void virtio_console_init_pci(PCIDevice *pci_dev)
@@ -477,6 +481,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),
-- 
1.6.2.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]