From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MO8YL-0002wf-EZ for qemu-devel@nongnu.org; Tue, 07 Jul 2009 07:09:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MO8YG-0002p6-KR for qemu-devel@nongnu.org; Tue, 07 Jul 2009 07:09:36 -0400 Received: from [199.232.76.173] (port=33168 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MO8YG-0002oy-GB for qemu-devel@nongnu.org; Tue, 07 Jul 2009 07:09:32 -0400 Received: from mx2.redhat.com ([66.187.237.31]:43682) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MO8YF-0006Nz-Vs for qemu-devel@nongnu.org; Tue, 07 Jul 2009 07:09:32 -0400 From: Mark McLoughlin In-Reply-To: <1246964898.2836.38.camel@blaa> References: <1244821292.30522.56.camel@blaa> <4A327E4A.7010300@codemonkey.ws> <1244825303.26769.19.camel@blaa> <20090614095016.GA7560@redhat.com> <1245056916.6891.31.camel@blaa> <4A3613EC.6030608@redhat.com> <20090615103249.GB6351@redhat.com> <4A363012.8050409@redhat.com> <20090615114858.GG6351@redhat.com> <4A3636FA.1040609@redhat.com> <20090615124101.GH6351@redhat.com> <4A364381.401@redhat.com> <4A364401.6010500@codemonkey.ws> <4A3647FB.9010808@redhat.com> <4A364B53.9080007@codemonkey.ws> <4A364FE0.40204@redhat.com> <4A3651EB.3070204@codemonkey.ws> <4A36555A.4090303@redhat.com> <4A3659A0.3050108@codemonkey.ws> <4A366348.1030202@redhat.com> <1245083229.3222.103.camel@blaa> <4A368F12.2090504@codemonkey.ws> <1246964898.2836.38.camel@blaa> Content-Type: text/plain Date: Tue, 07 Jul 2009 12:09:10 +0100 Message-Id: <1246964950.2836.39.camel@blaa> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 1/3] Change default PCI class of virtio-blk to PCI_CLASS_STORAGE_SCSI Reply-To: Mark McLoughlin List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Dor Laor , qemu-devel@nongnu.org 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 Signed-off-by: Mark McLoughlin --- hw/virtio-pci.c | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index f7da503..93ee5e1 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -414,7 +414,8 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev, virtio_bind_device(vdev, &virtio_pci_bindings, proxy); } -static void virtio_blk_init_pci(PCIDevice *pci_dev) +static void virtio_blk_init_pci_with_class(PCIDevice *pci_dev, + uint16_t class_code) { VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); VirtIODevice *vdev; @@ -423,8 +424,17 @@ static void virtio_blk_init_pci(PCIDevice *pci_dev) virtio_init_pci(proxy, vdev, PCI_VENDOR_ID_REDHAT_QUMRANET, PCI_DEVICE_ID_VIRTIO_BLOCK, - PCI_CLASS_STORAGE_OTHER, - 0x00); + class_code, 0x00); +} + +static void virtio_blk_init_pci(PCIDevice *pci_dev) +{ + virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_SCSI); +} + +static void virtio_blk_init_pci_0_10(PCIDevice *pci_dev) +{ + virtio_blk_init_pci_with_class(pci_dev, PCI_CLASS_STORAGE_OTHER); } static void virtio_console_init_pci(PCIDevice *pci_dev) @@ -476,6 +486,10 @@ static void virtio_pci_register_devices(void) virtio_console_init_pci); pci_qdev_register("virtio-balloon-pci", sizeof(VirtIOPCIProxy), virtio_balloon_init_pci); + + /* For compatibility with 0.10 */ + pci_qdev_register("virtio-blk-pci-0-10", sizeof(VirtIOPCIProxy), + virtio_blk_init_pci_0_10); } device_init(virtio_pci_register_devices) -- 1.6.2.5