Implement alloc_mem_restricted that restricts the allocation of memory
for PowerVM and PowerKVM to honor the 640-768MB gap as well as memory
restrictions when an fadump is present.

Signed-off-by: Stefan Berger <stef...@linux.ibm.com>
Cc: Hari Bathini <hbath...@linux.ibm.com>
Cc: Pavithra Prakash <pavra...@in.ibm.com>
Cc: Michael Ellerman <m...@ellerman.id.au>
Cc: Carolyn Scherrer <cpsch...@us.ibm.com>
Cc: Mahesh Salgaonkar <mah...@linux.ibm.com>
Cc: Sourabh Jain <sourabhj...@linux.ibm.com>
---
 grub-core/kern/ieee1275/init.c        | 7 +++++++
 include/grub/powerpc/ieee1275/alloc.h | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index 5414f659c..9c0e965d4 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -581,6 +581,13 @@ region_claim (grub_uint64_t addr, grub_uint64_t len, 
grub_memory_type_t type,
   return ret;
 }
 
+int
+alloc_mem_restricted (grub_uint64_t addr, grub_uint64_t len, 
grub_memory_type_t type,
+                      void *ctx)
+{
+  return regions_claim (addr, len, type, ctx);
+}
+
 static grub_err_t
 grub_ieee1275_mm_add_region (grub_size_t size, unsigned int flags)
 {
diff --git a/include/grub/powerpc/ieee1275/alloc.h 
b/include/grub/powerpc/ieee1275/alloc.h
index b3d14f095..aeba7781e 100644
--- a/include/grub/powerpc/ieee1275/alloc.h
+++ b/include/grub/powerpc/ieee1275/alloc.h
@@ -14,4 +14,7 @@ struct regions_claim_request {
   grub_size_t align;      /* alignment restrictions */
 };
 
+int EXPORT_FUNC(alloc_mem_restricted) (grub_uint64_t addr, grub_uint64_t len,
+                                       grub_memory_type_t type, void *ctx);
+
 #endif /* GRUB_POWERPC_IEEE1275_ALLOC_HEADER */
-- 
2.25.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to