mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/2] PCI: Allow non-prefetchable BARs in prefetchable windows
@ 2026-09-30 10:30 Ard Biesheuvel
  2026-09-30 10:30 ` [PATCH v3 1/2] PCI: Add __pci_bus_alloc_resource() to allocate with explicit flags Ard Biesheuvel
  2026-09-30 10:30 ` [PATCH v3 2/2] PCI: Allow 64-bit non-prefetchable BARs in prefetchable windows Ard Biesheuvel
  0 siblings, 2 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2026-09-30 10:30 UTC (permalink / raw)
  To: linux-pci
  Cc: linux-kernel, Ard Biesheuvel, Bjorn Helgaas, Ilpo Järvinen,
	Lorenzo Pieralisi

From: Ard Biesheuvel <ardb@kernel.org>

(v2 never made it to linux-pci@ - please disregard it if you did get it)

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.

So add a new bus flag PCI_BUS_FLAGS_NO_NP_BARS_IN_P_WINDOWS, and wire it
up so that it is only set on buses where this relaxed placement is not
permitted. Then, use the flag to to decide whether to treat 64-bit NP
BARs as prefetchable only for the purpose of resource allocation (but
not for mapping the MMIO region or other reporting its properties)

Patch #1 is a preparatory refactor of pci_bus_alloc_resource() with no
functional change, and patch #2 implements the relaxation.

(based on v7.3-rc4)

Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
Link: https://lore.kernel.org/linux-pci/20260910143440.3865663-2-ardb+git@google.com/

Ard Biesheuvel (2):
  PCI: Add __pci_bus_alloc_resource() to allocate with explicit flags
  PCI: Allow 64-bit non-prefetchable BARs in prefetchable windows

 drivers/pci/bus.c       | 70 ++++++++++++++------
 drivers/pci/pci.c       | 43 +++++++++++-
 drivers/pci/pci.h       |  7 ++
 drivers/pci/probe.c     | 35 ++++++++++
 drivers/pci/setup-bus.c | 23 +++++--
 drivers/pci/setup-res.c | 30 ++++++---
 include/linux/pci.h     |  1 +
 7 files changed, 169 insertions(+), 40 deletions(-)

-- 
2.56.0.rc1.315.gc6ed9934b7-goog


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

end of thread, other threads:[~2026-09-30 10:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30 10:30 [PATCH v3 0/2] PCI: Allow non-prefetchable BARs in prefetchable windows Ard Biesheuvel
2026-09-30 10:30 ` [PATCH v3 1/2] PCI: Add __pci_bus_alloc_resource() to allocate with explicit flags Ard Biesheuvel
2026-09-30 10:30 ` [PATCH v3 2/2] PCI: Allow 64-bit non-prefetchable BARs in prefetchable windows Ard Biesheuvel

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

all inboxes | Powered by JetHome®