Implement alloc_mem_restricted that uses regions_claim() for memory
allocation. The ieee1275 loader will use this function on PowerVM
and PowerKVM and thus avoid usage of memory that it is not allowed
to use.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: Pavithra Prakash <pavrampu@in.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Carolyn Scherrer <cpscherr@us.ibm.com>
Cc: Mahesh Salgaonkar <mahesh@linux.ibm.com>
Cc: Sourabh Jain <sourabhjain@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 542a4c595..6a3532aa7 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -585,6 +585,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 6bfd3d986..14e37908e 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);
+