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 -- 2.34.1
