From: Li Chen Date: Thu, 29 Sep 2022 04:29:35 +0000 (+0800) Subject: kexec: replace crash_mem_range with range X-Git-Tag: v6.6.7~3978^2~54 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cade589fdf697dd4981056c09f83924db8e4e4ed;p=platform%2Fkernel%2Flinux-starfive.git kexec: replace crash_mem_range with range We already have struct range, so just use it. Link: https://lkml.kernel.org/r/20220929042936.22012-4-bhe@redhat.com Signed-off-by: Li Chen Signed-off-by: Baoquan He Acked-by: Baoquan He Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Chen Lifu Cc: "Eric W . Biederman" Cc: Jianglei Nie Cc: Petr Mladek Cc: Russell King Cc: ye xingchen Cc: Zeal Robot Signed-off-by: Andrew Morton --- diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c index 349a781..60e12b7 100644 --- a/arch/powerpc/kexec/file_load_64.c +++ b/arch/powerpc/kexec/file_load_64.c @@ -35,7 +35,7 @@ struct umem_info { /* usable memory ranges to look up */ unsigned int nr_ranges; - const struct crash_mem_range *ranges; + const struct range *ranges; }; const struct kexec_file_ops * const kexec_file_loaders[] = { diff --git a/arch/powerpc/kexec/ranges.c b/arch/powerpc/kexec/ranges.c index 563e998..5fc53a5 100644 --- a/arch/powerpc/kexec/ranges.c +++ b/arch/powerpc/kexec/ranges.c @@ -33,7 +33,7 @@ static inline unsigned int get_max_nr_ranges(size_t size) { return ((size - sizeof(struct crash_mem)) / - sizeof(struct crash_mem_range)); + sizeof(struct range)); } /** @@ -51,7 +51,7 @@ static inline size_t get_mem_rngs_size(struct crash_mem *mem_rngs) return 0; size = (sizeof(struct crash_mem) + - (mem_rngs->max_nr_ranges * sizeof(struct crash_mem_range))); + (mem_rngs->max_nr_ranges * sizeof(struct range))); /* * Memory is allocated in size multiple of MEM_RANGE_CHUNK_SZ. @@ -98,7 +98,7 @@ static int __add_mem_range(struct crash_mem **mem_ranges, u64 base, u64 size) */ static void __merge_memory_ranges(struct crash_mem *mem_rngs) { - struct crash_mem_range *ranges; + struct range *ranges; int i, idx; if (!mem_rngs) @@ -123,7 +123,7 @@ static void __merge_memory_ranges(struct crash_mem *mem_rngs) /* cmp_func_t callback to sort ranges with sort() */ static int rngcmp(const void *_x, const void *_y) { - const struct crash_mem_range *x = _x, *y = _y; + const struct range *x = _x, *y = _y; if (x->start > y->start) return 1; diff --git a/include/linux/kexec.h b/include/linux/kexec.h index 41a6869..5dd4343 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -240,14 +241,10 @@ static inline int arch_kexec_locate_mem_hole(struct kexec_buf *kbuf) /* Alignment required for elf header segment */ #define ELF_CORE_HEADER_ALIGN 4096 -struct crash_mem_range { - u64 start, end; -}; - struct crash_mem { unsigned int max_nr_ranges; unsigned int nr_ranges; - struct crash_mem_range ranges[]; + struct range ranges[]; }; extern int crash_exclude_mem_range(struct crash_mem *mem, diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c index 4563751..dd59830 100644 --- a/kernel/kexec_file.c +++ b/kernel/kexec_file.c @@ -1141,7 +1141,7 @@ int crash_exclude_mem_range(struct crash_mem *mem, { int i, j; unsigned long long start, end, p_start, p_end; - struct crash_mem_range temp_range = {0, 0}; + struct range temp_range = {0, 0}; for (i = 0; i < mem->nr_ranges; i++) { start = mem->ranges[i].start;