Page MenuHomeFreeBSD

Restrict PCIe maxslots to 0, instead of PCI_SLOTMAX

Authored by jhibbits on May 16 2018, 10:51 PM.



PCIe only permits 1 device on an endpoint, so some devices ignore the device
part of B:D:F probing. Although ARI likely fixes this, not all platforms
support ARI completely or correctly, so some devices end up showing up 32 times
on the bus.

This was found during bringup of POWER9/Talos. The OPAL firmware source
includes a comment stating that ARI needs to be implemented. At that point this
may become redundant. But until then, this is needed for POWER9 bringup.

Test Plan

Tested only on a POWER9 Talos system thus far, by booting.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhibbits created this revision.May 16 2018, 10:51 PM
jhb added inline comments.May 17 2018, 12:04 AM
2558 ↗(On Diff #42651)

Is it really limited to only these PCI-e device types? That is, will this in fact be true for any PCI-e pcib(4) device?

Also, we need to make sure there aren't other pcib_maxslots variants around that just hardcode PCI_SLOTMAX. I feel like I purged a bunch of them and made them inherit from this method in the past year or two, but I might be misremembering so it would be good to confirm.

jhibbits added inline comments.May 17 2018, 2:06 PM
2558 ↗(On Diff #42651)

These are the devices listed in the OPAL source:

Grepping through I see the following:

sys/arm64/cavium/thunder_pcie_pem.c has a hardcoded PCI_SLOTMAX #ifdef'd out likely for this very reason.
sys/sparc64/pci/psycho.c has PCI_SLOTMAX hardcoded
sys/arm/mv/mv_pci.c -- this probably gets it wrong, because it conditions on !MV_TYPE_PCI and returns 1 on not-PCI (so PCIe?)

I think the majority of those are hostbridges, so not sure offhand if we can just remove it. I'm pretty sure at least the ofwpci can be removed, and I can probably remove the ones from the powerpc files, which I didn't list here because they don't hardcode PCI_SLOTMAX, they have the same conditional check that I added here.

Ping? With this and two other reviews, I can now boot FreeBSD on POWER9 to multiuser, so want to get these in soon.

I tested this change on my POWER8 pseries system and it worked fine.

This revision is now accepted and ready to land.May 28 2018, 1:48 PM
This revision was automatically updated to reflect the committed changes.