Re: [PATCH v2 0/2] PCI: Allow non-prefetchable BARs in prefetchable windows

From: Ard Biesheuvel

Date: Sat Sep 26 2026 - 12:35:05 EST


On Fri, Sep 25, 2026 at 6:48 PM Ard Biesheuvel <ardb+git@xxxxxxxxxx> wrote:
>
> From: Ard Biesheuvel <ardb@xxxxxxxxxx>
>
> The non-prefetchable window of a PCI-to-PCI bridge can only decode
> 32-bit addresses, and so even 64-bit non-prefetchable BARs of devices
> below a bridge compete for the scarce MMIO space below 4 GB.
>
> The PCIe spec notes that marking such a BAR prefetchable still permits
> correct operation as long as the entire path from the host to the device
> is PCIe (PCIe r7.0, sec 7.5.1.2.1). The same applies when the OS places
> a non-prefetchable BAR in a prefetchable bridge window, and so this
> series permits that unless there is a bridge on the path to the root bus
> that is not a PCIe Root Port or Switch Port, allowing 64-bit
> non-prefetchable BARs to be placed above 4 GB.
>
> How a host bridge treats the windows that firmware describes as
> prefetchable is platform specific, however, and so this is only done if
> the host bridge has no prefetchable windows at all, in which case all
> prefetchable bridge windows are carved out of non-prefetchable host
> bridge windows. This also means that devices on a root bus are never
> affected.
>
> Patch #1 is a preparatory refactor of pci_bus_alloc_resource() with no
> functional change, and patch #2 implements the relaxation.
>
> The series is based on pci/for-linus, as patch #2 touches the same
> lines in pci_do_resource_release_and_resize() as commit d58384c22739
> ("PCI: Fix BAR resize for devices on a root bus") queued there for
> v7.3.
>
> Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> Cc: "Ilpo Järvinen" <ilpo.jarvinen@xxxxxxxxxxxxxxx>
> Cc: Lorenzo Pieralisi <lpieralisi@xxxxxxxxxx>
> Link: https://lore.kernel.org/linux-pci/20260910143440.3865663-2-ardb+git@xxxxxxxxxx/
>
> Ard Biesheuvel (2):
> PCI: Add __pci_bus_alloc_resource() to allocate with explicit flags
> PCI: Allow non-prefetchable BARs in prefetchable windows
>

Apologies I appear to have done something wrong when using git
send-email. I failed to
cc linux-pci@ and instead put the patch filename in the to: field.

Please disregard this series for the time being; I will follow up
later this week with an
improved version, and I will try to send it to the correct set of recipients.