Skip to content

MdeModulePkg, ArmVirtPkg, OvmfPkg: fixed PCI BAR placement

Tushar Dave qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 of 3 patches 3 repliesIn review

Changes since RFC v2 from the cover letter

- Integrate fixed-BAR handling into the existing IncompatiblePciDeviceSupportDxe driver instead of adding a new QemuFixedBarsDxe driver.
- Size and program PCI bridge windows for fixed BARs as part of PciBusDxe's own normal resource calculation and programming (CalculateResourceAperture()/ProgramPpbApperture()), instead of a separate post-enumeration reprogramming pass.

2 of 3 patches are in this archive. The cover letter announces 3.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3MdeModulePkg/PciBusDxe: honor fixed BAR addresses from IncompatiblePciMdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c+25 -00 replies
3/3MdeModulePkg/PciBusDxe: size and program bridge windows for fixed BARsMdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.c MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.h+117 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] MdeModulePkg, ArmVirtPkg, OvmfPkg: fixed PCI BAR placement

This is the firmware companion to the QEMU series [1], which validates fixed BAR configuration and exports it to firmware through the "etc/fixed-bars" fw_cfg file.

The existing IncompatiblePciDeviceSupportDxe driver is extended to read the fw_cfg blob and supply fixed BAR addresses to PciBusDxe. The PciBusDxe changes honor these addresses both when programming a BAR directly and when sizing and programming the bridge windows above it, so a fixed BAR behind one or more bridges is placed correctly and covered by the appropriate bridge windows.

Testing:

The series was tested together with the QEMU companion patches on the AArch64 virt machine across a range of PCIe topologies: emulated devices, VFIO passthrough devices, PCIe switches, single and multiple fixed-BAR endpoints under a shared root port, and fixed BARs behind nested bridges.

Changes since RFC v2:

- Integrate fixed-BAR handling into the existing IncompatiblePciDeviceSupportDxe driver instead of adding a new QemuFixedBarsDxe driver.
- Size and program PCI bridge windows for fixed BARs as part of PciBusDxe's own normal resource calculation and programming (CalculateResourceAperture()/ProgramPpbApperture()), instead of a separate post-enumeration reprogramming pass.

RFC v2:
https://lore.kernel.org/qemu-devel/[email protected]/

[1] QEMU companion series:
https://lore.kernel.org/qemu-arm/[email protected]/

A git branch with this series applied is available at:
https://github.com/tdavenvidia/edk2/tree/Upstream-fixed-bar-Sep-15-V1

The related QEMU change is available at:
https://github.com/tdavenvidia/upstream-qemu/tree/Upstream-fixed-bar-Sep-15-V1

Tushar Dave (3):
MdeModulePkg/PciBusDxe: honor fixed BAR addresses from IncompatiblePci ArmVirtPkg,OvmfPkg: fold fixed BAR placement into IncompatiblePci MdeModulePkg/PciBusDxe: size and program bridge windows for fixed BARs

 ArmVirtPkg/ArmVirtQemu.dsc                    |   2 +
 ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc          |   1 +
 MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.h       |   2 +
 .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c  |  12 +
 .../Bus/Pci/PciBusDxe/PciResourceSupport.c    | 121 +++++
 .../Bus/Pci/PciBusDxe/PciResourceSupport.h    |   7 +
 .../FixedBars.c                               | 413 ++++++++++++++++++
 .../FixedBars.h                               |  63 +++
 .../IncompatiblePciDeviceSupport.c            | 114 +++--
 .../IncompatiblePciDeviceSupport.inf          |   8 +-
 10 files changed, 712 insertions(+), 31 deletions(-)
 create mode 100644 OvmfPkg/IncompatiblePciDeviceSupportDxe/FixedBars.c
 create mode 100644 OvmfPkg/IncompatiblePciDeviceSupportDxe/FixedBars.h
Signature · 1 line
2.34.1