Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 2 | /* |
| 3 | * kexec for arm64 |
| 4 | * |
| 5 | * Copyright (C) Linaro. |
| 6 | * Copyright (C) Huawei Futurewei Technologies. |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
AKASHI Takahiro | 78fd584 | 2017-04-03 11:24:36 +0900 | [diff] [blame] | 9 | #include <linux/interrupt.h> |
| 10 | #include <linux/irq.h> |
| 11 | #include <linux/kernel.h> |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 12 | #include <linux/kexec.h> |
AKASHI Takahiro | 254a41c | 2017-04-03 11:24:35 +0900 | [diff] [blame] | 13 | #include <linux/page-flags.h> |
Mike Rapoport | 6d47c23 | 2021-07-07 18:07:59 -0700 | [diff] [blame] | 14 | #include <linux/set_memory.h> |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 15 | #include <linux/smp.h> |
| 16 | |
| 17 | #include <asm/cacheflush.h> |
| 18 | #include <asm/cpu_ops.h> |
James Morse | 0fbeb31 | 2017-11-02 12:12:34 +0000 | [diff] [blame] | 19 | #include <asm/daifflags.h> |
AKASHI Takahiro | 20a1662 | 2017-04-03 11:24:37 +0900 | [diff] [blame] | 20 | #include <asm/memory.h> |
Takahiro Akashi | 98d2e15 | 2017-04-03 11:24:34 +0900 | [diff] [blame] | 21 | #include <asm/mmu.h> |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 22 | #include <asm/mmu_context.h> |
Takahiro Akashi | 98d2e15 | 2017-04-03 11:24:34 +0900 | [diff] [blame] | 23 | #include <asm/page.h> |
Pasha Tatashin | 19a046f | 2021-09-30 14:31:08 +0000 | [diff] [blame] | 24 | #include <asm/sections.h> |
Pasha Tatashin | 08eae0e | 2021-09-30 14:31:06 +0000 | [diff] [blame] | 25 | #include <asm/trans_pgd.h> |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 26 | |
Geoff Levand | 221f2c7 | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 27 | /** |
| 28 | * kexec_image_info - For debugging output. |
| 29 | */ |
| 30 | #define kexec_image_info(_i) _kexec_image_info(__func__, __LINE__, _i) |
| 31 | static void _kexec_image_info(const char *func, int line, |
| 32 | const struct kimage *kimage) |
| 33 | { |
| 34 | unsigned long i; |
| 35 | |
| 36 | pr_debug("%s:%d:\n", func, line); |
| 37 | pr_debug(" kexec kimage info:\n"); |
| 38 | pr_debug(" type: %d\n", kimage->type); |
| 39 | pr_debug(" start: %lx\n", kimage->start); |
| 40 | pr_debug(" head: %lx\n", kimage->head); |
| 41 | pr_debug(" nr_segments: %lu\n", kimage->nr_segments); |
Pasha Tatashin | 08eae0e | 2021-09-30 14:31:06 +0000 | [diff] [blame] | 42 | pr_debug(" dtb_mem: %pa\n", &kimage->arch.dtb_mem); |
Pavel Tatashin | 4c3c312 | 2021-01-25 14:19:14 -0500 | [diff] [blame] | 43 | pr_debug(" kern_reloc: %pa\n", &kimage->arch.kern_reloc); |
Pasha Tatashin | 08eae0e | 2021-09-30 14:31:06 +0000 | [diff] [blame] | 44 | pr_debug(" el2_vectors: %pa\n", &kimage->arch.el2_vectors); |
Geoff Levand | 221f2c7 | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 45 | |
| 46 | for (i = 0; i < kimage->nr_segments; i++) { |
| 47 | pr_debug(" segment[%lu]: %016lx - %016lx, 0x%lx bytes, %lu pages\n", |
| 48 | i, |
| 49 | kimage->segment[i].mem, |
| 50 | kimage->segment[i].mem + kimage->segment[i].memsz, |
| 51 | kimage->segment[i].memsz, |
| 52 | kimage->segment[i].memsz / PAGE_SIZE); |
| 53 | } |
| 54 | } |
| 55 | |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 56 | void machine_kexec_cleanup(struct kimage *kimage) |
| 57 | { |
| 58 | /* Empty routine needed to avoid build errors. */ |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * machine_kexec_prepare - Prepare for a kexec reboot. |
| 63 | * |
| 64 | * Called from the core kexec code when a kernel image is loaded. |
| 65 | * Forbid loading a kexec kernel if we have no way of hotplugging cpus or cpus |
| 66 | * are stuck in the kernel. This avoids a panic once we hit machine_kexec(). |
| 67 | */ |
| 68 | int machine_kexec_prepare(struct kimage *kimage) |
| 69 | { |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 70 | if (kimage->type != KEXEC_TYPE_CRASH && cpus_are_stuck_in_kernel()) { |
| 71 | pr_err("Can't kexec: CPUs are stuck in the kernel.\n"); |
| 72 | return -EBUSY; |
| 73 | } |
| 74 | |
| 75 | return 0; |
| 76 | } |
| 77 | |
| 78 | /** |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 79 | * kexec_segment_flush - Helper to flush the kimage segments to PoC. |
| 80 | */ |
| 81 | static void kexec_segment_flush(const struct kimage *kimage) |
| 82 | { |
| 83 | unsigned long i; |
| 84 | |
| 85 | pr_debug("%s:\n", __func__); |
| 86 | |
| 87 | for (i = 0; i < kimage->nr_segments; i++) { |
| 88 | pr_debug(" segment[%lu]: %016lx - %016lx, 0x%lx bytes, %lu pages\n", |
| 89 | i, |
| 90 | kimage->segment[i].mem, |
| 91 | kimage->segment[i].mem + kimage->segment[i].memsz, |
| 92 | kimage->segment[i].memsz, |
| 93 | kimage->segment[i].memsz / PAGE_SIZE); |
| 94 | |
Fuad Tabba | fade9c2 | 2021-05-24 09:30:01 +0100 | [diff] [blame] | 95 | dcache_clean_inval_poc( |
Fuad Tabba | 814b186 | 2021-05-24 09:29:55 +0100 | [diff] [blame] | 96 | (unsigned long)phys_to_virt(kimage->segment[i].mem), |
| 97 | (unsigned long)phys_to_virt(kimage->segment[i].mem) + |
| 98 | kimage->segment[i].memsz); |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 99 | } |
| 100 | } |
| 101 | |
Pasha Tatashin | 08eae0e | 2021-09-30 14:31:06 +0000 | [diff] [blame] | 102 | /* Allocates pages for kexec page table */ |
| 103 | static void *kexec_page_alloc(void *arg) |
| 104 | { |
| 105 | struct kimage *kimage = (struct kimage *)arg; |
| 106 | struct page *page = kimage_alloc_control_pages(kimage, 0); |
| 107 | |
| 108 | if (!page) |
| 109 | return NULL; |
| 110 | |
| 111 | memset(page_address(page), 0, PAGE_SIZE); |
| 112 | |
| 113 | return page_address(page); |
| 114 | } |
| 115 | |
Pasha Tatashin | 0d8732e | 2021-09-30 14:31:02 +0000 | [diff] [blame] | 116 | int machine_kexec_post_load(struct kimage *kimage) |
| 117 | { |
Pasha Tatashin | 3744b52 | 2021-09-30 14:31:09 +0000 | [diff] [blame] | 118 | int rc; |
| 119 | pgd_t *trans_pgd; |
Pasha Tatashin | 0d8732e | 2021-09-30 14:31:02 +0000 | [diff] [blame] | 120 | void *reloc_code = page_to_virt(kimage->control_code_page); |
Pasha Tatashin | 19a046f | 2021-09-30 14:31:08 +0000 | [diff] [blame] | 121 | long reloc_size; |
Pasha Tatashin | 08eae0e | 2021-09-30 14:31:06 +0000 | [diff] [blame] | 122 | struct trans_pgd_info info = { |
| 123 | .trans_alloc_page = kexec_page_alloc, |
| 124 | .trans_alloc_arg = kimage, |
| 125 | }; |
Pasha Tatashin | 0d8732e | 2021-09-30 14:31:02 +0000 | [diff] [blame] | 126 | |
Pasha Tatashin | 5bb6834 | 2021-09-30 14:31:03 +0000 | [diff] [blame] | 127 | /* If in place, relocation is not used, only flush next kernel */ |
| 128 | if (kimage->head & IND_DONE) { |
Pasha Tatashin | 0d8732e | 2021-09-30 14:31:02 +0000 | [diff] [blame] | 129 | kexec_segment_flush(kimage); |
Pasha Tatashin | 5bb6834 | 2021-09-30 14:31:03 +0000 | [diff] [blame] | 130 | kexec_image_info(kimage); |
| 131 | return 0; |
| 132 | } |
Pasha Tatashin | 0d8732e | 2021-09-30 14:31:02 +0000 | [diff] [blame] | 133 | |
Pasha Tatashin | 08eae0e | 2021-09-30 14:31:06 +0000 | [diff] [blame] | 134 | kimage->arch.el2_vectors = 0; |
| 135 | if (is_hyp_nvhe()) { |
Pasha Tatashin | 3744b52 | 2021-09-30 14:31:09 +0000 | [diff] [blame] | 136 | rc = trans_pgd_copy_el2_vectors(&info, |
| 137 | &kimage->arch.el2_vectors); |
Pasha Tatashin | 08eae0e | 2021-09-30 14:31:06 +0000 | [diff] [blame] | 138 | if (rc) |
| 139 | return rc; |
| 140 | } |
| 141 | |
Pasha Tatashin | 3744b52 | 2021-09-30 14:31:09 +0000 | [diff] [blame] | 142 | /* Create a copy of the linear map */ |
| 143 | trans_pgd = kexec_page_alloc(kimage); |
| 144 | if (!trans_pgd) |
| 145 | return -ENOMEM; |
| 146 | rc = trans_pgd_create_copy(&info, &trans_pgd, PAGE_OFFSET, PAGE_END); |
| 147 | if (rc) |
| 148 | return rc; |
| 149 | kimage->arch.ttbr1 = __pa(trans_pgd); |
| 150 | kimage->arch.zero_page = __pa(empty_zero_page); |
| 151 | |
Pasha Tatashin | 19a046f | 2021-09-30 14:31:08 +0000 | [diff] [blame] | 152 | reloc_size = __relocate_new_kernel_end - __relocate_new_kernel_start; |
| 153 | memcpy(reloc_code, __relocate_new_kernel_start, reloc_size); |
Pasha Tatashin | 0d8732e | 2021-09-30 14:31:02 +0000 | [diff] [blame] | 154 | kimage->arch.kern_reloc = __pa(reloc_code); |
Pasha Tatashin | efc2d0f | 2021-09-30 14:31:10 +0000 | [diff] [blame] | 155 | rc = trans_pgd_idmap_page(&info, &kimage->arch.ttbr0, |
| 156 | &kimage->arch.t0sz, reloc_code); |
| 157 | if (rc) |
| 158 | return rc; |
| 159 | kimage->arch.phys_offset = virt_to_phys(kimage) - (long)kimage; |
Pasha Tatashin | 0d8732e | 2021-09-30 14:31:02 +0000 | [diff] [blame] | 160 | |
| 161 | /* Flush the reloc_code in preparation for its execution. */ |
| 162 | dcache_clean_inval_poc((unsigned long)reloc_code, |
Pasha Tatashin | 19a046f | 2021-09-30 14:31:08 +0000 | [diff] [blame] | 163 | (unsigned long)reloc_code + reloc_size); |
Pasha Tatashin | 0d8732e | 2021-09-30 14:31:02 +0000 | [diff] [blame] | 164 | icache_inval_pou((uintptr_t)reloc_code, |
Pasha Tatashin | 19a046f | 2021-09-30 14:31:08 +0000 | [diff] [blame] | 165 | (uintptr_t)reloc_code + reloc_size); |
Pasha Tatashin | 5bb6834 | 2021-09-30 14:31:03 +0000 | [diff] [blame] | 166 | kexec_image_info(kimage); |
Pasha Tatashin | 0d8732e | 2021-09-30 14:31:02 +0000 | [diff] [blame] | 167 | |
| 168 | return 0; |
| 169 | } |
| 170 | |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 171 | /** |
| 172 | * machine_kexec - Do the kexec reboot. |
| 173 | * |
| 174 | * Called from the core kexec code for a sys_reboot with LINUX_REBOOT_CMD_KEXEC. |
| 175 | */ |
| 176 | void machine_kexec(struct kimage *kimage) |
| 177 | { |
AKASHI Takahiro | 78fd584 | 2017-04-03 11:24:36 +0900 | [diff] [blame] | 178 | bool in_kexec_crash = (kimage == kexec_crash_image); |
| 179 | bool stuck_cpus = cpus_are_stuck_in_kernel(); |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 180 | |
| 181 | /* |
| 182 | * New cpus may have become stuck_in_kernel after we loaded the image. |
| 183 | */ |
AKASHI Takahiro | 78fd584 | 2017-04-03 11:24:36 +0900 | [diff] [blame] | 184 | BUG_ON(!in_kexec_crash && (stuck_cpus || (num_online_cpus() > 1))); |
| 185 | WARN(in_kexec_crash && (stuck_cpus || smp_crash_stop_failed()), |
| 186 | "Some CPUs may be stale, kdump will be unreliable.\n"); |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 187 | |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 188 | pr_info("Bye!\n"); |
| 189 | |
James Morse | 0fbeb31 | 2017-11-02 12:12:34 +0000 | [diff] [blame] | 190 | local_daif_mask(); |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 191 | |
| 192 | /* |
Pasha Tatashin | efc2d0f | 2021-09-30 14:31:10 +0000 | [diff] [blame] | 193 | * Both restart and kernel_reloc will shutdown the MMU, disable data |
Pasha Tatashin | 5bb6834 | 2021-09-30 14:31:03 +0000 | [diff] [blame] | 194 | * caches. However, restart will start new kernel or purgatory directly, |
Pasha Tatashin | efc2d0f | 2021-09-30 14:31:10 +0000 | [diff] [blame] | 195 | * kernel_reloc contains the body of arm64_relocate_new_kernel |
AKASHI Takahiro | 4c9e7e6 | 2018-11-15 14:52:52 +0900 | [diff] [blame] | 196 | * In kexec case, kimage->start points to purgatory assuming that |
| 197 | * kernel entry and dtb address are embedded in purgatory by |
| 198 | * userspace (kexec-tools). |
| 199 | * In kexec_file case, the kernel starts directly without purgatory. |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 200 | */ |
Pasha Tatashin | 5bb6834 | 2021-09-30 14:31:03 +0000 | [diff] [blame] | 201 | if (kimage->head & IND_DONE) { |
Pasha Tatashin | 7a2512f | 2021-09-30 14:31:12 +0000 | [diff] [blame] | 202 | typeof(cpu_soft_restart) *restart; |
Pasha Tatashin | 5bb6834 | 2021-09-30 14:31:03 +0000 | [diff] [blame] | 203 | |
| 204 | cpu_install_idmap(); |
Pasha Tatashin | 7a2512f | 2021-09-30 14:31:12 +0000 | [diff] [blame] | 205 | restart = (void *)__pa_symbol(function_nocfi(cpu_soft_restart)); |
Pasha Tatashin | 5bb6834 | 2021-09-30 14:31:03 +0000 | [diff] [blame] | 206 | restart(is_hyp_nvhe(), kimage->start, kimage->arch.dtb_mem, |
| 207 | 0, 0); |
| 208 | } else { |
Pasha Tatashin | efc2d0f | 2021-09-30 14:31:10 +0000 | [diff] [blame] | 209 | void (*kernel_reloc)(struct kimage *kimage); |
| 210 | |
Pasha Tatashin | 08eae0e | 2021-09-30 14:31:06 +0000 | [diff] [blame] | 211 | if (is_hyp_nvhe()) |
| 212 | __hyp_set_vectors(kimage->arch.el2_vectors); |
Pasha Tatashin | efc2d0f | 2021-09-30 14:31:10 +0000 | [diff] [blame] | 213 | cpu_install_ttbr0(kimage->arch.ttbr0, kimage->arch.t0sz); |
| 214 | kernel_reloc = (void *)kimage->arch.kern_reloc; |
| 215 | kernel_reloc(kimage); |
Pasha Tatashin | 5bb6834 | 2021-09-30 14:31:03 +0000 | [diff] [blame] | 216 | } |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 217 | |
| 218 | BUG(); /* Should never get here. */ |
| 219 | } |
| 220 | |
AKASHI Takahiro | 78fd584 | 2017-04-03 11:24:36 +0900 | [diff] [blame] | 221 | static void machine_kexec_mask_interrupts(void) |
| 222 | { |
| 223 | unsigned int i; |
| 224 | struct irq_desc *desc; |
| 225 | |
| 226 | for_each_irq_desc(i, desc) { |
| 227 | struct irq_chip *chip; |
| 228 | int ret; |
| 229 | |
| 230 | chip = irq_desc_get_chip(desc); |
| 231 | if (!chip) |
| 232 | continue; |
| 233 | |
| 234 | /* |
| 235 | * First try to remove the active state. If this |
| 236 | * fails, try to EOI the interrupt. |
| 237 | */ |
| 238 | ret = irq_set_irqchip_state(i, IRQCHIP_STATE_ACTIVE, false); |
| 239 | |
| 240 | if (ret && irqd_irq_inprogress(&desc->irq_data) && |
| 241 | chip->irq_eoi) |
| 242 | chip->irq_eoi(&desc->irq_data); |
| 243 | |
| 244 | if (chip->irq_mask) |
| 245 | chip->irq_mask(&desc->irq_data); |
| 246 | |
| 247 | if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data)) |
| 248 | chip->irq_disable(&desc->irq_data); |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * machine_crash_shutdown - shutdown non-crashing cpus and save registers |
| 254 | */ |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 255 | void machine_crash_shutdown(struct pt_regs *regs) |
| 256 | { |
AKASHI Takahiro | 78fd584 | 2017-04-03 11:24:36 +0900 | [diff] [blame] | 257 | local_irq_disable(); |
| 258 | |
| 259 | /* shutdown non-crashing cpus */ |
Hoeun Ryu | a88ce63 | 2017-08-17 11:24:27 +0900 | [diff] [blame] | 260 | crash_smp_send_stop(); |
AKASHI Takahiro | 78fd584 | 2017-04-03 11:24:36 +0900 | [diff] [blame] | 261 | |
| 262 | /* for crashing cpu */ |
| 263 | crash_save_cpu(regs, smp_processor_id()); |
| 264 | machine_kexec_mask_interrupts(); |
| 265 | |
| 266 | pr_info("Starting crashdump kernel...\n"); |
Geoff Levand | d28f6df | 2016-06-23 17:54:48 +0000 | [diff] [blame] | 267 | } |
Takahiro Akashi | 98d2e15 | 2017-04-03 11:24:34 +0900 | [diff] [blame] | 268 | |
| 269 | void arch_kexec_protect_crashkres(void) |
| 270 | { |
| 271 | int i; |
| 272 | |
Takahiro Akashi | 98d2e15 | 2017-04-03 11:24:34 +0900 | [diff] [blame] | 273 | for (i = 0; i < kexec_crash_image->nr_segments; i++) |
| 274 | set_memory_valid( |
| 275 | __phys_to_virt(kexec_crash_image->segment[i].mem), |
| 276 | kexec_crash_image->segment[i].memsz >> PAGE_SHIFT, 0); |
| 277 | } |
| 278 | |
| 279 | void arch_kexec_unprotect_crashkres(void) |
| 280 | { |
| 281 | int i; |
| 282 | |
| 283 | for (i = 0; i < kexec_crash_image->nr_segments; i++) |
| 284 | set_memory_valid( |
| 285 | __phys_to_virt(kexec_crash_image->segment[i].mem), |
| 286 | kexec_crash_image->segment[i].memsz >> PAGE_SHIFT, 1); |
| 287 | } |
AKASHI Takahiro | 254a41c | 2017-04-03 11:24:35 +0900 | [diff] [blame] | 288 | |
| 289 | #ifdef CONFIG_HIBERNATION |
| 290 | /* |
| 291 | * To preserve the crash dump kernel image, the relevant memory segments |
| 292 | * should be mapped again around the hibernation. |
| 293 | */ |
| 294 | void crash_prepare_suspend(void) |
| 295 | { |
| 296 | if (kexec_crash_image) |
| 297 | arch_kexec_unprotect_crashkres(); |
| 298 | } |
| 299 | |
| 300 | void crash_post_resume(void) |
| 301 | { |
| 302 | if (kexec_crash_image) |
| 303 | arch_kexec_protect_crashkres(); |
| 304 | } |
| 305 | |
| 306 | /* |
| 307 | * crash_is_nosave |
| 308 | * |
| 309 | * Return true only if a page is part of reserved memory for crash dump kernel, |
| 310 | * but does not hold any data of loaded kernel image. |
| 311 | * |
| 312 | * Note that all the pages in crash dump kernel memory have been initially |
David Hildenbrand | d9fa9d9 | 2019-03-05 15:47:28 -0800 | [diff] [blame] | 313 | * marked as Reserved as memory was allocated via memblock_reserve(). |
AKASHI Takahiro | 254a41c | 2017-04-03 11:24:35 +0900 | [diff] [blame] | 314 | * |
| 315 | * In hibernation, the pages which are Reserved and yet "nosave" are excluded |
| 316 | * from the hibernation iamge. crash_is_nosave() does thich check for crash |
| 317 | * dump kernel and will reduce the total size of hibernation image. |
| 318 | */ |
| 319 | |
| 320 | bool crash_is_nosave(unsigned long pfn) |
| 321 | { |
| 322 | int i; |
| 323 | phys_addr_t addr; |
| 324 | |
| 325 | if (!crashk_res.end) |
| 326 | return false; |
| 327 | |
| 328 | /* in reserved memory? */ |
| 329 | addr = __pfn_to_phys(pfn); |
| 330 | if ((addr < crashk_res.start) || (crashk_res.end < addr)) |
| 331 | return false; |
| 332 | |
| 333 | if (!kexec_crash_image) |
| 334 | return true; |
| 335 | |
| 336 | /* not part of loaded kernel image? */ |
| 337 | for (i = 0; i < kexec_crash_image->nr_segments; i++) |
| 338 | if (addr >= kexec_crash_image->segment[i].mem && |
| 339 | addr < (kexec_crash_image->segment[i].mem + |
| 340 | kexec_crash_image->segment[i].memsz)) |
| 341 | return false; |
| 342 | |
| 343 | return true; |
| 344 | } |
| 345 | |
| 346 | void crash_free_reserved_phys_range(unsigned long begin, unsigned long end) |
| 347 | { |
| 348 | unsigned long addr; |
| 349 | struct page *page; |
| 350 | |
| 351 | for (addr = begin; addr < end; addr += PAGE_SIZE) { |
| 352 | page = phys_to_page(addr); |
AKASHI Takahiro | 254a41c | 2017-04-03 11:24:35 +0900 | [diff] [blame] | 353 | free_reserved_page(page); |
| 354 | } |
| 355 | } |
| 356 | #endif /* CONFIG_HIBERNATION */ |