Skip to content

Commit fcd9570

Browse files
jiaxinwumergify[bot]
authored andcommitted
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 <[email protected]>
1 parent e34460c commit fcd9570

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c

+23-8
Original file line numberDiff line numberDiff line change
@@ -520,16 +520,19 @@ BSPHandler (
520520
ApCount = CpuCount - 1;
521521

522522
//
523-
// Wait for all APs to get ready for programming MTRRs
523+
// Wait for all APs of arrival at this point
524524
//
525525
SmmCpuSyncWaitForAPs (mSmmMpSyncData->SyncContext, ApCount, CpuIndex); /// #1: Wait APs
526526

527+
//
528+
// Signal all APs it's time for:
529+
// 1. Backup MTRRs if needed.
530+
// 2. Perform SMM CPU Platform Hook before executing MMI Handler.
531+
//
532+
ReleaseAllAPs (); /// #2: Signal APs
533+
527534
if (SmmCpuFeaturesNeedConfigureMtrrs ()) {
528535
//
529-
// Signal all APs it's time for backup MTRRs
530-
//
531-
ReleaseAllAPs (); /// #2: Signal APs
532-
533536
//
534537
// SmmCpuSyncWaitForAPs() may wait for ever if an AP happens to enter SMM at
535538
// exactly this point. Please make sure PcdCpuSmmMaxSyncLoops has been set
@@ -564,6 +567,11 @@ BSPHandler (
564567
}
565568
}
566569

570+
//
571+
// Perform SMM CPU Platform Hook before executing MMI Handler
572+
//
573+
SmmCpuPlatformHookBeforeMmiHandler ();
574+
567575
//
568576
// The BUSY lock is initialized to Acquired state
569577
//
@@ -806,14 +814,16 @@ APHandler (
806814
// Notify BSP of arrival at this point
807815
//
808816
SmmCpuSyncReleaseBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); /// #1: Signal BSP
809-
}
810817

811-
if (SmmCpuFeaturesNeedConfigureMtrrs ()) {
812818
//
813-
// Wait for the signal from BSP to backup MTRRs
819+
// Wait for the signal from BSP to:
820+
// 1. Backup MTRRs if needed.
821+
// 2. Perform SMM CPU Platform Hook before executing MMI Handler.
814822
//
815823
SmmCpuSyncWaitForBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); /// #2: Wait BSP
824+
}
816825

826+
if (SmmCpuFeaturesNeedConfigureMtrrs ()) {
817827
//
818828
// Backup OS MTRRs
819829
//
@@ -840,6 +850,11 @@ APHandler (
840850
SmmCpuSyncReleaseBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); /// #5: Signal BSP
841851
}
842852

853+
//
854+
// Perform SMM CPU Platform Hook before executing MMI Handler
855+
//
856+
SmmCpuPlatformHookBeforeMmiHandler ();
857+
843858
while (TRUE) {
844859
//
845860
// Wait for something to happen

0 commit comments

Comments
 (0)