From 0bae161fed39d8996693e586b77f31094b61b9d7 Mon Sep 17 00:00:00 2001 From: Zhiguang Liu Date: Tue, 8 Oct 2024 13:14:08 +0800 Subject: [PATCH] UefiCpuPkg/MpLib: Remove NotifyOnS3SmmInitDonePpi Previously, the SMM S3 resume code required taking control of APs to perform SMM rebase, which would overwrite the context set by MpLib. As a result, MpLib needed to wake up APs using InitSipiSipi to restore the context after SMM S3 resume. With the recent change where SMM rebase occurs in the early PEI phase, the SMM S3 resume code no longer modifies AP context. Therefore, the forced use of InitSipiSipi after SMM S3 resume is no longer necessary. Signed-off-by: Zhiguang Liu --- UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 1 - UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 64 ------------------- 2 files changed, 65 deletions(-) diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf index e4a7485fefd3..d2b6a43cdc14 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf @@ -87,7 +87,6 @@ gEdkiiPeiShadowMicrocodePpiGuid ## SOMETIMES_CONSUMES [Guids] - gEdkiiS3SmmInitDoneGuid gEdkiiMicrocodePatchHobGuid gGhcbApicIdsGuid ## SOMETIMES_CONSUMES gEdkiiEndOfS3ResumeGuid diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c index 16a858d54259..495dc108b232 100644 --- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c @@ -14,68 +14,6 @@ STATIC UINT64 mSevEsPeiWakeupBuffer = BASE_1MB; -/** - S3 SMM Init Done notification function. - - @param PeiServices Indirect reference to the PEI Services Table. - @param NotifyDesc Address of the notification descriptor data structure. - @param InvokePpi Address of the PPI that was invoked. - - @retval EFI_SUCCESS The function completes successfully. - -**/ -EFI_STATUS -EFIAPI -NotifyOnS3SmmInitDonePpi ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, - IN VOID *InvokePpi - ); - -// -// Global function -// -EFI_PEI_NOTIFY_DESCRIPTOR mS3SmmInitDoneNotifyDesc = { - EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, - &gEdkiiS3SmmInitDoneGuid, - NotifyOnS3SmmInitDonePpi -}; - -/** - S3 SMM Init Done notification function. - - @param PeiServices Indirect reference to the PEI Services Table. - @param NotifyDesc Address of the notification descriptor data structure. - @param InvokePpi Address of the PPI that was invoked. - - @retval EFI_SUCCESS The function completes successfully. - -**/ -EFI_STATUS -EFIAPI -NotifyOnS3SmmInitDonePpi ( - IN EFI_PEI_SERVICES **PeiServices, - IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, - IN VOID *InvokePpi - ) -{ - CPU_MP_DATA *CpuMpData; - - CpuMpData = GetCpuMpData (); - - // - // PiSmmCpuDxeSmm driver hardcode change the loop mode to HLT mode. - // So in this notify function, code need to check the current loop - // mode, if it is not HLT mode, code need to change loop mode back - // to the original mode. - // - if (CpuMpData->ApLoopMode != ApInHltLoop) { - CpuMpData->WakeUpByInitSipiSipi = TRUE; - } - - return EFI_SUCCESS; -} - /** Enable Debug Agent to support source debugging on AP function. @@ -510,8 +448,6 @@ InitMpGlobalData ( /// /// Install Notify /// - Status = PeiServicesNotifyPpi (&mS3SmmInitDoneNotifyDesc); - ASSERT_EFI_ERROR (Status); Status = PeiServicesNotifyPpi (&mEndOfS3ResumeNotifyDesc); ASSERT_EFI_ERROR (Status);