Most of the times it is desirable not to use special purpose
memory for regular edk2 usages. That memory (HBm/CXL) are
either meant for special purposes or are less reliable to
be used. So avoid using them as long as possible. We could
also introduce PCD for this control.

Cc: Liming Gao <gaolim...@byosoft.com.cn>
Signed-off-by: Dhaval Sharma <dha...@rivosinc.com>
---
 MdeModulePkg/Core/Dxe/Mem/Page.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/Mem/Page.c b/MdeModulePkg/Core/Dxe/Mem/Page.c
index 5a51d9df1a29..e4daa741b971 100644
--- a/MdeModulePkg/Core/Dxe/Mem/Page.c
+++ b/MdeModulePkg/Core/Dxe/Mem/Page.c
@@ -1183,6 +1183,13 @@ CoreFindFreePagesI (
       continue;
     }
 
+    //
+    // Don't allocate out of Special-Purpose memory.
+    //
+    if ((Entry->Attribute & EFI_MEMORY_SP) != 0) {
+      continue;
+    }
+
     DescStart = Entry->Start;
     DescEnd   = Entry->End;
 
-- 
2.40.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#119545): https://edk2.groups.io/g/devel/message/119545
Mute This Topic: https://groups.io/mt/106607739/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to