linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* x86/PCI: Scan all functions during probing
@ 2016-08-09 11:22 Thomas Gleixner
  2016-08-09 12:13 ` Lukas Wunner
  2016-08-09 13:44 ` Bjorn Helgaas
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Gleixner @ 2016-08-09 11:22 UTC (permalink / raw)
  To: LKML; +Cc: x86, Bjorn Helgaas, linux-pci, Jan Kiszka, Benedikt Spranger

From: Benedikt Spranger <b.spranger@linutronix.de>

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 <b.spranger@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/pci/legacy.c |    2 +-
 drivers/pci/probe.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- 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. */

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-08-24 17:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-09 11:22 x86/PCI: Scan all functions during probing Thomas Gleixner
2016-08-09 12:13 ` Lukas Wunner
2016-08-09 13:44 ` Bjorn Helgaas
2016-08-18 20:33   ` Bjorn Helgaas
2016-08-24  8:39     ` Thomas Gleixner
2016-08-24 11:13       ` Jan Kiszka
2016-08-24 17:23         ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).