Lines Matching refs:ppd
99 static void __init sme_clear_pgd(struct sme_populate_pgd_data *ppd) in sme_clear_pgd() argument
104 pgd_start = ppd->vaddr & PGDIR_MASK; in sme_clear_pgd()
105 pgd_end = ppd->vaddr_end & PGDIR_MASK; in sme_clear_pgd()
109 pgd_p = ppd->pgd + pgd_index(ppd->vaddr); in sme_clear_pgd()
114 static pud_t __init *sme_prepare_pgd(struct sme_populate_pgd_data *ppd) in sme_prepare_pgd() argument
121 pgd = ppd->pgd + pgd_index(ppd->vaddr); in sme_prepare_pgd()
123 p4d = ppd->pgtable_area; in sme_prepare_pgd()
125 ppd->pgtable_area += sizeof(*p4d) * PTRS_PER_P4D; in sme_prepare_pgd()
129 p4d = p4d_offset(pgd, ppd->vaddr); in sme_prepare_pgd()
131 pud = ppd->pgtable_area; in sme_prepare_pgd()
133 ppd->pgtable_area += sizeof(*pud) * PTRS_PER_PUD; in sme_prepare_pgd()
137 pud = pud_offset(p4d, ppd->vaddr); in sme_prepare_pgd()
139 pmd = ppd->pgtable_area; in sme_prepare_pgd()
141 ppd->pgtable_area += sizeof(*pmd) * PTRS_PER_PMD; in sme_prepare_pgd()
151 static void __init sme_populate_pgd_large(struct sme_populate_pgd_data *ppd) in sme_populate_pgd_large() argument
156 pud = sme_prepare_pgd(ppd); in sme_populate_pgd_large()
160 pmd = pmd_offset(pud, ppd->vaddr); in sme_populate_pgd_large()
164 set_pmd(pmd, __pmd(ppd->paddr | ppd->pmd_flags)); in sme_populate_pgd_large()
167 static void __init sme_populate_pgd(struct sme_populate_pgd_data *ppd) in sme_populate_pgd() argument
173 pud = sme_prepare_pgd(ppd); in sme_populate_pgd()
177 pmd = pmd_offset(pud, ppd->vaddr); in sme_populate_pgd()
179 pte = ppd->pgtable_area; in sme_populate_pgd()
181 ppd->pgtable_area += sizeof(*pte) * PTRS_PER_PTE; in sme_populate_pgd()
188 pte = pte_offset_map(pmd, ppd->vaddr); in sme_populate_pgd()
190 set_pte(pte, __pte(ppd->paddr | ppd->pte_flags)); in sme_populate_pgd()
193 static void __init __sme_map_range_pmd(struct sme_populate_pgd_data *ppd) in __sme_map_range_pmd() argument
195 while (ppd->vaddr < ppd->vaddr_end) { in __sme_map_range_pmd()
196 sme_populate_pgd_large(ppd); in __sme_map_range_pmd()
198 ppd->vaddr += PMD_PAGE_SIZE; in __sme_map_range_pmd()
199 ppd->paddr += PMD_PAGE_SIZE; in __sme_map_range_pmd()
203 static void __init __sme_map_range_pte(struct sme_populate_pgd_data *ppd) in __sme_map_range_pte() argument
205 while (ppd->vaddr < ppd->vaddr_end) { in __sme_map_range_pte()
206 sme_populate_pgd(ppd); in __sme_map_range_pte()
208 ppd->vaddr += PAGE_SIZE; in __sme_map_range_pte()
209 ppd->paddr += PAGE_SIZE; in __sme_map_range_pte()
213 static void __init __sme_map_range(struct sme_populate_pgd_data *ppd, in __sme_map_range() argument
218 ppd->pmd_flags = pmd_flags; in __sme_map_range()
219 ppd->pte_flags = pte_flags; in __sme_map_range()
222 vaddr_end = ppd->vaddr_end; in __sme_map_range()
225 ppd->vaddr_end = ALIGN(ppd->vaddr, PMD_PAGE_SIZE); in __sme_map_range()
226 __sme_map_range_pte(ppd); in __sme_map_range()
229 ppd->vaddr_end = vaddr_end & PMD_PAGE_MASK; in __sme_map_range()
230 __sme_map_range_pmd(ppd); in __sme_map_range()
233 ppd->vaddr_end = vaddr_end; in __sme_map_range()
234 __sme_map_range_pte(ppd); in __sme_map_range()
237 static void __init sme_map_range_encrypted(struct sme_populate_pgd_data *ppd) in sme_map_range_encrypted() argument
239 __sme_map_range(ppd, PMD_FLAGS_ENC, PTE_FLAGS_ENC); in sme_map_range_encrypted()
242 static void __init sme_map_range_decrypted(struct sme_populate_pgd_data *ppd) in sme_map_range_decrypted() argument
244 __sme_map_range(ppd, PMD_FLAGS_DEC, PTE_FLAGS_DEC); in sme_map_range_decrypted()
247 static void __init sme_map_range_decrypted_wp(struct sme_populate_pgd_data *ppd) in sme_map_range_decrypted_wp() argument
249 __sme_map_range(ppd, PMD_FLAGS_DEC_WP, PTE_FLAGS_DEC_WP); in sme_map_range_decrypted_wp()
295 struct sme_populate_pgd_data ppd; in sme_encrypt_kernel() local
386 ppd.pgtable_area = (void *)execute_end; in sme_encrypt_kernel()
392 ppd.pgd = (pgd_t *)native_read_cr3_pa(); in sme_encrypt_kernel()
393 ppd.paddr = workarea_start; in sme_encrypt_kernel()
394 ppd.vaddr = workarea_start; in sme_encrypt_kernel()
395 ppd.vaddr_end = workarea_end; in sme_encrypt_kernel()
396 sme_map_range_decrypted(&ppd); in sme_encrypt_kernel()
407 ppd.pgd = ppd.pgtable_area; in sme_encrypt_kernel()
408 memset(ppd.pgd, 0, sizeof(pgd_t) * PTRS_PER_PGD); in sme_encrypt_kernel()
409 ppd.pgtable_area += sizeof(pgd_t) * PTRS_PER_PGD; in sme_encrypt_kernel()
427 ppd.paddr = kernel_start; in sme_encrypt_kernel()
428 ppd.vaddr = kernel_start; in sme_encrypt_kernel()
429 ppd.vaddr_end = kernel_end; in sme_encrypt_kernel()
430 sme_map_range_encrypted(&ppd); in sme_encrypt_kernel()
433 ppd.paddr = kernel_start; in sme_encrypt_kernel()
434 ppd.vaddr = kernel_start + decrypted_base; in sme_encrypt_kernel()
435 ppd.vaddr_end = kernel_end + decrypted_base; in sme_encrypt_kernel()
436 sme_map_range_decrypted_wp(&ppd); in sme_encrypt_kernel()
440 ppd.paddr = initrd_start; in sme_encrypt_kernel()
441 ppd.vaddr = initrd_start; in sme_encrypt_kernel()
442 ppd.vaddr_end = initrd_end; in sme_encrypt_kernel()
443 sme_map_range_encrypted(&ppd); in sme_encrypt_kernel()
447 ppd.paddr = initrd_start; in sme_encrypt_kernel()
448 ppd.vaddr = initrd_start + decrypted_base; in sme_encrypt_kernel()
449 ppd.vaddr_end = initrd_end + decrypted_base; in sme_encrypt_kernel()
450 sme_map_range_decrypted_wp(&ppd); in sme_encrypt_kernel()
454 ppd.paddr = workarea_start; in sme_encrypt_kernel()
455 ppd.vaddr = workarea_start; in sme_encrypt_kernel()
456 ppd.vaddr_end = workarea_end; in sme_encrypt_kernel()
457 sme_map_range_decrypted(&ppd); in sme_encrypt_kernel()
459 ppd.paddr = workarea_start; in sme_encrypt_kernel()
460 ppd.vaddr = workarea_start + decrypted_base; in sme_encrypt_kernel()
461 ppd.vaddr_end = workarea_end + decrypted_base; in sme_encrypt_kernel()
462 sme_map_range_decrypted(&ppd); in sme_encrypt_kernel()
466 kernel_len, workarea_start, (unsigned long)ppd.pgd); in sme_encrypt_kernel()
471 (unsigned long)ppd.pgd); in sme_encrypt_kernel()
478 ppd.vaddr = kernel_start + decrypted_base; in sme_encrypt_kernel()
479 ppd.vaddr_end = kernel_end + decrypted_base; in sme_encrypt_kernel()
480 sme_clear_pgd(&ppd); in sme_encrypt_kernel()
483 ppd.vaddr = initrd_start + decrypted_base; in sme_encrypt_kernel()
484 ppd.vaddr_end = initrd_end + decrypted_base; in sme_encrypt_kernel()
485 sme_clear_pgd(&ppd); in sme_encrypt_kernel()
488 ppd.vaddr = workarea_start + decrypted_base; in sme_encrypt_kernel()
489 ppd.vaddr_end = workarea_end + decrypted_base; in sme_encrypt_kernel()
490 sme_clear_pgd(&ppd); in sme_encrypt_kernel()