65 lines
2.2 KiB
Diff
65 lines
2.2 KiB
Diff
From 9ecb56fbd704c4471b3485c08c1cbabeef5ee137 Mon Sep 17 00:00:00 2001
|
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
Date: Wed, 14 Feb 2024 11:45:02 +0100
|
|
Subject: [PATCH 02/10] OvmfPkg/PlatformPei: consider AP stacks for pei memory
|
|
cap
|
|
|
|
RH-Author: Gerd Hoffmann <None>
|
|
RH-MergeRequest: 59: backport 4096 vcpu patches for c9s
|
|
RH-Jira: RHEL-22202
|
|
RH-Acked-by: Oliver Steffen <osteffen@redhat.com>
|
|
RH-Commit: [2/10] e2c5325678de49e455de33581735d0275fb6b3b7 (kraxel.rh/centos-src-edk2)
|
|
|
|
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>
|
|
(cherry picked from commit 8757e648d11357b663331f6ed1cdb2ab017df178)
|
|
---
|
|
OvmfPkg/PlatformPei/MemDetect.c | 17 ++++++++++++++---
|
|
1 file changed, 14 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetect.c
|
|
index e0ecca10b6..d6c46ffc89 100644
|
|
--- a/OvmfPkg/PlatformPei/MemDetect.c
|
|
+++ b/OvmfPkg/PlatformPei/MemDetect.c
|
|
@@ -187,6 +187,8 @@ GetPeiMemoryCap (
|
|
UINT32 Pml4Entries;
|
|
UINT32 PdpEntries;
|
|
UINTN TotalPages;
|
|
+ UINT64 ApStacks;
|
|
+ UINT64 MemoryCap;
|
|
|
|
//
|
|
// If DXE is 32-bit, then just return the traditional 64 MB cap.
|
|
@@ -234,12 +236,21 @@ GetPeiMemoryCap (
|
|
(PdpEntries + 1) * Pml4Entries + 1;
|
|
ASSERT (TotalPages <= 0x40201);
|
|
|
|
+ //
|
|
+ // With 32k stacks and 4096 vcpus this lands at 128 MB (far away
|
|
+ // from MAX_UINT32).
|
|
+ //
|
|
+ ApStacks = PlatformInfoHob->PcdCpuMaxLogicalProcessorNumber * PcdGet32 (PcdCpuApStackSize);
|
|
+
|
|
//
|
|
// Add 64 MB for miscellaneous allocations. Note that for
|
|
- // PhysMemAddressWidth values close to 36, the cap will actually be
|
|
- // dominated by this increment.
|
|
+ // PhysMemAddressWidth values close to 36 and a small number of
|
|
+ // CPUs, the cap will actually be dominated by this increment.
|
|
//
|
|
- return (UINT32)(EFI_PAGES_TO_SIZE (TotalPages) + SIZE_64MB);
|
|
+ MemoryCap = EFI_PAGES_TO_SIZE (TotalPages) + ApStacks + SIZE_64MB;
|
|
+
|
|
+ ASSERT (MemoryCap <= MAX_UINT32);
|
|
+ return (UINT32)MemoryCap;
|
|
}
|
|
|
|
/**
|
|
--
|
|
2.39.3
|
|
|