Re: [PATCH] PCI: Do not restore firmware BAR assignments behind a PCI-PCI bridge

From: Maciej W. Rozycki
Date: Thu Jul 08 2021 - 16:19:05 EST


On Wed, 7 Jul 2021, Maciej W. Rozycki wrote:

> This may work for a device directly on the root bus decoded by the host
> bridge only, but for a device behind one or more PCI-to-PCI (or CardBus)
> bridges those bridges' forwarding windows have been standardised and
> need to be respected, or leaving whatever has been there in a downstream
> device's BAR will have no effect as cycles for the addresses recorded
> there will have no chance to appear on the bus the device has been
> immediately attached to.
>
> Do not restore the firmware assignment for a device behind a PCI-to-PCI
> bridge then, fixing the system concerned as follows:

Scrap it.

Something kept bothering me about this fix and I have double-checked with
PR 16263, and the problematic device there also was behind a PCI-to-PCI
bridge, which I have somehow missed previously, though within the bridge's
forwarding window. So a more stringent rule will be required to keep both
cases happy and I'll make v2 shortly that only refrains from restoring the
original assignment when it is outside the relevant upstream bridge's
forwarding window.

Maciej