public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* ReBAR over Thunderbolt
@ 2026-03-26 16:36 Cristian Cocos
  2026-03-27 10:15 ` Ilpo Järvinen
  0 siblings, 1 reply; 9+ messages in thread
From: Cristian Cocos @ 2026-03-26 16:36 UTC (permalink / raw)
  To: linux-pci

[This has been previously posted on the linux-hotplug list, though it
has been suggested that I post it here as well.]

The short story is that ReBAR does not work in eGPU hotplug(!)
scenarios: hotplugged Thunderbolt eGPUs are forced onto a 256MB BAR
regardless of the system's ReBAR capabilities, and this because during
hotplug the Linux kernel does not consult the ReBAR capability. As
eGPUs are becoming more and more popular, accommodating eGPU hotplug
scenarios has become imperative.

The longer story:

The current Thunderbolt eGPU *hotplug* sequence of events is this: BAR
2's hardware register powers up at 256 MB — the default size programmed
into the BAR's address decoder by Intel at the factory. The PCIe
Resizable BAR capability advertises support for up to 16 GB, but it's
passive — software must explicitly exercise it. When a Thunderbolt eGPU
is hotplugged at runtime, the kernel's PCI subsystem enumerates the new
device, reads the BAR at its 256 MB default, sizes the bridge windows
to match, and assigns addresses — all before any driver loads. The
ReBAR capability is never consulted(!) during this process.

A workaround is available for cold-plug scenarios only, and is
achieved by means of the **thunderbolt.host_reset=0** kernel parameter:
this preserves the BIOS's PCIe tunnel and BAR assignments from POST
(where the BIOS *does* exercise ReBAR). This delivers the full 16 GB
BAR but, as just mentioned, only works for cold-plug(!) scenarios — if
the eGPU is power-cycled at runtime, the new tunnel gets the 256 MB
default.

The proper fix would be for the kernel's PCI hotplug resource
assignment to *first* check for ReBAR capability during enumeration,
resize the BAR to the largest supported size that fits within available
bridge headroom, and *then* commit bridge windows and assign addresses.
This is essentially what the BIOS does during POST. It hasn't been
implemented yet because eGPU-over-Thunderbolt-with-ReBAR is (was?) a
niche use case.

Seeing as eGPU-over-Thunderbolt is poised to become mainstream, this
can no longer be considered a niche use case.

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

end of thread, other threads:[~2026-03-31 20:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26 16:36 ReBAR over Thunderbolt Cristian Cocos
2026-03-27 10:15 ` Ilpo Järvinen
2026-03-27 14:00   ` Cristian Cocos
2026-03-28 21:24   ` Cristian Cocos
2026-03-30 13:23     ` Ilpo Järvinen
2026-03-30 14:49       ` Cristian Cocos
2026-03-30 15:33         ` Ilpo Järvinen
2026-03-31 20:11           ` Cristian Cocos
2026-03-29 19:49   ` Cristian Cocos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox