[lkml]   [2013]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectHow to reserve pci bus numbers for hotplug?

Context: I am working on a Thunderbolt driver for MacBooks (where the
firmware only handles cold plugged devices). The Thunderbolt part is
working but I have to boot the system with acpi_osi=Darwin as
otherwise the controller is powered down by the firmware. I know how
to reenable it (call a magic ACPI method), but Linux does not assign
enough resources to the hotplug ports.

After booting with acpi_osi=Darwin the relevant part of the PCI tree
looks like this (dmesg and lspci -vv attached):
+-01.1-[05-9b]----00.0-[06-6b]--+-00.0-[07]----00.0 Intel
Corporation DSL3510 Thunderbolt Port [Cactus Ridge]
| +-03.0-[08-38]--
| +-04.0-[39-69]--
| +-05.0-[6a]--
| \-06.0-[6b]--
Hotplugged Thunderbolt devices appear under 06.03 and 06.04
(theoretically also 06.03 and 06.06 but the firmware does not assign
any bus numbers). At this point everything works fine. If the system
is booted without acpi_osi=Darwin or enters suspend then ACPI cuts
power to everything below 01.1 (starting with 05).

I can reenable power by calling a magic ACPI method. The problem is
that the PCI config is gone. So after a manual sysfs rescan Linux
reassigns bus numbers like this:
+-01.1-[05-9b]----00.0-[06-0b]--+-00.0-[07]----00.0 Intel
Corporation DSL3510 Thunderbolt Port [Cactus Ridge]
| +-03.0-[08]--
| +-04.0-[09]--
| +-05.0-[0a]--
| \-06.0-[0b]--
And hotplug results in:
pci 0000:08:00.0: [8086:1549] type 01 class 0x060400
pci 0000:08:00.0: calling pci_fixup_transparent_bridge+0x0/0x30
pci 0000:08:00.0: supports D1 D2
pci 0000:08:00.0: PME# supported from D0 D1 D2 D3hot D3cold
pci 0000:08:00.0: PME# disabled
No bus number available for hot-added bridge 0000:08:00.0
pcieport 0000:06:03.0: bridge window [io 0x1000-0x0fff] to [bus 08]
add_size 1000
pcieport 0000:06:03.0: res[13]=[io 0x1000-0x0fff] get_res_add_size
add_size 1000
pcieport 0000:06:03.0: BAR 13: can't assign io (size 0x1000)
pcieport 0000:06:03.0: BAR 13: can't assign io (size 0x1000)
pcieport 0000:06:03.0: PCI bridge to [bus 08]
pcieport 0000:06:03.0: bridge window [mem 0xc1e00000-0xc20fffff]
pcieport 0000:06:03.0: bridge window [mem 0xce100000-0xce3fffff 64bit pref]
pci 0000:08:00.0: no hotplug settings from platform
pcieport 0000:08:00.0: enabling bus mastering
pcieport 0000:08:00.0: irq 56 for MSI/MSI-X

If I could get Linux to assign enough resources (bus numbers for now)
then I could drop the acpi_osi parameter and make thunderbolt work
after suspend... So, is there an easy way to fix this? (Quirks,
reconfiguring bus number assignments from a platform driver, ...?)

[unhandled content-type:application/octet-stream][unhandled content-type:application/octet-stream][unhandled content-type:application/octet-stream][unhandled content-type:application/octet-stream]
 \ /
  Last update: 2013-12-12 01:01    [W:0.079 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site