99 lines
4.1 KiB
Diff
99 lines
4.1 KiB
Diff
From 529cf9e805df50d45cd56dfb96b373057f9b0557 Mon Sep 17 00:00:00 2001
|
|
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
Date: Thu, 22 Feb 2024 17:01:05 +0100
|
|
Subject: [PATCH 09/10] UefiCpuPkg/MpInitLib: Add support for multiple HOBs to
|
|
SaveCpuMpData()
|
|
|
|
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: [9/10] 764ed13aaaa7e01c056773e9fe82555eb9476a16 (kraxel.rh/centos-src-edk2)
|
|
|
|
Add support for splitting Hand-Off data into multiple HOBs.
|
|
This is required for VMs with thousands of CPUs.
|
|
|
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
Message-Id: <20240222160106.686484-6-kraxel@redhat.com>
|
|
Reviewed-by: Ray Ni <ray.ni@intel.com>
|
|
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
|
[lersek@redhat.com: define one local variable per line [Ray]]
|
|
(cherry picked from commit 5e09b5d6d7eda2c88d12ee27db18b3c75ed24dd3)
|
|
---
|
|
UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 48 +++++++++++++++----------
|
|
1 file changed, 30 insertions(+), 18 deletions(-)
|
|
|
|
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
|
|
index f80e00edcf..ec1aa66692 100644
|
|
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
|
|
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
|
|
@@ -126,35 +126,47 @@ SaveCpuMpData (
|
|
IN CPU_MP_DATA *CpuMpData
|
|
)
|
|
{
|
|
+ UINT32 MaxCpusPerHob;
|
|
+ UINT32 CpusInHob;
|
|
UINT64 Data64;
|
|
- UINTN Index;
|
|
+ UINT32 Index;
|
|
+ UINT32 HobBase;
|
|
CPU_INFO_IN_HOB *CpuInfoInHob;
|
|
MP_HAND_OFF *MpHandOff;
|
|
UINTN MpHandOffSize;
|
|
|
|
+ MaxCpusPerHob = (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE) - sizeof (MP_HAND_OFF)) / sizeof (PROCESSOR_HAND_OFF);
|
|
+
|
|
//
|
|
// When APs are in a state that can be waken up by a store operation to a memory address,
|
|
// report the MP_HAND_OFF data for DXE to use.
|
|
//
|
|
- CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;
|
|
- MpHandOffSize = sizeof (MP_HAND_OFF) + sizeof (PROCESSOR_HAND_OFF) * CpuMpData->CpuCount;
|
|
- MpHandOff = (MP_HAND_OFF *)BuildGuidHob (&mMpHandOffGuid, MpHandOffSize);
|
|
- ASSERT (MpHandOff != NULL);
|
|
- ZeroMem (MpHandOff, MpHandOffSize);
|
|
- MpHandOff->ProcessorIndex = 0;
|
|
-
|
|
- MpHandOff->CpuCount = CpuMpData->CpuCount;
|
|
- if (CpuMpData->ApLoopMode != ApInHltLoop) {
|
|
- MpHandOff->StartupSignalValue = MP_HAND_OFF_SIGNAL;
|
|
- MpHandOff->WaitLoopExecutionMode = sizeof (VOID *);
|
|
- }
|
|
+ CpuInfoInHob = (CPU_INFO_IN_HOB *)(UINTN)CpuMpData->CpuInfoInHob;
|
|
+
|
|
+ for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
|
|
+ if (Index % MaxCpusPerHob == 0) {
|
|
+ HobBase = Index;
|
|
+ CpusInHob = MIN (CpuMpData->CpuCount - HobBase, MaxCpusPerHob);
|
|
+
|
|
+ MpHandOffSize = sizeof (MP_HAND_OFF) + sizeof (PROCESSOR_HAND_OFF) * CpusInHob;
|
|
+ MpHandOff = (MP_HAND_OFF *)BuildGuidHob (&mMpHandOffGuid, MpHandOffSize);
|
|
+ ASSERT (MpHandOff != NULL);
|
|
+ ZeroMem (MpHandOff, MpHandOffSize);
|
|
+
|
|
+ MpHandOff->ProcessorIndex = HobBase;
|
|
+ MpHandOff->CpuCount = CpusInHob;
|
|
+
|
|
+ if (CpuMpData->ApLoopMode != ApInHltLoop) {
|
|
+ MpHandOff->StartupSignalValue = MP_HAND_OFF_SIGNAL;
|
|
+ MpHandOff->WaitLoopExecutionMode = sizeof (VOID *);
|
|
+ }
|
|
+ }
|
|
|
|
- for (Index = 0; Index < MpHandOff->CpuCount; Index++) {
|
|
- MpHandOff->Info[Index].ApicId = CpuInfoInHob[Index].ApicId;
|
|
- MpHandOff->Info[Index].Health = CpuInfoInHob[Index].Health;
|
|
+ MpHandOff->Info[Index-HobBase].ApicId = CpuInfoInHob[Index].ApicId;
|
|
+ MpHandOff->Info[Index-HobBase].Health = CpuInfoInHob[Index].Health;
|
|
if (CpuMpData->ApLoopMode != ApInHltLoop) {
|
|
- MpHandOff->Info[Index].StartupSignalAddress = (UINT64)(UINTN)CpuMpData->CpuData[Index].StartupApSignal;
|
|
- MpHandOff->Info[Index].StartupProcedureAddress = (UINT64)(UINTN)&CpuMpData->CpuData[Index].ApFunction;
|
|
+ MpHandOff->Info[Index-HobBase].StartupSignalAddress = (UINT64)(UINTN)CpuMpData->CpuData[Index].StartupApSignal;
|
|
+ MpHandOff->Info[Index-HobBase].StartupProcedureAddress = (UINT64)(UINTN)&CpuMpData->CpuData[Index].ApFunction;
|
|
}
|
|
}
|
|
|
|
--
|
|
2.39.3
|
|
|