UefiCpuPkg/PiSmmCpuDxeSmm: Simplify SMM Profile Size Calculation

The motivation of this change is to simplify the logic in
StandaloneMmIpl when allocating the memory for SMM profile data.
IPL does not need to detect the CPU feature regarding MSR DS
Area. That change requires the PCD value contains the MSR DS
Area. So, the size of SmmProfileData will be simplified to the
PcdCpuSmmProfileSize directly.

mMsrDsAreaSize will be within the PcdCpuSmmProfileSize if
mBtsSupported is TRUE.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Yuanhao Xie <yuanhao.xie@intel.com>
This commit is contained in:
Jiaxin Wu 2024-07-08 13:24:55 +08:00 committed by mergify[bot]
parent 2e6ca59e33
commit 0de7882b46
4 changed files with 11 additions and 11 deletions

View File

@ -495,11 +495,7 @@ GetSmmProfileData (
ASSERT (Size != NULL);
if (mBtsSupported) {
*Size = PcdGet32 (PcdCpuSmmProfileSize) + mMsrDsAreaSize;
} else {
*Size = PcdGet32 (PcdCpuSmmProfileSize);
}
*Size = PcdGet32 (PcdCpuSmmProfileSize);
Base = 0xFFFFFFFF;
Status = gBS->AllocatePages (

View File

@ -270,8 +270,6 @@ extern UINTN mSmmShadowStackSize;
///
extern UINT8 mSmmSaveStateRegisterLma;
extern BOOLEAN mBtsSupported;
extern UINTN mMsrDsAreaSize;
extern BOOLEAN mAcpiS3Enable;
#define PAGE_TABLE_POOL_ALIGNMENT BASE_128KB

View File

@ -748,9 +748,6 @@ InitSmmProfileInternal (
);
ASSERT (mLastPFEntryPointer != NULL);
mSmmProfileSize = FixedPcdGet32 (PcdCpuSmmProfileSize);
ASSERT ((mSmmProfileSize & 0xFFF) == 0);
//
// Get Smm Profile Base
//
@ -758,6 +755,15 @@ InitSmmProfileInternal (
DEBUG ((DEBUG_ERROR, "SmmProfileBase = 0x%016x.\n", (UINTN)mSmmProfileBase));
DEBUG ((DEBUG_ERROR, "SmmProfileSize = 0x%016x.\n", (UINTN)SmmProfileSize));
if (mBtsSupported) {
ASSERT (SmmProfileSize > mMsrDsAreaSize);
mSmmProfileSize = (UINTN)SmmProfileSize - mMsrDsAreaSize;
} else {
mSmmProfileSize = (UINTN)SmmProfileSize;
}
ASSERT ((mSmmProfileSize & 0xFFF) == 0);
//
// Initialize SMM profile data header.
//

View File

@ -281,7 +281,7 @@
## Specifies buffer size in bytes to save SMM profile data. The value should be a multiple of 4KB.
# @Prompt SMM profile data buffer size.
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmProfileSize|0x200000|UINT32|0x32132107
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmProfileSize|0x600000|UINT32|0x32132107
## Specifies stack size in bytes for each processor in SMM.
# @Prompt Processor stack size in SMM.