One round BSP & AP sync for exit SMI is shown as below: BSP: SmmCpuSyncWaitForAPs <-- AP: SmmCpuSyncReleaseBsp BSP: ReleaseAllAPs --> AP: SmmCpuSyncWaitForBsp
Above is only required if need configure MTRR and support SMM source level debug, So, reduce one round BSP & AP sync if both are unsupported. Cc: Laszlo Ersek <ler...@redhat.com> Cc: Eric Dong <eric.d...@intel.com> Cc: Ray Ni <ray...@intel.com> Cc: Zeng Star <star.z...@intel.com> Cc: Gerd Hoffmann <kra...@redhat.com> Cc: Rahul Kumar <rahul1.ku...@intel.com> Signed-off-by: Jiaxin Wu <jiaxin...@intel.com> --- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 36 +++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c index 04622c66a2..d0139228bb 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -643,19 +643,21 @@ BSPHandler ( // SmmCpuFeaturesReenableSmrr (); MtrrSetAllMtrrs (&Mtrrs); } - // - // Wait for all APs to complete their pending tasks including MTRR programming if needed. - // - SmmCpuSyncWaitForAPs (mSmmMpSyncData->SyncContext, ApCount, CpuIndex); + if (SmmCpuFeaturesNeedConfigureMtrrs () || *mSmmDebugAgentSupport) { + // + // Wait for all APs to complete their pending tasks including MTRR programming if needed. + // + SmmCpuSyncWaitForAPs (mSmmMpSyncData->SyncContext, ApCount, CpuIndex); - // - // Signal APs to Reset states/semaphore for this processor - // - ReleaseAllAPs (); + // + // Signal APs to Reset states/semaphore for this processor + // + ReleaseAllAPs (); + } if (*mSmmDebugAgentSupport) { // // Stop source level debug in BSP handler, the code below will not be // debugged. @@ -894,19 +896,21 @@ APHandler ( // SmmCpuFeaturesReenableSmrr (); MtrrSetAllMtrrs (&Mtrrs); } - // - // Notify BSP the readiness of this AP to Reset states/semaphore for this processor - // - SmmCpuSyncReleaseBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); + if (SmmCpuFeaturesNeedConfigureMtrrs () || *mSmmDebugAgentSupport) { + // + // Notify BSP the readiness of this AP to Reset states/semaphore for this processor + // + SmmCpuSyncReleaseBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); - // - // Wait for the signal from BSP to Reset states/semaphore for this processor - // - SmmCpuSyncWaitForBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); + // + // Wait for the signal from BSP to Reset states/semaphore for this processor + // + SmmCpuSyncWaitForBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); + } // // Reset states/semaphore for this processor // *(mSmmMpSyncData->CpuData[CpuIndex].Present) = FALSE; -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112797): https://edk2.groups.io/g/devel/message/112797 Mute This Topic: https://groups.io/mt/103293803/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-