Lines Matching refs:parent
68 struct pgt_parent *parent = NULL; in free_pgt() local
73 assert(pgt && pgt->parent); in free_pgt()
74 parent = pgt->parent; in free_pgt()
75 assert(parent->num_used <= PGT_PARENT_TBL_COUNT && in free_pgt()
76 parent->num_used > 0); in free_pgt()
77 if (parent->num_used == PGT_PARENT_TBL_COUNT) in free_pgt()
78 SLIST_INSERT_HEAD(&parent_list, parent, link); in free_pgt()
79 parent->num_used--; in free_pgt()
81 if (!parent->num_used && SLIST_NEXT(SLIST_FIRST(&parent_list), link)) { in free_pgt()
86 SLIST_REMOVE(&parent_list, parent, pgt_parent, link); in free_pgt()
87 tee_mm_free(parent->mm); in free_pgt()
88 free(parent); in free_pgt()
90 SLIST_INSERT_HEAD(&parent->pgt_cache, pgt, link); in free_pgt()
100 struct pgt_parent *parent = NULL; in alloc_pgt_parent() local
106 sz = sizeof(*parent) + sizeof(*pgt) * PGT_PARENT_TBL_COUNT; in alloc_pgt_parent()
107 parent = calloc(1, sz); in alloc_pgt_parent()
108 if (!parent) in alloc_pgt_parent()
110 parent->mm = phys_mem_ta_alloc(PGT_PARENT_SIZE); in alloc_pgt_parent()
111 if (!parent->mm) { in alloc_pgt_parent()
112 free(parent); in alloc_pgt_parent()
115 tbl = phys_to_virt(tee_mm_get_smem(parent->mm), in alloc_pgt_parent()
120 SLIST_INIT(&parent->pgt_cache); in alloc_pgt_parent()
121 pgt = (struct pgt *)(parent + 1); in alloc_pgt_parent()
123 pgt[n].parent = parent; in alloc_pgt_parent()
125 SLIST_INSERT_HEAD(&parent->pgt_cache, pgt + n, link); in alloc_pgt_parent()
128 return parent; in alloc_pgt_parent()
133 struct pgt_parent *parent = NULL; in alloc_pgt() local
139 parent = SLIST_FIRST(&parent_list); in alloc_pgt()
140 if (!parent) { in alloc_pgt()
141 parent = alloc_pgt_parent(); in alloc_pgt()
142 if (!parent) in alloc_pgt()
145 SLIST_INSERT_HEAD(&parent_list, parent, link); in alloc_pgt()
148 pgt = SLIST_FIRST(&parent->pgt_cache); in alloc_pgt()
149 SLIST_REMOVE_HEAD(&parent->pgt_cache, link); in alloc_pgt()
150 parent->num_used++; in alloc_pgt()
151 assert(pgt && parent->num_used <= PGT_PARENT_TBL_COUNT); in alloc_pgt()
152 if (parent->num_used == PGT_PARENT_TBL_COUNT) in alloc_pgt()
403 p->parent = &pgt_parents[n]; in pgt_init()
476 SLIST_INSERT_HEAD(&p->parent->pgt_cache, p, link); in push_to_free_list()
477 assert(p->parent->num_used > 0); in push_to_free_list()
478 p->parent->num_used--; in push_to_free_list()
479 if (!p->parent->num_used) { in push_to_free_list()