• Home
  • Raw
  • Download

Lines Matching refs:iovad

23 init_iova_domain(struct iova_domain *iovad, unsigned long pfn_32bit)  in init_iova_domain()  argument
25 spin_lock_init(&iovad->iova_rbtree_lock); in init_iova_domain()
26 iovad->rbroot = RB_ROOT; in init_iova_domain()
27 iovad->cached32_node = NULL; in init_iova_domain()
28 iovad->dma_32bit_pfn = pfn_32bit; in init_iova_domain()
32 __get_cached_rbnode(struct iova_domain *iovad, unsigned long *limit_pfn) in __get_cached_rbnode() argument
34 if ((*limit_pfn != iovad->dma_32bit_pfn) || in __get_cached_rbnode()
35 (iovad->cached32_node == NULL)) in __get_cached_rbnode()
36 return rb_last(&iovad->rbroot); in __get_cached_rbnode()
38 struct rb_node *prev_node = rb_prev(iovad->cached32_node); in __get_cached_rbnode()
40 container_of(iovad->cached32_node, struct iova, node); in __get_cached_rbnode()
47 __cached_rbnode_insert_update(struct iova_domain *iovad, in __cached_rbnode_insert_update() argument
50 if (limit_pfn != iovad->dma_32bit_pfn) in __cached_rbnode_insert_update()
52 iovad->cached32_node = &new->node; in __cached_rbnode_insert_update()
56 __cached_rbnode_delete_update(struct iova_domain *iovad, struct iova *free) in __cached_rbnode_delete_update() argument
61 if (!iovad->cached32_node) in __cached_rbnode_delete_update()
63 curr = iovad->cached32_node; in __cached_rbnode_delete_update()
71 if (node && iova->pfn_lo < iovad->dma_32bit_pfn) in __cached_rbnode_delete_update()
72 iovad->cached32_node = node; in __cached_rbnode_delete_update()
74 iovad->cached32_node = NULL; in __cached_rbnode_delete_update()
93 static int __alloc_and_insert_iova_range(struct iova_domain *iovad, in __alloc_and_insert_iova_range() argument
103 spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); in __alloc_and_insert_iova_range()
105 curr = __get_cached_rbnode(iovad, &limit_pfn); in __alloc_and_insert_iova_range()
131 spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); in __alloc_and_insert_iova_range()
150 entry = &iovad->rbroot.rb_node; in __alloc_and_insert_iova_range()
168 rb_insert_color(&new->node, &iovad->rbroot); in __alloc_and_insert_iova_range()
170 __cached_rbnode_insert_update(iovad, saved_pfn, new); in __alloc_and_insert_iova_range()
172 spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); in __alloc_and_insert_iova_range()
211 alloc_iova(struct iova_domain *iovad, unsigned long size, in alloc_iova() argument
228 ret = __alloc_and_insert_iova_range(iovad, size, limit_pfn, in alloc_iova()
246 struct iova *find_iova(struct iova_domain *iovad, unsigned long pfn) in find_iova() argument
252 spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); in find_iova()
253 node = iovad->rbroot.rb_node; in find_iova()
259 spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); in find_iova()
275 spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); in find_iova()
286 __free_iova(struct iova_domain *iovad, struct iova *iova) in __free_iova() argument
290 spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); in __free_iova()
291 __cached_rbnode_delete_update(iovad, iova); in __free_iova()
292 rb_erase(&iova->node, &iovad->rbroot); in __free_iova()
293 spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); in __free_iova()
305 free_iova(struct iova_domain *iovad, unsigned long pfn) in free_iova() argument
307 struct iova *iova = find_iova(iovad, pfn); in free_iova()
309 __free_iova(iovad, iova); in free_iova()
318 void put_iova_domain(struct iova_domain *iovad) in put_iova_domain() argument
323 spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); in put_iova_domain()
324 node = rb_first(&iovad->rbroot); in put_iova_domain()
327 rb_erase(node, &iovad->rbroot); in put_iova_domain()
329 node = rb_first(&iovad->rbroot); in put_iova_domain()
331 spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); in put_iova_domain()
346 __insert_new_range(struct iova_domain *iovad, in __insert_new_range() argument
357 iova_insert_rbtree(&iovad->rbroot, iova); in __insert_new_range()
380 reserve_iova(struct iova_domain *iovad, in reserve_iova() argument
388 spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); in reserve_iova()
389 for (node = rb_first(&iovad->rbroot); node; node = rb_next(node)) { in reserve_iova()
405 iova = __insert_new_range(iovad, pfn_lo, pfn_hi); in reserve_iova()
408 spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); in reserve_iova()