Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef LINUX_CRASH_RESERVE_H
3#define LINUX_CRASH_RESERVE_H
4
5#include <linux/linkage.h>
6#include <linux/elfcore.h>
7#include <linux/elf.h>
8#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
9#include <asm/crash_reserve.h>
10#endif
11
12/* Location of a reserved region to hold the crash kernel.
13 */
14extern struct resource crashk_res;
15extern struct resource crashk_low_res;
16extern struct range crashk_cma_ranges[];
17#if defined(CONFIG_CMA) && defined(CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION)
18#define CRASHKERNEL_CMA
19#define CRASHKERNEL_CMA_RANGES_MAX 4
20extern int crashk_cma_cnt;
21#else
22#define crashk_cma_cnt 0
23#define CRASHKERNEL_CMA_RANGES_MAX 0
24#endif
25
26
27int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
28 unsigned long long *crash_size, unsigned long long *crash_base,
29 unsigned long long *low_size, unsigned long long *cma_size,
30 bool *high);
31
32void __init reserve_crashkernel_cma(unsigned long long cma_size);
33
34#ifdef CONFIG_ARCH_HAS_GENERIC_CRASHKERNEL_RESERVATION
35#ifndef arch_add_crash_res_to_iomem
36static inline bool arch_add_crash_res_to_iomem(void)
37{
38 return true;
39}
40#endif
41#ifndef DEFAULT_CRASH_KERNEL_LOW_SIZE
42#define DEFAULT_CRASH_KERNEL_LOW_SIZE (128UL << 20)
43#endif
44#ifndef CRASH_ALIGN
45#define CRASH_ALIGN SZ_2M
46#endif
47#ifndef CRASH_ADDR_LOW_MAX
48#define CRASH_ADDR_LOW_MAX SZ_4G
49#endif
50#ifndef CRASH_ADDR_HIGH_MAX
51#define CRASH_ADDR_HIGH_MAX memblock_end_of_DRAM()
52#endif
53
54void __init reserve_crashkernel_generic(unsigned long long crash_size,
55 unsigned long long crash_base,
56 unsigned long long crash_low_size,
57 bool high);
58#else
59static inline void __init reserve_crashkernel_generic(
60 unsigned long long crash_size,
61 unsigned long long crash_base,
62 unsigned long long crash_low_size,
63 bool high)
64{}
65#endif
66#endif /* LINUX_CRASH_RESERVE_H */