From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MOtGu-0002Bt-Bm for qemu-devel@nongnu.org; Thu, 09 Jul 2009 09:02:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MOtGq-00028z-MY for qemu-devel@nongnu.org; Thu, 09 Jul 2009 09:02:43 -0400 Received: from [199.232.76.173] (port=42388 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOtGp-00028o-Cs for qemu-devel@nongnu.org; Thu, 09 Jul 2009 09:02:39 -0400 Received: from mx2.redhat.com ([66.187.237.31]:54503) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MOtGo-0002Cp-Io for qemu-devel@nongnu.org; Thu, 09 Jul 2009 09:02:38 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n69D2cVo016256 for ; Thu, 9 Jul 2009 09:02:38 -0400 From: Gerd Hoffmann Date: Thu, 9 Jul 2009 15:02:31 +0200 Message-Id: <1247144553-8951-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1247144553-8951-1-git-send-email-kraxel@redhat.com> References: <1247144553-8951-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 3/5] qdev/compat: virtio-blk-pci 0.10 compatibility. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- hw/pc.c | 5 +++++ hw/virtio-pci.c | 22 ++++++++++++++-------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 6ba6b25..0574283 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 = "0x0180", /* PCI_CLASS_STORAGE_OTHER */ + }, { /* end of list */ } }, }; diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 0b3f41f..3727b0d 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -86,12 +86,7 @@ typedef struct { PCIDevice pci_dev; VirtIODevice *vdev; uint32_t addr; - - uint16_t vendor; - uint16_t device; - uint16_t subvendor; - uint16_t class_code; - uint8_t pif; + uint32_t class_code; } VirtIOPCIProxy; /* virtio device */ @@ -419,12 +414,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) @@ -471,6 +469,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.alias = "virtio", -- 1.6.2.5