From bb7fd335f3ce5cbf600f7bd2008f03eae2484557 Mon Sep 17 00:00:00 2001 From: Zvonko Kaiser Date: Thu, 12 Feb 2026 15:48:42 +0000 Subject: [PATCH] qemu: Remove OVMF X-PciMmio64Mb fw_cfg hint Modern OVMF (edk2-stable202502 and later) automatically sizes the 64-bit PCI MMIO aperture based on the BARs of actually attached devices during PCI enumeration. The opt/ovmf/X-PciMmio64Mb fw_cfg hint is no longer needed to ensure large-BAR devices like NVIDIA GPUs receive adequate MMIO space. The previous approach was fragile: the runtime scanned host PCI devices to estimate the required aperture size, but only considered GPU devices (class 0x0302), missing NVSwitches and other devices with large BARs. Removing this code avoids confusion about MMIO sizing responsibility. Signed-off-by: Zvonko Kaiser --- src/runtime/virtcontainers/qemu.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/runtime/virtcontainers/qemu.go b/src/runtime/virtcontainers/qemu.go index e4b079c6d4..71ced27bff 100644 --- a/src/runtime/virtcontainers/qemu.go +++ b/src/runtime/virtcontainers/qemu.go @@ -815,18 +815,6 @@ func (q *qemu) createPCIeTopology(qemuConfig *govmmQemu.Config, hypervisorConfig // Deduce the right values for mem-reserve and pref-64-reserve memory regions memSize32bit, memSize64bit := q.arch.getBARsMaxAddressableMemory() - // The default OVMF MMIO aperture is too small for some PCIe devices - // with huge BARs so we need to increase it. - // memSize64bit is in bytes, convert to MB, OVMF expects MB as a string - if strings.Contains(strings.ToLower(hypervisorConfig.FirmwarePath), "ovmf") { - pciMmio64Mb := fmt.Sprintf("%d", (memSize64bit / 1024 / 1024)) - fwCfg := govmmQemu.FwCfg{ - Name: "opt/ovmf/X-PciMmio64Mb", - Str: pciMmio64Mb, - } - qemuConfig.FwCfg = append(qemuConfig.FwCfg, fwCfg) - } - // Get the number of hot(cold)-pluggable ports needed from the provided // VFIO devices var numOfPluggablePorts uint32 = 0