OvmfPkg/PlatformInitLib: Set dynamic MMIO window size to 1/4 Large multi-GPU passthrough configurations can exhaust the current MMIO window sizing rule (1/8 of guest physical address space), especially with newer GPUs that have very large BAR requirements and alignment overhead. With 46-bit guest physical addressing, the 1/8 rule provides an 8TB MMIO window. Newer GPUs with 512GB VRAM can exhaust an 8TB window when passing through up to 8 devices. Increase the MMIO window size to 1/4 of guest physical address space. This provides a 16TB MMIO window on a 46-bit setup. Tested with 8-GPU passthrough (512GB VRAM per GPU). With this change, all GPUs are visible and functional in the VM; without it, one GPU was unusable. Signed-off-by: ramkumar.s <ramkumar.s@nutanix.com>
diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c index 611cad9..b4ba998 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -815,7 +815,7 @@ UINT64 AddrSpace, MmioSpace; AddrSpace = LShiftU64 (1, PlatformInfoHob->PhysMemAddressWidth); - MmioSpace = LShiftU64 (1, PlatformInfoHob->PhysMemAddressWidth - 3); + MmioSpace = LShiftU64 (1, PlatformInfoHob->PhysMemAddressWidth - 2); if (PlatformInfoHob->PcdPciMmio64Override) { DEBUG ((DEBUG_INFO, "%a: using fwcfg override for mmio window\n", __func__));