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>
This commit is contained in:
Dun Tan 2024-11-01 12:19:36 +08:00 committed by mergify[bot]
parent 734406184f
commit b19f1311d6

View File

@ -665,13 +665,7 @@ MigrateMemoryAllocationHobs (
Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, HobStart); Hob.Raw = GetNextHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, HobStart);
while (Hob.Raw != NULL) { while (Hob.Raw != NULL) {
MemoryAllocationHob = (EFI_HOB_MEMORY_ALLOCATION *)Hob.Raw; MemoryAllocationHob = (EFI_HOB_MEMORY_ALLOCATION *)Hob.Raw;
if ((MemoryAllocationHob->AllocDescriptor.MemoryType == EfiBootServicesData) && if (MemoryAllocationHob->AllocDescriptor.MemoryType == EfiBootServicesData) {
(MmIsBufferOutsideMmValid (
MemoryAllocationHob->AllocDescriptor.MemoryBaseAddress,
MemoryAllocationHob->AllocDescriptor.MemoryLength
))
)
{
if (!IsZeroGuid (&MemoryAllocationHob->AllocDescriptor.Name)) { if (!IsZeroGuid (&MemoryAllocationHob->AllocDescriptor.Name)) {
MemoryInMmram = AllocatePages (EFI_SIZE_TO_PAGES (MemoryAllocationHob->AllocDescriptor.MemoryLength)); MemoryInMmram = AllocatePages (EFI_SIZE_TO_PAGES (MemoryAllocationHob->AllocDescriptor.MemoryLength));
if (MemoryInMmram != NULL) { if (MemoryInMmram != NULL) {