Lines Matching refs:hr_priv
807 static void hl_mmu_hr_pool_destroy(struct hl_device *hdev, struct hl_mmu_hr_priv *hr_priv, in hl_mmu_hr_pool_destroy() argument
811 struct gen_pool **pool = &hr_priv->mmu_pgt_pool; in hl_mmu_hr_pool_destroy()
819 if (hr_priv->mmu_asid_hop0) { in hl_mmu_hr_pool_destroy()
821 hop0_pgt = &hr_priv->mmu_asid_hop0[asid]; in hl_mmu_hr_pool_destroy()
852 int hl_mmu_hr_init(struct hl_device *hdev, struct hl_mmu_hr_priv *hr_priv, u32 hop_table_size, in hl_mmu_hr_init() argument
868 hr_priv->mmu_pgt_pool = gen_pool_create(PAGE_SHIFT, -1); in hl_mmu_hr_init()
869 if (ZERO_OR_NULL_PTR(hr_priv->mmu_pgt_pool)) { in hl_mmu_hr_init()
874 hr_priv->mmu_asid_hop0 = kvcalloc(prop->max_asid, sizeof(struct pgt_info), GFP_KERNEL); in hl_mmu_hr_init()
875 if (ZERO_OR_NULL_PTR(hr_priv->mmu_asid_hop0)) { in hl_mmu_hr_init()
892 rc = gen_pool_add_virt(hr_priv->mmu_pgt_pool, virt_addr, (phys_addr_t) dma_addr, in hl_mmu_hr_init()
901 hop0_pgt = &hr_priv->mmu_asid_hop0[i]; in hl_mmu_hr_init()
903 gen_pool_dma_zalloc_align(hr_priv->mmu_pgt_pool, in hl_mmu_hr_init()
919 hl_mmu_hr_pool_destroy(hdev, hr_priv, hop_table_size); in hl_mmu_hr_init()
920 if (!ZERO_OR_NULL_PTR(hr_priv->mmu_asid_hop0)) in hl_mmu_hr_init()
921 kvfree(hr_priv->mmu_asid_hop0); in hl_mmu_hr_init()
938 void hl_mmu_hr_fini(struct hl_device *hdev, struct hl_mmu_hr_priv *hr_priv, u32 hop_table_size) in hl_mmu_hr_fini() argument
942 hl_mmu_hr_pool_destroy(hdev, hr_priv, hop_table_size); in hl_mmu_hr_fini()
944 if (!ZERO_OR_NULL_PTR(hr_priv->mmu_asid_hop0)) { in hl_mmu_hr_fini()
945 kvfree(hr_priv->mmu_asid_hop0); in hl_mmu_hr_fini()
951 hr_priv->mmu_asid_hop0 = NULL; in hl_mmu_hr_fini()
961 void hl_mmu_hr_free_hop_remove_pgt(struct pgt_info *pgt_info, struct hl_mmu_hr_priv *hr_priv, in hl_mmu_hr_free_hop_remove_pgt() argument
964 gen_pool_free(hr_priv->mmu_pgt_pool, pgt_info->virt_addr, hop_table_size); in hl_mmu_hr_free_hop_remove_pgt()
1034 struct hl_mmu_hr_priv *hr_priv, in hl_mmu_hr_put_pte() argument
1047 hl_mmu_hr_free_hop_remove_pgt(pgt_info, hr_priv, hop_table_size); in hl_mmu_hr_put_pte()
1092 struct pgt_info *hl_mmu_hr_alloc_hop(struct hl_ctx *ctx, struct hl_mmu_hr_priv *hr_priv, in hl_mmu_hr_alloc_hop() argument
1107 virt_addr = gen_pool_dma_zalloc_align(hr_priv->mmu_pgt_pool, in hl_mmu_hr_alloc_hop()
1120 if (gen_pool_add_virt(hr_priv->mmu_pgt_pool, (unsigned long)virt_addr, in hl_mmu_hr_alloc_hop()
1160 struct hl_mmu_hr_priv *hr_priv, in hl_mmu_hr_get_alloc_next_hop() argument
1171 return hl_mmu_hr_alloc_hop(ctx, hr_priv, hr_func, mmu_prop); in hl_mmu_hr_get_alloc_next_hop()