• Home
  • Raw
  • Download

Lines Matching refs:image

145 static struct page *kimage_alloc_page(struct kimage *image,
149 int sanity_check_segment_list(struct kimage *image) in sanity_check_segment_list() argument
152 unsigned long nr_segments = image->nr_segments; in sanity_check_segment_list()
172 mstart = image->segment[i].mem; in sanity_check_segment_list()
173 mend = mstart + image->segment[i].memsz; in sanity_check_segment_list()
191 mstart = image->segment[i].mem; in sanity_check_segment_list()
192 mend = mstart + image->segment[i].memsz; in sanity_check_segment_list()
196 pstart = image->segment[j].mem; in sanity_check_segment_list()
197 pend = pstart + image->segment[j].memsz; in sanity_check_segment_list()
210 if (image->segment[i].bufsz > image->segment[i].memsz) in sanity_check_segment_list()
220 if (PAGE_COUNT(image->segment[i].memsz) > nr_pages / 2) in sanity_check_segment_list()
223 total_pages += PAGE_COUNT(image->segment[i].memsz); in sanity_check_segment_list()
239 if (image->type == KEXEC_TYPE_CRASH) { in sanity_check_segment_list()
243 mstart = image->segment[i].mem; in sanity_check_segment_list()
244 mend = mstart + image->segment[i].memsz - 1; in sanity_check_segment_list()
257 struct kimage *image; in do_kimage_alloc_init() local
260 image = kzalloc(sizeof(*image), GFP_KERNEL); in do_kimage_alloc_init()
261 if (!image) in do_kimage_alloc_init()
264 image->head = 0; in do_kimage_alloc_init()
265 image->entry = &image->head; in do_kimage_alloc_init()
266 image->last_entry = &image->head; in do_kimage_alloc_init()
267 image->control_page = ~0; /* By default this does not apply */ in do_kimage_alloc_init()
268 image->type = KEXEC_TYPE_DEFAULT; in do_kimage_alloc_init()
271 INIT_LIST_HEAD(&image->control_pages); in do_kimage_alloc_init()
274 INIT_LIST_HEAD(&image->dest_pages); in do_kimage_alloc_init()
277 INIT_LIST_HEAD(&image->unusable_pages); in do_kimage_alloc_init()
279 return image; in do_kimage_alloc_init()
282 int kimage_is_destination_range(struct kimage *image, in kimage_is_destination_range() argument
288 for (i = 0; i < image->nr_segments; i++) { in kimage_is_destination_range()
291 mstart = image->segment[i].mem; in kimage_is_destination_range()
292 mend = mstart + image->segment[i].memsz; in kimage_is_destination_range()
351 static struct page *kimage_alloc_normal_control_pages(struct kimage *image, in kimage_alloc_normal_control_pages() argument
388 kimage_is_destination_range(image, addr, eaddr)) { in kimage_alloc_normal_control_pages()
396 list_add(&pages->lru, &image->control_pages); in kimage_alloc_normal_control_pages()
417 static struct page *kimage_alloc_crash_control_pages(struct kimage *image, in kimage_alloc_crash_control_pages() argument
446 hole_start = (image->control_page + (size - 1)) & ~(size - 1); in kimage_alloc_crash_control_pages()
456 for (i = 0; i < image->nr_segments; i++) { in kimage_alloc_crash_control_pages()
459 mstart = image->segment[i].mem; in kimage_alloc_crash_control_pages()
460 mend = mstart + image->segment[i].memsz - 1; in kimage_alloc_crash_control_pages()
469 if (i == image->nr_segments) { in kimage_alloc_crash_control_pages()
471 image->control_page = hole_end; in kimage_alloc_crash_control_pages()
484 struct page *kimage_alloc_control_pages(struct kimage *image, in kimage_alloc_control_pages() argument
489 switch (image->type) { in kimage_alloc_control_pages()
491 pages = kimage_alloc_normal_control_pages(image, order); in kimage_alloc_control_pages()
494 pages = kimage_alloc_crash_control_pages(image, order); in kimage_alloc_control_pages()
501 int kimage_crash_copy_vmcoreinfo(struct kimage *image) in kimage_crash_copy_vmcoreinfo() argument
506 if (image->type != KEXEC_TYPE_CRASH) in kimage_crash_copy_vmcoreinfo()
518 vmcoreinfo_page = kimage_alloc_control_pages(image, 0); in kimage_crash_copy_vmcoreinfo()
529 image->vmcoreinfo_data_copy = safecopy; in kimage_crash_copy_vmcoreinfo()
535 static int kimage_add_entry(struct kimage *image, kimage_entry_t entry) in kimage_add_entry() argument
537 if (*image->entry != 0) in kimage_add_entry()
538 image->entry++; in kimage_add_entry()
540 if (image->entry == image->last_entry) { in kimage_add_entry()
544 page = kimage_alloc_page(image, GFP_KERNEL, KIMAGE_NO_DEST); in kimage_add_entry()
549 *image->entry = virt_to_boot_phys(ind_page) | IND_INDIRECTION; in kimage_add_entry()
550 image->entry = ind_page; in kimage_add_entry()
551 image->last_entry = ind_page + in kimage_add_entry()
554 *image->entry = entry; in kimage_add_entry()
555 image->entry++; in kimage_add_entry()
556 *image->entry = 0; in kimage_add_entry()
561 static int kimage_set_destination(struct kimage *image, in kimage_set_destination() argument
567 result = kimage_add_entry(image, destination | IND_DESTINATION); in kimage_set_destination()
573 static int kimage_add_page(struct kimage *image, unsigned long page) in kimage_add_page() argument
578 result = kimage_add_entry(image, page | IND_SOURCE); in kimage_add_page()
584 static void kimage_free_extra_pages(struct kimage *image) in kimage_free_extra_pages() argument
587 kimage_free_page_list(&image->dest_pages); in kimage_free_extra_pages()
590 kimage_free_page_list(&image->unusable_pages); in kimage_free_extra_pages()
594 int __weak machine_kexec_post_load(struct kimage *image) in machine_kexec_post_load() argument
599 void kimage_terminate(struct kimage *image) in kimage_terminate() argument
601 if (*image->entry != 0) in kimage_terminate()
602 image->entry++; in kimage_terminate()
604 *image->entry = IND_DONE; in kimage_terminate()
607 #define for_each_kimage_entry(image, ptr, entry) \ argument
608 for (ptr = &image->head; (entry = *ptr) && !(entry & IND_DONE); \
620 void kimage_free(struct kimage *image) in kimage_free() argument
625 if (!image) in kimage_free()
628 if (image->vmcoreinfo_data_copy) { in kimage_free()
630 vunmap(image->vmcoreinfo_data_copy); in kimage_free()
633 kimage_free_extra_pages(image); in kimage_free()
634 for_each_kimage_entry(image, ptr, entry) { in kimage_free()
651 machine_kexec_cleanup(image); in kimage_free()
654 kimage_free_page_list(&image->control_pages); in kimage_free()
660 if (image->file_mode) in kimage_free()
661 kimage_file_post_load_cleanup(image); in kimage_free()
663 kfree(image); in kimage_free()
666 static kimage_entry_t *kimage_dst_used(struct kimage *image, in kimage_dst_used() argument
672 for_each_kimage_entry(image, ptr, entry) { in kimage_dst_used()
685 static struct page *kimage_alloc_page(struct kimage *image, in kimage_alloc_page() argument
714 list_for_each_entry(page, &image->dest_pages, lru) { in kimage_alloc_page()
732 list_add(&page->lru, &image->unusable_pages); in kimage_alloc_page()
742 if (!kimage_is_destination_range(image, addr, in kimage_alloc_page()
751 old = kimage_dst_used(image, addr); in kimage_alloc_page()
776 list_add(&page->lru, &image->dest_pages); in kimage_alloc_page()
782 static int kimage_load_normal_segment(struct kimage *image, in kimage_load_normal_segment() argument
792 if (image->file_mode) in kimage_load_normal_segment()
800 result = kimage_set_destination(image, maddr); in kimage_load_normal_segment()
809 page = kimage_alloc_page(image, GFP_HIGHUSER, maddr); in kimage_load_normal_segment()
814 result = kimage_add_page(image, page_to_boot_pfn(page) in kimage_load_normal_segment()
828 if (image->file_mode) in kimage_load_normal_segment()
839 if (image->file_mode) in kimage_load_normal_segment()
851 static int kimage_load_crash_segment(struct kimage *image, in kimage_load_crash_segment() argument
865 if (image->file_mode) in kimage_load_crash_segment()
894 if (image->file_mode) in kimage_load_crash_segment()
907 if (image->file_mode) in kimage_load_crash_segment()
919 int kimage_load_segment(struct kimage *image, in kimage_load_segment() argument
924 switch (image->type) { in kimage_load_segment()
926 result = kimage_load_normal_segment(image, segment); in kimage_load_segment()
929 result = kimage_load_crash_segment(image, segment); in kimage_load_segment()