From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MO8Z6-0003vj-9B for qemu-devel@nongnu.org; Tue, 07 Jul 2009 07:10:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MO8Z1-0003pi-Fg for qemu-devel@nongnu.org; Tue, 07 Jul 2009 07:10:23 -0400 Received: from [199.232.76.173] (port=33182 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MO8Z0-0003pP-Vk for qemu-devel@nongnu.org; Tue, 07 Jul 2009 07:10:19 -0400 Received: from mx2.redhat.com ([66.187.237.31]:43692) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MO8Z0-0006Vo-HQ for qemu-devel@nongnu.org; Tue, 07 Jul 2009 07:10:18 -0400 From: Mark McLoughlin In-Reply-To: <1246964950.2836.39.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> <1246964950.2836.39.camel@blaa> Content-Type: text/plain Date: Tue, 07 Jul 2009 12:09:58 +0100 Message-Id: <1246964998.2836.40.camel@blaa> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 2/3] Change default PCI class of virtio-console to PCI_CLASS_SERIAL_OTHER Reply-To: Mark McLoughlin List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Adam Jackson , qemu-devel@nongnu.org We're using PCI_CLASS_DISPLAY_OTHER now, but qemu-kvm.git is using PCI_CLASS_OTHERS because: "As a PCI_CLASS_DISPLAY_OTHER, it reduces primary display somehow on Windows XP (possibly Windows disables acceleration since it fails to find a driver)." While this is valid, many versions of X will get confused by it. Class major number of 0 gets treated as a possibly prehistoric VGA device, and then the autoconfig logic gets confused trying to figure out whether the virtio console or the pv vga device are the real VGA. We should really set a proper class ID. 0x0780 (serial / other) seems most appropriate. This shouldn't require any kernel changes, the modalias for virtio looks like: alias: pci:v00001AF4d*sv*sd*bc*sc*i* so won't care what the base class or subclass are. It shows up in the guest as: 00:05.0 Communication controller: Qumranet, Inc. Virtio console 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: Adam Jackson Signed-off-by: Mark McLoughlin --- hw/pci_ids.h | 3 +++ hw/virtio-pci.c | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/hw/pci_ids.h b/hw/pci_ids.h index 3afe674..2fe60ee 100644 --- a/hw/pci_ids.h +++ b/hw/pci_ids.h @@ -35,6 +35,9 @@ #define PCI_CLASS_BRIDGE_PCI 0x0604 #define PCI_CLASS_BRIDGE_OTHER 0x0680 +#define PCI_CLASS_SERIAL_OTHER 0x0780 + +#define PCI_CLASS_PROCESSOR_CO 0x0b40 #define PCI_CLASS_COMMUNICATION_OTHER 0x0780 #define PCI_CLASS_PROCESSOR_CO 0x0b40 diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index 93ee5e1..6d3420d 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -437,7 +437,8 @@ 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) +static void virtio_console_init_pci_with_class(PCIDevice *pci_dev, + uint16_t class_code) { VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); VirtIODevice *vdev; @@ -446,8 +447,17 @@ static void virtio_console_init_pci(PCIDevice *pci_dev) virtio_init_pci(proxy, vdev, PCI_VENDOR_ID_REDHAT_QUMRANET, PCI_DEVICE_ID_VIRTIO_CONSOLE, - PCI_CLASS_DISPLAY_OTHER, - 0x00); + class_code, 0x00); +} + +static void virtio_console_init_pci(PCIDevice *pci_dev) +{ + virtio_console_init_pci_with_class(pci_dev, PCI_CLASS_SERIAL_OTHER); +} + +static void virtio_console_init_pci_0_10(PCIDevice *pci_dev) +{ + virtio_console_init_pci_with_class(pci_dev, PCI_CLASS_DISPLAY_OTHER); } static void virtio_net_init_pci(PCIDevice *pci_dev) @@ -490,6 +500,8 @@ static void virtio_pci_register_devices(void) /* For compatibility with 0.10 */ pci_qdev_register("virtio-blk-pci-0-10", sizeof(VirtIOPCIProxy), virtio_blk_init_pci_0_10); + pci_qdev_register("virtio-console-pci-0-10", sizeof(VirtIOPCIProxy), + virtio_console_init_pci_0_10); } device_init(virtio_pci_register_devices) -- 1.6.2.5