• Home
  • Raw
  • Download

Lines Matching refs:kbuf

424 				    struct kexec_buf *kbuf)  in locate_mem_hole_top_down()  argument
426 struct kimage *image = kbuf->image; in locate_mem_hole_top_down()
429 temp_end = min(end, kbuf->buf_max); in locate_mem_hole_top_down()
430 temp_start = temp_end - kbuf->memsz; in locate_mem_hole_top_down()
434 temp_start = temp_start & (~(kbuf->buf_align - 1)); in locate_mem_hole_top_down()
436 if (temp_start < start || temp_start < kbuf->buf_min) in locate_mem_hole_top_down()
439 temp_end = temp_start + kbuf->memsz - 1; in locate_mem_hole_top_down()
455 kbuf->mem = temp_start; in locate_mem_hole_top_down()
462 struct kexec_buf *kbuf) in locate_mem_hole_bottom_up() argument
464 struct kimage *image = kbuf->image; in locate_mem_hole_bottom_up()
467 temp_start = max(start, kbuf->buf_min); in locate_mem_hole_bottom_up()
470 temp_start = ALIGN(temp_start, kbuf->buf_align); in locate_mem_hole_bottom_up()
471 temp_end = temp_start + kbuf->memsz - 1; in locate_mem_hole_bottom_up()
473 if (temp_end > end || temp_end > kbuf->buf_max) in locate_mem_hole_bottom_up()
489 kbuf->mem = temp_start; in locate_mem_hole_bottom_up()
497 struct kexec_buf *kbuf = (struct kexec_buf *)arg; in locate_mem_hole_callback() local
507 if (sz < kbuf->memsz) in locate_mem_hole_callback()
510 if (end < kbuf->buf_min || start > kbuf->buf_max) in locate_mem_hole_callback()
517 if (kbuf->top_down) in locate_mem_hole_callback()
518 return locate_mem_hole_top_down(start, end, kbuf); in locate_mem_hole_callback()
519 return locate_mem_hole_bottom_up(start, end, kbuf); in locate_mem_hole_callback()
523 static int kexec_walk_memblock(struct kexec_buf *kbuf, in kexec_walk_memblock() argument
531 if (kbuf->image->type == KEXEC_TYPE_CRASH) in kexec_walk_memblock()
532 return func(&crashk_res, kbuf); in kexec_walk_memblock()
534 if (kbuf->top_down) { in kexec_walk_memblock()
544 ret = func(&res, kbuf); in kexec_walk_memblock()
558 ret = func(&res, kbuf); in kexec_walk_memblock()
567 static int kexec_walk_memblock(struct kexec_buf *kbuf, in kexec_walk_memblock() argument
583 static int kexec_walk_resources(struct kexec_buf *kbuf, in kexec_walk_resources() argument
586 if (kbuf->image->type == KEXEC_TYPE_CRASH) in kexec_walk_resources()
590 kbuf, func); in kexec_walk_resources()
592 return walk_system_ram_res(0, ULONG_MAX, kbuf, func); in kexec_walk_resources()
603 int kexec_locate_mem_hole(struct kexec_buf *kbuf) in kexec_locate_mem_hole() argument
608 if (kbuf->mem != KEXEC_BUF_MEM_UNKNOWN) in kexec_locate_mem_hole()
612 ret = kexec_walk_resources(kbuf, locate_mem_hole_callback); in kexec_locate_mem_hole()
614 ret = kexec_walk_memblock(kbuf, locate_mem_hole_callback); in kexec_locate_mem_hole()
627 int __weak arch_kexec_locate_mem_hole(struct kexec_buf *kbuf) in arch_kexec_locate_mem_hole() argument
629 return kexec_locate_mem_hole(kbuf); in arch_kexec_locate_mem_hole()
642 int kexec_add_buffer(struct kexec_buf *kbuf) in kexec_add_buffer() argument
648 if (!kbuf->image->file_mode) in kexec_add_buffer()
651 if (kbuf->image->nr_segments >= KEXEC_SEGMENT_MAX) in kexec_add_buffer()
661 if (!list_empty(&kbuf->image->control_pages)) { in kexec_add_buffer()
667 kbuf->memsz = ALIGN(kbuf->memsz, PAGE_SIZE); in kexec_add_buffer()
668 kbuf->buf_align = max(kbuf->buf_align, PAGE_SIZE); in kexec_add_buffer()
671 ret = arch_kexec_locate_mem_hole(kbuf); in kexec_add_buffer()
676 ksegment = &kbuf->image->segment[kbuf->image->nr_segments]; in kexec_add_buffer()
677 ksegment->kbuf = kbuf->buffer; in kexec_add_buffer()
678 ksegment->bufsz = kbuf->bufsz; in kexec_add_buffer()
679 ksegment->mem = kbuf->mem; in kexec_add_buffer()
680 ksegment->memsz = kbuf->memsz; in kexec_add_buffer()
681 kbuf->image->nr_segments++; in kexec_add_buffer()
743 if (ksegment->kbuf == pi->purgatory_buf) in kexec_calculate_store_digests()
746 ret = crypto_shash_update(desc, ksegment->kbuf, in kexec_calculate_store_digests()
814 struct kexec_buf *kbuf) in kexec_purgatory_setup_kbuf() argument
823 kbuf->buf_align = bss_align = 1; in kexec_purgatory_setup_kbuf()
824 kbuf->bufsz = bss_sz = 0; in kexec_purgatory_setup_kbuf()
832 if (kbuf->buf_align < align) in kexec_purgatory_setup_kbuf()
833 kbuf->buf_align = align; in kexec_purgatory_setup_kbuf()
834 kbuf->bufsz = ALIGN(kbuf->bufsz, align); in kexec_purgatory_setup_kbuf()
835 kbuf->bufsz += sechdrs[i].sh_size; in kexec_purgatory_setup_kbuf()
843 kbuf->bufsz = ALIGN(kbuf->bufsz, bss_align); in kexec_purgatory_setup_kbuf()
844 kbuf->memsz = kbuf->bufsz + bss_sz; in kexec_purgatory_setup_kbuf()
845 if (kbuf->buf_align < bss_align) in kexec_purgatory_setup_kbuf()
846 kbuf->buf_align = bss_align; in kexec_purgatory_setup_kbuf()
848 kbuf->buffer = vzalloc(kbuf->bufsz); in kexec_purgatory_setup_kbuf()
849 if (!kbuf->buffer) in kexec_purgatory_setup_kbuf()
851 pi->purgatory_buf = kbuf->buffer; in kexec_purgatory_setup_kbuf()
853 ret = kexec_add_buffer(kbuf); in kexec_purgatory_setup_kbuf()
875 struct kexec_buf *kbuf) in kexec_purgatory_setup_sechdrs() argument
894 bss_addr = kbuf->mem + kbuf->bufsz; in kexec_purgatory_setup_sechdrs()
895 kbuf->image->start = pi->ehdr->e_entry; in kexec_purgatory_setup_sechdrs()
928 !WARN_ON(kbuf->image->start != pi->ehdr->e_entry)) { in kexec_purgatory_setup_sechdrs()
929 kbuf->image->start -= sechdrs[i].sh_addr; in kexec_purgatory_setup_sechdrs()
930 kbuf->image->start += kbuf->mem + offset; in kexec_purgatory_setup_sechdrs()
937 sechdrs[i].sh_addr = kbuf->mem + offset; in kexec_purgatory_setup_sechdrs()
1016 int kexec_load_purgatory(struct kimage *image, struct kexec_buf *kbuf) in kexec_load_purgatory() argument
1026 ret = kexec_purgatory_setup_kbuf(pi, kbuf); in kexec_load_purgatory()
1030 ret = kexec_purgatory_setup_sechdrs(pi, kbuf); in kexec_load_purgatory()