From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MR2yV-0005km-PV for qemu-devel@nongnu.org; Wed, 15 Jul 2009 07:48:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MR2yQ-0005g5-EY for qemu-devel@nongnu.org; Wed, 15 Jul 2009 07:48:38 -0400 Received: from [199.232.76.173] (port=53065 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MR2yQ-0005fh-4n for qemu-devel@nongnu.org; Wed, 15 Jul 2009 07:48:34 -0400 Received: from mx2.redhat.com ([66.187.237.31]:33731) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MR2yP-00042u-CU for qemu-devel@nongnu.org; Wed, 15 Jul 2009 07:48:33 -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 n6FBmWPD014746 for ; Wed, 15 Jul 2009 07:48:32 -0400 From: Gerd Hoffmann Date: Wed, 15 Jul 2009 13:48:24 +0200 Message-Id: <1247658505-838-6-git-send-email-kraxel@redhat.com> In-Reply-To: <1247658505-838-1-git-send-email-kraxel@redhat.com> References: <1247658505-838-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 5/6] qdev/compat: virtio-console-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 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 --- hw/pc.c | 4 ++++ hw/virtio-pci.c | 16 ++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 0913860..a5b385d 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1473,6 +1473,10 @@ static QEMUMachine pc_machine_v0_10 = { .driver = "virtio-blk-pci", .property = "class", .value = stringify(PCI_CLASS_STORAGE_OTHER), + },{ + .driver = "virtio-console-pci", + .property = "class", + .value = stringify(PCI_CLASS_DISPLAY_OTHER), }, { /* end of list */ } }, diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 41ba574..f186b53 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -442,12 +442,16 @@ static void virtio_console_init_pci(PCIDevice *pci_dev) VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); VirtIODevice *vdev; + if (proxy->class_code != PCI_CLASS_COMMUNICATION_OTHER && + proxy->class_code != PCI_CLASS_DISPLAY_OTHER && /* qemu 0.10 */ + proxy->class_code != PCI_CLASS_OTHERS) /* qemu-kvm */ + proxy->class_code = PCI_CLASS_COMMUNICATION_OTHER; + vdev = virtio_console_init(&pci_dev->qdev); virtio_init_pci(proxy, vdev, PCI_VENDOR_ID_REDHAT_QUMRANET, PCI_DEVICE_ID_VIRTIO_CONSOLE, - PCI_CLASS_DISPLAY_OTHER, - 0x00); + proxy->class_code, 0x00); } static void virtio_net_init_pci(PCIDevice *pci_dev) @@ -497,6 +501,14 @@ static PCIDeviceInfo virtio_info[] = { .qdev.name = "virtio-console-pci", .qdev.size = sizeof(VirtIOPCIProxy), .init = virtio_console_init_pci, + .qdev.props = (Property[]) { + { + .name = "class", + .info = &qdev_prop_hex32, + .offset = offsetof(VirtIOPCIProxy, class_code), + }, + {/* end of list */} + }, },{ .qdev.name = "virtio-balloon-pci", .qdev.size = sizeof(VirtIOPCIProxy), -- 1.6.2.5