Lines Matching refs:pgtable
36 static int ivpu_mmu_pgtable_init(struct ivpu_device *vdev, struct ivpu_mmu_pgtable *pgtable) in ivpu_mmu_pgtable_init() argument
45 pgtable->pgd = pgd; in ivpu_mmu_pgtable_init()
46 pgtable->pgd_dma = pgd_dma; in ivpu_mmu_pgtable_init()
51 static void ivpu_mmu_pgtable_free(struct ivpu_device *vdev, struct ivpu_mmu_pgtable *pgtable) in ivpu_mmu_pgtable_free() argument
56 u64 **pmd_entries = pgtable->pgd_cpu_entries[pgd_index]; in ivpu_mmu_pgtable_free()
57 u64 *pmd = pgtable->pgd_entries[pgd_index]; in ivpu_mmu_pgtable_free()
70 dma_free_wc(vdev->drm.dev, IVPU_MMU_PGTABLE_SIZE, pgtable->pgd_entries[pgd_index], in ivpu_mmu_pgtable_free()
71 pgtable->pgd[pgd_index] & ~IVPU_MMU_ENTRY_FLAGS_MASK); in ivpu_mmu_pgtable_free()
74 dma_free_wc(vdev->drm.dev, IVPU_MMU_PGTABLE_SIZE, pgtable->pgd, in ivpu_mmu_pgtable_free()
75 pgtable->pgd_dma & ~IVPU_MMU_ENTRY_FLAGS_MASK); in ivpu_mmu_pgtable_free()
79 ivpu_mmu_ensure_pmd(struct ivpu_device *vdev, struct ivpu_mmu_pgtable *pgtable, u64 pgd_index) in ivpu_mmu_ensure_pmd() argument
85 if (pgtable->pgd_entries[pgd_index]) in ivpu_mmu_ensure_pmd()
86 return pgtable->pgd_entries[pgd_index]; in ivpu_mmu_ensure_pmd()
96 pgtable->pgd_entries[pgd_index] = pmd; in ivpu_mmu_ensure_pmd()
97 pgtable->pgd_cpu_entries[pgd_index] = pmd_entries; in ivpu_mmu_ensure_pmd()
98 pgtable->pgd[pgd_index] = pmd_dma | IVPU_MMU_ENTRY_VALID; in ivpu_mmu_ensure_pmd()
108 ivpu_mmu_ensure_pte(struct ivpu_device *vdev, struct ivpu_mmu_pgtable *pgtable, in ivpu_mmu_ensure_pte() argument
114 if (pgtable->pgd_cpu_entries[pgd_index][pmd_index]) in ivpu_mmu_ensure_pte()
115 return pgtable->pgd_cpu_entries[pgd_index][pmd_index]; in ivpu_mmu_ensure_pte()
121 pgtable->pgd_cpu_entries[pgd_index][pmd_index] = pte; in ivpu_mmu_ensure_pte()
122 pgtable->pgd_entries[pgd_index][pmd_index] = pte_dma | IVPU_MMU_ENTRY_VALID; in ivpu_mmu_ensure_pte()
137 if (!ivpu_mmu_ensure_pmd(vdev, &ctx->pgtable, pgd_index)) in ivpu_mmu_context_map_page()
141 pte = ivpu_mmu_ensure_pte(vdev, &ctx->pgtable, pgd_index, pmd_index); in ivpu_mmu_context_map_page()
158 ctx->pgtable.pgd_cpu_entries[pgd_index][pmd_index][pte_index] = IVPU_MMU_ENTRY_INVALID; in ivpu_mmu_context_unmap_page()
165 u64 *pgd = ctx->pgtable.pgd; in ivpu_mmu_context_flush_page_tables()
173 u64 *pmd = ctx->pgtable.pgd_entries[pgd_index]; in ivpu_mmu_context_flush_page_tables()
177 u64 *pte = ctx->pgtable.pgd_cpu_entries[pgd_index][pmd_index]; in ivpu_mmu_context_flush_page_tables()
317 ret = ivpu_mmu_pgtable_init(vdev, &ctx->pgtable); in ivpu_mmu_context_init()
337 drm_WARN_ON(&vdev->drm, !ctx->pgtable.pgd); in ivpu_mmu_context_fini()
340 ivpu_mmu_pgtable_free(vdev, &ctx->pgtable); in ivpu_mmu_context_fini()
379 ret = ivpu_mmu_set_pgtable(vdev, ctx_id, &ctx->pgtable); in ivpu_mmu_user_context_init()