From patchwork Tue Aug 9 11:22:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 9270917 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 64A7060839 for ; Tue, 9 Aug 2016 11:24:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5647C27E66 for ; Tue, 9 Aug 2016 11:24:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A3382818B; Tue, 9 Aug 2016 11:24:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE0AC27E66 for ; Tue, 9 Aug 2016 11:24:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752043AbcHILYv (ORCPT ); Tue, 9 Aug 2016 07:24:51 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:47388 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751914AbcHILYv (ORCPT ); Tue, 9 Aug 2016 07:24:51 -0400 Received: from localhost ([127.0.0.1]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1bX59G-0003LI-Te; Tue, 09 Aug 2016 13:24:43 +0200 Date: Tue, 9 Aug 2016 13:22:30 +0200 (CEST) From: Thomas Gleixner To: LKML cc: x86@kernel.org, Bjorn Helgaas , linux-pci@vger.kernel.org, Jan Kiszka , Benedikt Spranger Subject: x86/PCI: Scan all functions during probing Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Benedikt Spranger PCI and PCIBIOS probing only scans devices at function number 0/8/16/... Subdevices (e.g. multiqueue) have function numbers which are not a multiple of 8. Simple hypervisors (e.g. Jailhouse) pass subdevices directly w/o providing virtual PCI mappings like KVM. As a consequence a simple PCI passthrough from Jailhouse to a linux guest is not able to detect such devices. Changing the probe functions to scan all function numbers makes it work. This has no side effects and there is no reason to force the 0/8/16... probing scheme. Signed-off-by: Benedikt Spranger Signed-off-by: Thomas Gleixner --- arch/x86/pci/legacy.c | 2 +- drivers/pci/probe.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/arch/x86/pci/legacy.c +++ b/arch/x86/pci/legacy.c @@ -42,7 +42,7 @@ void pcibios_scan_specific_bus(int busn) if (pci_find_bus(0, busn)) return; - for (devfn = 0; devfn < 256; devfn += 8) { + for (devfn = 0; devfn < 256; devfn++) { if (!raw_pci_read(0, busn, devfn, PCI_VENDOR_ID, 2, &l) && l != 0x0000 && l != 0xffff) { DBG("Found device at %02x:%02x [%04x]\n", busn, devfn, l); --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2063,7 +2063,7 @@ unsigned int pci_scan_child_bus(struct p dev_dbg(&bus->dev, "scanning bus\n"); /* Go find them, Rover! */ - for (devfn = 0; devfn < 0x100; devfn += 8) + for (devfn = 0; devfn < 0x100; devfn++) pci_scan_slot(bus, devfn); /* Reserve buses for SR-IOV capability. */