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