[PATCH v2] kexec_file: remove unused arch_kexec_locate_mem_hole hook
Sourabh Jain
sourabhjain at linux.ibm.com
Sat Sep 5 07:58:35 PDT 2026
No architecture provides an implementation of
arch_kexec_locate_mem_hole(). Use kexec_locate_mem_hole() directly
and remove the unused fallback wrapper from the kexec header.
This simplifies the kexec memory allocation path without changing
its behavior. No functional changes intended.
The arch hook was introduced by commit f891f19736bd ("kexec_file: Allow
archs to handle special regions while locating memory hole"), and its
last user was removed by commit 6e5250eaa665 ("powerpc/crash: use
generic APIs to locate memory hole for kdump").
Cc: Albert Ou <aou at eecs.berkeley.edu>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Mike Rapoport <rppt at kernel.org>
Cc: Palmer Dabbelt <palmer at dabbelt.com>
Cc: Pasha Tatashin <pasha.tatashin at soleen.com>
Cc: Paul Walmsley <pjw at kernel.org>
Cc: Pratyush Yadav <pratyush at kernel.org>
Cc: linux-riscv at lists.infradead.org
Cc: kexec at lists.infradead.org
Acked-by: Baoquan He <baoquan.he at linux.dev>
Reviewed-by: Mukesh Pilaniya <mpilaniy at redhat.com>
Signed-off-by: Sourabh Jain <sourabhjain at linux.ibm.com>
---
Changelog:
v1:
https://lore.kernel.org/all/20260827144452.508328-1-sourabhjain@linux.ibm.com/
v2:
- Update the commit references in the commit message to clarify the
history of the arch hook.
---
arch/riscv/kernel/kexec_elf.c | 2 +-
include/linux/kexec.h | 15 ---------------
kernel/kexec_file.c | 2 +-
3 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/arch/riscv/kernel/kexec_elf.c b/arch/riscv/kernel/kexec_elf.c
index 3e9a32acb8f2..ca5abbad59e5 100644
--- a/arch/riscv/kernel/kexec_elf.c
+++ b/arch/riscv/kernel/kexec_elf.c
@@ -91,7 +91,7 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
kbuf.cma = NULL;
kbuf.top_down = false;
- ret = arch_kexec_locate_mem_hole(&kbuf);
+ ret = kexec_locate_mem_hole(&kbuf);
if (!ret) {
*old_pbase = lowest_paddr;
*new_pbase = kbuf.mem;
diff --git a/include/linux/kexec.h b/include/linux/kexec.h
index 0af8ae4fdd08..e5f1cfc11fef 100644
--- a/include/linux/kexec.h
+++ b/include/linux/kexec.h
@@ -259,21 +259,6 @@ int kexec_kernel_verify_pe_sig(const char *kernel, unsigned long kernel_len);
extern int kexec_add_buffer(struct kexec_buf *kbuf);
int kexec_locate_mem_hole(struct kexec_buf *kbuf);
-#ifndef arch_kexec_locate_mem_hole
-/**
- * arch_kexec_locate_mem_hole - Find free memory to place the segments.
- * @kbuf: Parameters for the memory search.
- *
- * On success, kbuf->mem will have the start address of the memory region found.
- *
- * Return: 0 on success, negative errno on error.
- */
-static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf)
-{
- return kexec_locate_mem_hole(kbuf);
-}
-#endif
-
#ifndef arch_kexec_apply_relocations_add
/*
* arch_kexec_apply_relocations_add - apply relocations of type RELA
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 59fb9d71e9d8..9a981359addd 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -784,7 +784,7 @@ int kexec_add_buffer(struct kexec_buf *kbuf)
kbuf->cma = NULL;
/* Walk the RAM ranges and allocate a suitable range for the buffer */
- ret = arch_kexec_locate_mem_hole(kbuf);
+ ret = kexec_locate_mem_hole(kbuf);
if (ret)
return ret;
--
2.55.0
More information about the linux-riscv
mailing list