summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2024-09-10 11:57:09 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-10-12 08:56:05 +0000
commitfcd9570c8d8164b42f907137a3a6e78977cc860a (patch)
tree2fd300531cdff9b9b37e708715b0e09c22520363
parente34460c8b27d4f47b4f895e06955a254c5b0ac00 (diff)
downloadedk2-fcd9570c8d8164b42f907137a3a6e78977cc860a.tar.gz
UefiCpuPkg/PiSmmCpuDxeSmm: Consume SmmCpuPlatformHookBeforeMmiHandler func
This patch is for PiSmmCpuDxeSmm driver to add one round wait/release sync for BSP and AP to perform the SMM CPU Platform Hook before executing MMI Handler: SmmCpuPlatformHookBeforeMmiHandler (). With the function, SMM CPU driver can perform the platform specific items after one round BSP and AP sync (to make sure all APs in SMI) and before the MMI handlers. After the change, steps #1 and #2 are additional requirements if the MmCpuSyncModeTradition mode is selected. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
-rw-r--r--UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index 2df2cb9f22..e3986fdc15 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -520,16 +520,19 @@ BSPHandler (
ApCount = CpuCount - 1;
//
- // Wait for all APs to get ready for programming MTRRs
+ // Wait for all APs of arrival at this point
//
SmmCpuSyncWaitForAPs (mSmmMpSyncData->SyncContext, ApCount, CpuIndex); /// #1: Wait APs
+ //
+ // Signal all APs it's time for:
+ // 1. Backup MTRRs if needed.
+ // 2. Perform SMM CPU Platform Hook before executing MMI Handler.
+ //
+ ReleaseAllAPs (); /// #2: Signal APs
+
if (SmmCpuFeaturesNeedConfigureMtrrs ()) {
//
- // Signal all APs it's time for backup MTRRs
- //
- ReleaseAllAPs (); /// #2: Signal APs
-
//
// SmmCpuSyncWaitForAPs() may wait for ever if an AP happens to enter SMM at
// exactly this point. Please make sure PcdCpuSmmMaxSyncLoops has been set
@@ -565,6 +568,11 @@ BSPHandler (
}
//
+ // Perform SMM CPU Platform Hook before executing MMI Handler
+ //
+ SmmCpuPlatformHookBeforeMmiHandler ();
+
+ //
// The BUSY lock is initialized to Acquired state
//
AcquireSpinLock (mSmmMpSyncData->CpuData[CpuIndex].Busy);
@@ -806,14 +814,16 @@ APHandler (
// Notify BSP of arrival at this point
//
SmmCpuSyncReleaseBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); /// #1: Signal BSP
- }
- if (SmmCpuFeaturesNeedConfigureMtrrs ()) {
//
- // Wait for the signal from BSP to backup MTRRs
+ // Wait for the signal from BSP to:
+ // 1. Backup MTRRs if needed.
+ // 2. Perform SMM CPU Platform Hook before executing MMI Handler.
//
SmmCpuSyncWaitForBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); /// #2: Wait BSP
+ }
+ if (SmmCpuFeaturesNeedConfigureMtrrs ()) {
//
// Backup OS MTRRs
//
@@ -840,6 +850,11 @@ APHandler (
SmmCpuSyncReleaseBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); /// #5: Signal BSP
}
+ //
+ // Perform SMM CPU Platform Hook before executing MMI Handler
+ //
+ SmmCpuPlatformHookBeforeMmiHandler ();
+
while (TRUE) {
//
// Wait for something to happen