Lines Matching full:image

43 static void machine_kexec_free_page_tables(struct kimage *image)  in machine_kexec_free_page_tables()  argument
45 free_pages((unsigned long)image->arch.pgd, PGD_ALLOCATION_ORDER); in machine_kexec_free_page_tables()
46 image->arch.pgd = NULL; in machine_kexec_free_page_tables()
48 free_page((unsigned long)image->arch.pmd0); in machine_kexec_free_page_tables()
49 image->arch.pmd0 = NULL; in machine_kexec_free_page_tables()
50 free_page((unsigned long)image->arch.pmd1); in machine_kexec_free_page_tables()
51 image->arch.pmd1 = NULL; in machine_kexec_free_page_tables()
53 free_page((unsigned long)image->arch.pte0); in machine_kexec_free_page_tables()
54 image->arch.pte0 = NULL; in machine_kexec_free_page_tables()
55 free_page((unsigned long)image->arch.pte1); in machine_kexec_free_page_tables()
56 image->arch.pte1 = NULL; in machine_kexec_free_page_tables()
59 static int machine_kexec_alloc_page_tables(struct kimage *image) in machine_kexec_alloc_page_tables() argument
61 image->arch.pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, in machine_kexec_alloc_page_tables()
64 image->arch.pmd0 = (pmd_t *)get_zeroed_page(GFP_KERNEL); in machine_kexec_alloc_page_tables()
65 image->arch.pmd1 = (pmd_t *)get_zeroed_page(GFP_KERNEL); in machine_kexec_alloc_page_tables()
67 image->arch.pte0 = (pte_t *)get_zeroed_page(GFP_KERNEL); in machine_kexec_alloc_page_tables()
68 image->arch.pte1 = (pte_t *)get_zeroed_page(GFP_KERNEL); in machine_kexec_alloc_page_tables()
69 if (!image->arch.pgd || in machine_kexec_alloc_page_tables()
71 !image->arch.pmd0 || !image->arch.pmd1 || in machine_kexec_alloc_page_tables()
73 !image->arch.pte0 || !image->arch.pte1) { in machine_kexec_alloc_page_tables()
100 static void machine_kexec_prepare_page_tables(struct kimage *image) in machine_kexec_prepare_page_tables() argument
105 control_page = page_address(image->control_code_page); in machine_kexec_prepare_page_tables()
107 pmd = image->arch.pmd0; in machine_kexec_prepare_page_tables()
110 image->arch.pgd, pmd, image->arch.pte0, in machine_kexec_prepare_page_tables()
113 pmd = image->arch.pmd1; in machine_kexec_prepare_page_tables()
116 image->arch.pgd, pmd, image->arch.pte1, in machine_kexec_prepare_page_tables()
122 * proposed image and prepare the control pages
127 * Do what every setup is needed on image and the
135 int machine_kexec_prepare(struct kimage *image) in machine_kexec_prepare() argument
139 set_memory_x((unsigned long)page_address(image->control_code_page), 1); in machine_kexec_prepare()
140 error = machine_kexec_alloc_page_tables(image); in machine_kexec_prepare()
143 machine_kexec_prepare_page_tables(image); in machine_kexec_prepare()
149 * when an image is freed.
151 void machine_kexec_cleanup(struct kimage *image) in machine_kexec_cleanup() argument
153 set_memory_nx((unsigned long)page_address(image->control_code_page), 1); in machine_kexec_cleanup()
154 machine_kexec_free_page_tables(image); in machine_kexec_cleanup()
161 void machine_kexec(struct kimage *image) in machine_kexec() argument
174 if (image->preserve_context) in machine_kexec()
184 if (image->preserve_context) { in machine_kexec()
197 control_page = page_address(image->control_code_page); in machine_kexec()
203 page_list[PA_PGD] = __pa(image->arch.pgd); in machine_kexec()
205 if (image->type == KEXEC_TYPE_DEFAULT) in machine_kexec()
206 page_list[PA_SWAP_PAGE] = (page_to_pfn(image->swap_page) in machine_kexec()
228 image->start = relocate_kernel_ptr((unsigned long)image->head, in machine_kexec()
230 image->start, in machine_kexec()
232 image->preserve_context); in machine_kexec()
235 if (image->preserve_context) in machine_kexec()