Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
cf13f0ea | 2 | /* |
a53c8fab | 3 | * Copyright IBM Corp. 2005 |
cf13f0ea HC |
4 | * |
5 | * Author(s): Rolf Adelsberger <adelsberger@de.ibm.com> | |
6 | * | |
7 | */ | |
8 | ||
9 | #ifndef _S390_KEXEC_H | |
10 | #define _S390_KEXEC_H | |
11 | ||
3e35142e NR |
12 | #include <linux/module.h> |
13 | ||
cf13f0ea | 14 | #include <asm/processor.h> |
da477737 | 15 | #include <asm/page.h> |
d0d249d7 | 16 | #include <asm/setup.h> |
cf13f0ea HC |
17 | /* |
18 | * KEXEC_SOURCE_MEMORY_LIMIT maximum page get_free_page can return. | |
19 | * I.e. Maximum page that is mapped directly into kernel memory, | |
20 | * and kmap is not required. | |
21 | */ | |
22 | ||
23 | /* Maximum physical address we can use pages from */ | |
24 | #define KEXEC_SOURCE_MEMORY_LIMIT (-1UL) | |
25 | ||
26 | /* Maximum address we can reach in physical address mode */ | |
27 | #define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL) | |
28 | ||
29 | /* Maximum address we can use for the control pages */ | |
30 | /* Not more than 2GB */ | |
a1a392f0 | 31 | #define KEXEC_CONTROL_MEMORY_LIMIT (1UL<<31) |
cf13f0ea | 32 | |
7e01b5ac | 33 | /* Allocate control page with GFP_DMA */ |
9dade170 | 34 | #define KEXEC_CONTROL_MEMORY_GFP (GFP_DMA | __GFP_NORETRY) |
7e01b5ac | 35 | |
60a0c68d MH |
36 | /* Maximum address we can use for the crash control pages */ |
37 | #define KEXEC_CRASH_CONTROL_MEMORY_LIMIT (-1UL) | |
38 | ||
cf13f0ea | 39 | /* Allocate one page for the pdp and the second for the code */ |
163f6876 | 40 | #define KEXEC_CONTROL_PAGE_SIZE 4096 |
cf13f0ea | 41 | |
dab7a7b1 MH |
42 | /* Alignment of crashkernel memory */ |
43 | #define KEXEC_CRASH_MEM_ALIGN HPAGE_SIZE | |
44 | ||
cf13f0ea HC |
45 | /* The native architecture */ |
46 | #define KEXEC_ARCH KEXEC_ARCH_S390 | |
47 | ||
653beba2 PR |
48 | /* Allow kexec_file to load a segment to 0 */ |
49 | #define KEXEC_BUF_MEM_UNKNOWN -1 | |
50 | ||
bf208305 | 51 | /* Provide a dummy definition to avoid build failures. */ |
52 | static inline void crash_setup_regs(struct pt_regs *newregs, | |
53 | struct pt_regs *oldregs) { } | |
54 | ||
e49bb0a2 PR |
55 | struct kimage; |
56 | struct s390_load_data { | |
57 | /* Pointer to the kernel buffer. Used to register cmdline etc.. */ | |
58 | void *kernel_buf; | |
59 | ||
653beba2 PR |
60 | /* Load address of the kernel_buf. */ |
61 | unsigned long kernel_mem; | |
62 | ||
d0d249d7 PR |
63 | /* Parmarea in the kernel buffer. */ |
64 | struct parmarea *parm; | |
65 | ||
e49bb0a2 PR |
66 | /* Total size of loaded segments in memory. Used as an offset. */ |
67 | size_t memsz; | |
99feaa71 PR |
68 | |
69 | struct ipl_report *report; | |
e49bb0a2 PR |
70 | }; |
71 | ||
e23a8020 | 72 | int s390_verify_sig(const char *kernel, unsigned long kernel_len); |
8e496426 PR |
73 | void *kexec_file_add_components(struct kimage *image, |
74 | int (*add_kernel)(struct kimage *image, | |
75 | struct s390_load_data *data)); | |
805bc0bc GS |
76 | int arch_kexec_do_relocs(int r_type, void *loc, unsigned long val, |
77 | unsigned long addr); | |
e49bb0a2 | 78 | |
4aa93405 BH |
79 | #define ARCH_HAS_KIMAGE_ARCH |
80 | ||
81 | struct kimage_arch { | |
82 | void *ipl_buf; | |
83 | }; | |
84 | ||
e49bb0a2 | 85 | extern const struct kexec_file_ops s390_kexec_image_ops; |
8be01882 | 86 | extern const struct kexec_file_ops s390_kexec_elf_ops; |
e49bb0a2 | 87 | |
0738eceb NR |
88 | #ifdef CONFIG_CRASH_DUMP |
89 | void crash_free_reserved_phys_range(unsigned long begin, unsigned long end); | |
90 | #define crash_free_reserved_phys_range crash_free_reserved_phys_range | |
91 | ||
92 | void arch_kexec_protect_crashkres(void); | |
93 | #define arch_kexec_protect_crashkres arch_kexec_protect_crashkres | |
94 | ||
95 | void arch_kexec_unprotect_crashkres(void); | |
96 | #define arch_kexec_unprotect_crashkres arch_kexec_unprotect_crashkres | |
82a0fcb1 DH |
97 | |
98 | bool is_kdump_kernel(void); | |
99 | #define is_kdump_kernel is_kdump_kernel | |
0738eceb NR |
100 | #endif |
101 | ||
3e35142e NR |
102 | #ifdef CONFIG_KEXEC_FILE |
103 | struct purgatory_info; | |
104 | int arch_kexec_apply_relocations_add(struct purgatory_info *pi, | |
105 | Elf_Shdr *section, | |
106 | const Elf_Shdr *relsec, | |
107 | const Elf_Shdr *symtab); | |
108 | #define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add | |
65d9a9a6 NR |
109 | |
110 | int arch_kimage_file_post_load_cleanup(struct kimage *image); | |
111 | #define arch_kimage_file_post_load_cleanup arch_kimage_file_post_load_cleanup | |
3e35142e | 112 | #endif |
cf13f0ea | 113 | #endif /*_S390_KEXEC_H */ |