summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDun Tan <dun.tan@intel.com>2024-11-01 12:19:36 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-11-05 08:30:16 +0000
commitb19f1311d668fbca3ddb72e1244608babd7791c5 (patch)
tree330c9404a2cb32f8d99334dcddb5554bf73f2f3a
parent734406184fa2a05f484ffa4d00bd4fdcdb0b5b22 (diff)
downloadedk2-b19f1311d668fbca3ddb72e1244608babd7791c5.tar.gz
StandaloneMmPkg/Core: Remove unneeded check
Remove unneeded check MmIsBufferOutsideMmValid() when StandaloneMmCore checks if the BS data memory described by a memory allocation HOB needs to be migrated to Mmram. Currently, the API MmIsBufferOutsideMmValid() return TRUE when input memory range belongs to non-Mmram memory. Now the API will be changed in following 5 commits to return TRUE when a memory range belongs to non-Mmram memroy and the memory is inside a range described by resource HOB. This may cause PF when some SMI handler access the memory from a memory allocation HOB that is not migrated. To solve this issue, we can directly remove the check MmIsBufferOutsideMmValid() and always migrate the BS data memory described by a memory allocation HOB to Mmram. Signed-off-by: Dun Tan <dun.tan@intel.com>
-rw-r--r--StandaloneMmPkg/Core/StandaloneMmCore.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/StandaloneMmPkg/Core/StandaloneMmCore.c b/StandaloneMmPkg/Core/StandaloneMmCore.c
index 127248afab..5a3694b58c 100644
--- a/StandaloneMmPkg/Core/StandaloneMmCore.c
+++ b/StandaloneMmPkg/Core/StandaloneMmCore.c
@@ -665,13 +665,7 @@ MigrateMemoryAllocationHobs (
Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, HobStart);
while (Hob.Raw != NULL) {
MemoryAllocationHob = (EFI_HOB_MEMORY_ALLOCATION *)Hob.Raw;
- if ((MemoryAllocationHob->AllocDescriptor.MemoryType == EfiBootServicesData) &&
- (MmIsBufferOutsideMmValid (
- MemoryAllocationHob->AllocDescriptor.MemoryBaseAddress,
- MemoryAllocationHob->AllocDescriptor.MemoryLength
- ))
- )
- {
+ if (MemoryAllocationHob->AllocDescriptor.MemoryType == EfiBootServicesData) {
if (!IsZeroGuid (&MemoryAllocationHob->AllocDescriptor.Name)) {
MemoryInMmram = AllocatePages (EFI_SIZE_TO_PAGES (MemoryAllocationHob->AllocDescriptor.MemoryLength));
if (MemoryInMmram != NULL) {