Page MenuHomeFreeBSD

tb_pci: Don't try to attach to PCI buses that aren't below a PCI-PCI brige
Needs ReviewPublic

Authored by jhb on Sun, Oct 19, 8:01 PM.
Tags
None
Referenced Files
F132961202: D53202.id.diff
Tue, Oct 21, 2:07 PM
F132961200: D53202.id164550.diff
Tue, Oct 21, 2:07 PM
Unknown Object (File)
Tue, Oct 21, 2:14 AM
Unknown Object (File)
Mon, Oct 20, 9:57 PM
Unknown Object (File)
Mon, Oct 20, 8:22 PM
Unknown Object (File)
Mon, Oct 20, 7:54 PM
Unknown Object (File)
Mon, Oct 20, 5:44 PM
Unknown Object (File)
Mon, Oct 20, 4:00 PM
Subscribers

Details

Reviewers
obiwac
Summary

In particular, don't try to probe PCI buses that are children of host
bridges such as the pci0 child of pcib0. This fixes a panic on boot
if tb.ko is loaded at boot time (which the driver recommends for
certain chipsets).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 67920
Build 64803: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Sun, Oct 19, 8:01 PM

So why is this driver only valid in those cases?

In D53202#1215346, @imp wrote:

So why is this driver only valid in those cases?

The panic is that it tries to do pci_get_vendor() on pcib0 (child of acpi0) and that isn't a valid IVAR and the accessor panics. In particular, note that this driver is expecting to call tb_pcib_find_ident on its parent, and tb_pcib_find_ident assumes the device it is operating on is a PCI device with a device ID, etc. That isn't true for host bridges that are children of ACPI or OFW, etc.

Also, FWIW, this just fixes a panic when the probe routine runs against pci0 on my laptop. Later when the driver tries to attach to the actual Thunderbolt slots in my laptop it panics in a different way (the attach still fails as it does post-boot, and I get a different form of a race with the interrupt handler that still results in an interrupt handler raising a GPF, presumably due to dereferencing freed memory field with 0xdeadc0de as in the other review),