From owner-svn-src-stable@FreeBSD.ORG Thu Nov 4 17:13:30 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B32AD1065675; Thu, 4 Nov 2010 17:13:30 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8744E8FC18; Thu, 4 Nov 2010 17:13:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oA4HDU2c066614; Thu, 4 Nov 2010 17:13:30 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA4HDUpA066611; Thu, 4 Nov 2010 17:13:30 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011041713.oA4HDUpA066611@svn.freebsd.org> From: John Baldwin Date: Thu, 4 Nov 2010 17:13:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214787 - stable/7/sys/dev/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2010 17:13:30 -0000 Author: jhb Date: Thu Nov 4 17:13:30 2010 New Revision: 214787 URL: http://svn.freebsd.org/changeset/base/214787 Log: MFC 214203: - Add a new PCI quirk to whitelist an old chipset that doesn't support PCI-express or PCI-X capabilities if we are running in a virtual machine. - Whitelist the Intel 82440 chipset used by QEMU. Modified: stable/7/sys/dev/pci/pci.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/pci/pci.c ============================================================================== --- stable/7/sys/dev/pci/pci.c Thu Nov 4 17:12:29 2010 (r214786) +++ stable/7/sys/dev/pci/pci.c Thu Nov 4 17:13:30 2010 (r214787) @@ -178,6 +178,7 @@ struct pci_quirk { int type; #define PCI_QUIRK_MAP_REG 1 /* PCI map register in weird place */ #define PCI_QUIRK_DISABLE_MSI 2 /* MSI/MSI-X doesn't work */ +#define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ int arg1; int arg2; }; @@ -214,6 +215,12 @@ struct pci_quirk pci_quirks[] = { */ { 0x74501022, PCI_QUIRK_DISABLE_MSI, 0, 0 }, + /* + * Some virtualization environments emulate an older chipset + * but support MSI just fine. QEMU uses the Intel 82440. + */ + { 0x12378086, PCI_QUIRK_ENABLE_MSI_VM, 0, 0 }, + { 0 } }; @@ -1771,6 +1778,23 @@ pci_msi_device_blacklisted(device_t dev) } /* + * Returns true if a specified chipset supports MSI when it is + * emulated hardware in a virtual machine. + */ +static int +pci_msi_vm_chipset(device_t dev) +{ + struct pci_quirk *q; + + for (q = &pci_quirks[0]; q->devid; q++) { + if (q->devid == pci_get_devid(dev) && + q->type == PCI_QUIRK_ENABLE_MSI_VM) + return (1); + } + return (0); +} + +/* * Determine if MSI is blacklisted globally on this sytem. Currently, * we just check for blacklisted chipsets as represented by the * host-PCI bridge at device 0:0:0. In the future, it may become @@ -1786,8 +1810,14 @@ pci_msi_blacklisted(void) return (0); /* Blacklist all non-PCI-express and non-PCI-X chipsets. */ - if (!(pcie_chipset || pcix_chipset)) + if (!(pcie_chipset || pcix_chipset)) { + if (vm_guest != VM_GUEST_NO) { + dev = pci_find_bsf(0, 0, 0); + if (dev != NULL) + return (pci_msi_vm_chipset(dev) == 0); + } return (1); + } dev = pci_find_bsf(0, 0, 0); if (dev != NULL)