From 882ca67c4d6818638e9941fb1715db5ab3a57eaa Mon Sep 17 00:00:00 2001 From: "Zhao,Yanxin" Date: Wed, 18 Dec 2024 10:45:40 +0800 Subject: [PATCH] UefiPkg/PiSmmCpuDxeSmm: Set SmmProfile Variable only for DXE SMM Some platforms plan to move the Standalone MM CPU driver into the FSP. However, there is no variable service support in FSP. Therefore, the SetVariable logic for the Standalone MM CPU will be removed. With this change, users can dump the SmmProfile data from the Memory Allocation HOB: gMmProfileDataHobGuid. This change does not impact the DXE SMM, which will still retrieve the SmmProfile data from the variable service. Signed-off-by: Zhao,Yanxin --- UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c index 4862cf075fed0..f28da7e0fbc08 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c @@ -749,6 +749,7 @@ InitSmmProfileInternal ( UINTN MsrDsAreaSizePerCpu; UINT64 SmmProfileSize; + Status = EFI_SUCCESS; mPFEntryCount = (UINTN *)AllocateZeroPool (sizeof (UINTN) * mMaxNumberOfCpus); ASSERT (mPFEntryCount != NULL); mLastPFEntryValue = (UINT64 (*)[MAX_PF_ENTRY_COUNT])AllocateZeroPool ( @@ -840,12 +841,14 @@ InitSmmProfileInternal ( // // Start SMM profile when SmmReadyToLock protocol is installed. // - Status = gMmst->MmRegisterProtocolNotify ( - &gEfiSmmReadyToLockProtocolGuid, - InitSmmProfileCallBack, - &Registration - ); - ASSERT_EFI_ERROR (Status); + if (!mIsStandaloneMm) { + Status = gMmst->MmRegisterProtocolNotify ( + &gEfiSmmReadyToLockProtocolGuid, + InitSmmProfileCallBack, + &Registration + ); + ASSERT_EFI_ERROR (Status); + } return; }