Page MenuHomeFreeBSD

Restrict PCIe maxslots to 0, instead of PCI_SLOTMAX
ClosedPublic

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

Details

Summary

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

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
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
sys/dev/pci/pci_pci.c
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
sys/dev/pci/pci_pci.c
2558 ↗(On Diff #42651)

These are the devices listed in the OPAL source: https://github.com/open-power/skiboot/blob/master/core/pci.c#L181

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/sparc64/pci/schizo.c
sys/mips/atheros/ar724x_pci.c
sys/mips/atheros/ar71xx_pci.c
sys/mips/atheros/qca955x_pci.c
sys/mips/malta/gt_pci.c
sys/mips/cavium/octopci.c
sys/mips/mediatek/mtk_pcie.c
sys/mips/nlm/xlp_pci.c
sys/arm/versatile/versatile_pci.c
sys/arm/xscale/i8134x/i81342_pci.c
sys/arm/xscale/ixp425/ixp425_pci.c
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?)
sys/dev/ofw/ofwpci.c

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.