public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg\CoreDxe: Allow DXE Drivers to use untested memory
@ 2022-01-07 19:36 Stacy Howell
  2022-01-11  1:59 ` 回复: [edk2-devel] " gaoliming
  0 siblings, 1 reply; 8+ messages in thread
From: Stacy Howell @ 2022-01-07 19:36 UTC (permalink / raw)
  To: devel; +Cc: Stacy Howell, Dandan Bi, Liming Gao

REF: https://https://bugzilla.tianocore.org/show_bug.cgi?id=3795
CC: Dandan Bi <dandan.bi@intel.com>
CC: Liming Gao <gaoliming@byosoft.com.cn>

Updated CoreInternalAllocatePages() to call PromoteMemoryResource() and
re-attempt the allocation if unable to convert the specified memory range

Signed-off-by: Stacy Howell <stacy.howell@intel.com>
---
 MdeModulePkg/Core/Dxe/Mem/Page.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index 47d4c5d92e..cc0b90ac0d 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -1417,6 +1417,20 @@ CoreInternalAllocatePages (
     Status = CoreConvertPages (Start, NumberOfPages, MemoryType);
   }
 
+  if (EFI_ERROR (Status)) {
+    //
+    // If requested memory region is unavailable it may be untested memory
+    // Attempt to promote memory resources, then re-attempt the allocation
+    //
+    if (PromoteMemoryResource ()) {
+      if (NeedGuard) {
+        Status = CoreConvertPagesWithGuard (Start, NumberOfPages, MemoryType);
+      } else {
+        Status = CoreConvertPages (Start, NumberOfPages, MemoryType);
+      }
+    }
+  }
+
 Done:
   CoreReleaseMemoryLock ();
 
-- 
2.32.0.windows.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-16  3:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-07 19:36 [PATCH] MdeModulePkg\CoreDxe: Allow DXE Drivers to use untested memory Stacy Howell
2022-01-11  1:59 ` 回复: [edk2-devel] " gaoliming
2022-01-11  2:47   ` Sean
2022-01-11  3:08     ` 回复: " gaoliming
2022-01-11 15:57     ` Michael D Kinney
2022-01-14 21:12       ` Howell, Stacy
2022-04-25 14:10         ` Howell, Stacy
2022-07-16  3:24           ` 回复: " gaoliming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox