On 11/10/23 08:09, Hari Bathini wrote:
On 31/10/23 11:20 pm, Stefan Berger wrote:
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 <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 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);
+
Why not export regions_claim() itself instead of introducing this
new function?
Something needs to be exported and I wanted all callers to
regions_claim() to be local to init.c. So, I exported the new function.
Thanks
Hari
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel