diff options
author | Xie, Yuanhao <yuanhao.xie@intel.com> | 2023-06-28 16:47:22 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-07-11 02:47:27 +0000 |
commit | 8bb018afaf2a4af16e410bba01b42d245250c82c (patch) | |
tree | ef8e5183abb8e618a1a0f8bb9b9796e6894ecc71 /UefiCpuPkg/Library/MpInitLib/MpLib.h | |
parent | 243212b0d0bb33d0a64db8cd974d243e5aefdf3d (diff) | |
download | edk2-8bb018afaf2a4af16e410bba01b42d245250c82c.tar.gz |
UefiCpuPkg: Create MpHandOff.
Initially, the purpose of the Hob was twofold: it served as a way to
transfer information from PEI to DXE. However, during the DXE phase,
only a few fields from the CPU_MP_DATA which collected in PEI phase were
needed. A new Hob was specifically created to transfer information
to the DXE phase. This new Hob contained only the essential fields
required for reuse in DXE. For instance, instead of directly including
the BspNumber in MpHandOff, the DXE phase introduced the use of
GetBspNumber() to collect the BspNumber from ApicID and CpuCount.
The SaveCpuMpData() function was updated to construct the MP_HAND_OFF
Hob. Additionally, the function introduced the MP_HAND_OFF_SIGNAL,
which solely served the purpose of awakening the APs
and transitioning their context from PEI to DXE. The
WaitLoopExecutionMode field indicated whether the bit mode of PEI
matched that of DXE. Both of them were filled only if the ApLoopMode
was not ApInHltLoop. In the case of ApInHltLoop, it remained necessary
to wake up the APs using the init-sipi-sipi sequence. This improvement
still allow INIT-SIPI-SIPI even APs are wait in Run/Mwait loop mode.
The function GetMpHandOffHob() was added to facilitate access to the
collected MpHandOff in the DXE phase. The CpuMpData in the DXE phase
was updated by gathering information from MpHandOff. Since MpHandOff
replaced the usage of OldCpuMpData and contained essential information
from the PEI phase to the DXE phase. AmdSevUpdateCpuMpData was included
to maintain the original implementation of AmdSev, ensuring that
OldCpuMpData->NewCpuMpData pointed to CpuMpData.
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Diffstat (limited to 'UefiCpuPkg/Library/MpInitLib/MpLib.h')
-rw-r--r-- | UefiCpuPkg/Library/MpInitLib/MpLib.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h index b694c7b40f..a7f36d323b 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h @@ -39,8 +39,17 @@ #include <Register/Amd/Ghcb.h>
#include <Guid/MicrocodePatchHob.h>
+#include "MpHandOff.h"
#define WAKEUP_AP_SIGNAL SIGNATURE_32 ('S', 'T', 'A', 'P')
+//
+// To trigger the start-up signal, BSP writes the specified
+// StartupSignalValue to the StartupSignalAddress of each processor.
+// This address is monitored by the APs, and as soon as they receive
+// the value that matches the MP_HAND_OFF_SIGNAL, they will wake up
+// and switch the context from PEI to DXE phase.
+//
+#define MP_HAND_OFF_SIGNAL SIGNATURE_32 ('M', 'P', 'H', 'O')
#define CPU_INIT_MP_LIB_HOB_GUID \
{ \
@@ -891,4 +900,14 @@ SevSnpCreateAP ( IN INTN ProcessorNumber
);
+/**
+ Get pointer to CPU MP Data structure from GUIDed HOB.
+
+ @param[in] CpuMpData The pointer to CPU MP Data structure.
+**/
+VOID
+AmdSevUpdateCpuMpData (
+ IN CPU_MP_DATA *CpuMpData
+ );
+
#endif
|