From 633a755d99d8f889c4e3ed74cf558b16e6a67251 Mon Sep 17 00:00:00 2001 From: Jiaxin Wu Date: Mon, 2 Sep 2024 13:37:51 +0800 Subject: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Update IfReadOnlyPageTableNeeded After the 9f29fbd3, full mapping SMM page table is always created regardless the value of the PcdCpuSmmRestrictedMemoryAccess. If so, SMM PageTable Attributes can be set to ready-only since there is no need to update it. So, this patch is to remove restricted memory access check when setting the SMM PageTable attributes. Signed-off-by: Jiaxin Wu --- .../PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c index d1cfd72106..9c2fe162a9 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c @@ -1486,31 +1486,14 @@ IfReadOnlyPageTableNeeded ( { // // Don't mark page table memory as read-only if - // - no restriction on access to non-SMRAM memory; or // - SMM heap guard feature enabled; or // BIT2: SMM page guard enabled // BIT3: SMM pool guard enabled // - SMM profile feature enabled // - if (!IsRestrictedMemoryAccess () || - ((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) || + if (((PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) || mSmmProfileEnabled) { - if (sizeof (UINTN) == sizeof (UINT64)) { - // - // Restriction on access to non-SMRAM memory and heap guard could not be enabled at the same time. - // - ASSERT ( - !(IsRestrictedMemoryAccess () && - (PcdGet8 (PcdHeapGuardPropertyMask) & (BIT3 | BIT2)) != 0) - ); - - // - // Restriction on access to non-SMRAM memory and SMM profile could not be enabled at the same time. - // - ASSERT (!(IsRestrictedMemoryAccess () && mSmmProfileEnabled)); - } - return FALSE; }