|
24 | 24 | #include <asm/diag.h>
|
25 | 25 | #include <asm/elf.h>
|
26 | 26 | #include <asm/asm-offsets.h>
|
| 27 | +#include <asm/cacheflush.h> |
27 | 28 | #include <asm/os_info.h>
|
28 | 29 | #include <asm/switch_to.h>
|
29 | 30 |
|
@@ -60,8 +61,6 @@ static int machine_kdump_pm_cb(struct notifier_block *nb, unsigned long action,
|
60 | 61 | static int __init machine_kdump_pm_init(void)
|
61 | 62 | {
|
62 | 63 | pm_notifier(machine_kdump_pm_cb, 0);
|
63 |
| - /* Create initial mapping for crashkernel memory */ |
64 |
| - arch_kexec_unprotect_crashkres(); |
65 | 64 | return 0;
|
66 | 65 | }
|
67 | 66 | arch_initcall(machine_kdump_pm_init);
|
@@ -163,37 +162,27 @@ void crash_free_reserved_phys_range(unsigned long begin, unsigned long end)
|
163 | 162 | os_info_crashkernel_add(0, 0);
|
164 | 163 | }
|
165 | 164 |
|
166 |
| -/* |
167 |
| - * Map or unmap crashkernel memory |
168 |
| - */ |
169 |
| -static void crash_map_pages(int enable) |
| 165 | +static void crash_protect_pages(int protect) |
170 | 166 | {
|
171 |
| - unsigned long size = resource_size(&crashk_res); |
| 167 | + unsigned long size; |
172 | 168 |
|
173 |
| - BUG_ON(crashk_res.start % KEXEC_CRASH_MEM_ALIGN || |
174 |
| - size % KEXEC_CRASH_MEM_ALIGN); |
175 |
| - if (enable) |
176 |
| - vmem_add_mapping(crashk_res.start, size); |
| 169 | + if (!crashk_res.end) |
| 170 | + return; |
| 171 | + size = resource_size(&crashk_res); |
| 172 | + if (protect) |
| 173 | + set_memory_ro(crashk_res.start, size >> PAGE_SHIFT); |
177 | 174 | else
|
178 |
| - vmem_remove_mapping(crashk_res.start, size); |
| 175 | + set_memory_rw(crashk_res.start, size >> PAGE_SHIFT); |
179 | 176 | }
|
180 | 177 |
|
181 |
| -/* |
182 |
| - * Unmap crashkernel memory |
183 |
| - */ |
184 | 178 | void arch_kexec_protect_crashkres(void)
|
185 | 179 | {
|
186 |
| - if (crashk_res.end) |
187 |
| - crash_map_pages(0); |
| 180 | + crash_protect_pages(1); |
188 | 181 | }
|
189 | 182 |
|
190 |
| -/* |
191 |
| - * Map crashkernel memory |
192 |
| - */ |
193 | 183 | void arch_kexec_unprotect_crashkres(void)
|
194 | 184 | {
|
195 |
| - if (crashk_res.end) |
196 |
| - crash_map_pages(1); |
| 185 | + crash_protect_pages(0); |
197 | 186 | }
|
198 | 187 |
|
199 | 188 | #endif
|
|
0 commit comments