mirror of https://github.com/acidanthera/audk.git
OvmfPkg/PlatformPei: consider AP stacks for pei memory cap
Needed to avoid running out of memory when booting with a large (~2048) number of vcpus. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20240214104504.2931339-3-kraxel@redhat.com>
This commit is contained in:
parent
9d32a02a72
commit
8757e648d1
|
@ -187,6 +187,8 @@ GetPeiMemoryCap (
|
||||||
UINT32 Pml4Entries;
|
UINT32 Pml4Entries;
|
||||||
UINT32 PdpEntries;
|
UINT32 PdpEntries;
|
||||||
UINTN TotalPages;
|
UINTN TotalPages;
|
||||||
|
UINT64 ApStacks;
|
||||||
|
UINT64 MemoryCap;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If DXE is 32-bit, then just return the traditional 64 MB cap.
|
// If DXE is 32-bit, then just return the traditional 64 MB cap.
|
||||||
|
@ -235,11 +237,20 @@ GetPeiMemoryCap (
|
||||||
ASSERT (TotalPages <= 0x40201);
|
ASSERT (TotalPages <= 0x40201);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add 64 MB for miscellaneous allocations. Note that for
|
// With 32k stacks and 4096 vcpus this lands at 128 MB (far away
|
||||||
// PhysMemAddressWidth values close to 36, the cap will actually be
|
// from MAX_UINT32).
|
||||||
// dominated by this increment.
|
|
||||||
//
|
//
|
||||||
return (UINT32)(EFI_PAGES_TO_SIZE (TotalPages) + SIZE_64MB);
|
ApStacks = PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber * PcdGet32 (PcdCpuApStackSize);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add 64 MB for miscellaneous allocations. Note that for
|
||||||
|
// PhysMemAddressWidth values close to 36 and a small number of
|
||||||
|
// CPUs, the cap will actually be dominated by this increment.
|
||||||
|
//
|
||||||
|
MemoryCap = EFI_PAGES_TO_SIZE (TotalPages) + ApStacks + SIZE_64MB;
|
||||||
|
|
||||||
|
ASSERT (MemoryCap <= MAX_UINT32);
|
||||||
|
return (UINT32)MemoryCap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue