[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 03/10] kern/ieee1275/init: ppc64: Return allocated address usi
From: |
Stefan Berger |
Subject: |
[PATCH v8 03/10] kern/ieee1275/init: ppc64: Return allocated address using context |
Date: |
Thu, 30 Nov 2023 09:17:17 -0500 |
Return the allocated address of the memory block in the request structure
if a memory allocation was actually done. Leave the address untouched
otherwise. This enables a caller who wants to use the allocated memory
directly (rather than adding the memory to the heap) to see where memory
was allocated. None of the current callers need this but the converted
ieee1275 loader will make use of it.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.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 | 2 ++
include/grub/ieee1275/alloc.h | 1 +
2 files changed, 3 insertions(+)
diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c
index 8e69da297..4b9face59 100644
--- a/grub-core/kern/ieee1275/init.c
+++ b/grub-core/kern/ieee1275/init.c
@@ -518,6 +518,8 @@ regions_claim (grub_uint64_t addr, grub_uint64_t len,
grub_memory_type_t type,
if (rcr->init_region)
grub_mm_init_region ((void *) (grub_addr_t) addr, len);
rcr->total -= len;
+
+ rcr->addr = addr;
}
*(grub_uint32_t *) data = rcr->total;
diff --git a/include/grub/ieee1275/alloc.h b/include/grub/ieee1275/alloc.h
index 523f51fc6..f3065ff31 100644
--- a/include/grub/ieee1275/alloc.h
+++ b/include/grub/ieee1275/alloc.h
@@ -29,6 +29,7 @@ struct regions_claim_request {
unsigned int flags; /* GRUB_MM_ADD_REGION_(NONE|CONSECUTIVE) */
grub_uint32_t total; /* number of requested bytes */
bool init_region; /* whether to add memory to the heap using
grub_mm_init_region() */
+ grub_uint64_t addr; /* result address */
};
#endif /* GRUB_IEEE1275_ALLOC_HEADER */
--
2.43.0
- [PATCH v8 00/10] ppc64: Restrict memory allocations for kernel and initrd, Stefan Berger, 2023/11/30
- [PATCH v8 04/10] kern/ieee1275/init: ppc64: Add support for alignment requirements, Stefan Berger, 2023/11/30
- [PATCH v8 02/10] kern/ieee1275/init: ppc64: Decide by request whether to initialize region, Stefan Berger, 2023/11/30
- [PATCH v8 06/10] kern/ieee1275/cmain: ppc64: Introduce flags to identify KVM and Power VM, Stefan Berger, 2023/11/30
- [PATCH v8 08/10] kern/ieee1275/ieee1275: debug: Display successful memory claims, Stefan Berger, 2023/11/30
- [PATCH v8 03/10] kern/ieee1275/init: ppc64: Return allocated address using context,
Stefan Berger <=
- [PATCH v8 10/10] kern/ieee1275/init: ppc64: Display upper_mem_limit for debugging, Stefan Berger, 2023/11/30
- [PATCH v8 09/10] kern/ieee1275/init: ppc64: Fix a comment, Stefan Berger, 2023/11/30
- [PATCH v8 07/10] loader/powerpc/ieee1275: Use new allocation function for kernel and initrd, Stefan Berger, 2023/11/30
- [PATCH v8 05/10] kern/ieee1275/init: ppc64: Rename regions_claim to grub_regions_claim, Stefan Berger, 2023/11/30
- [PATCH v8 01/10] kern/ieee1275/init: ppc64: Introduce a request for regions_claim, Stefan Berger, 2023/11/30