Lines Matching refs:iotlb

28 void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,  in vhost_iotlb_map_free()  argument
31 vhost_iotlb_itree_remove(map, &iotlb->root); in vhost_iotlb_map_free()
34 iotlb->nmaps--; in vhost_iotlb_map_free()
50 int vhost_iotlb_add_range_ctx(struct vhost_iotlb *iotlb, in vhost_iotlb_add_range_ctx() argument
60 if (iotlb->limit && in vhost_iotlb_add_range_ctx()
61 iotlb->nmaps == iotlb->limit && in vhost_iotlb_add_range_ctx()
62 iotlb->flags & VHOST_IOTLB_FLAG_RETIRE) { in vhost_iotlb_add_range_ctx()
63 map = list_first_entry(&iotlb->list, typeof(*map), link); in vhost_iotlb_add_range_ctx()
64 vhost_iotlb_map_free(iotlb, map); in vhost_iotlb_add_range_ctx()
78 iotlb->nmaps++; in vhost_iotlb_add_range_ctx()
79 vhost_iotlb_itree_insert(map, &iotlb->root); in vhost_iotlb_add_range_ctx()
82 list_add_tail(&map->link, &iotlb->list); in vhost_iotlb_add_range_ctx()
88 int vhost_iotlb_add_range(struct vhost_iotlb *iotlb, in vhost_iotlb_add_range() argument
92 return vhost_iotlb_add_range_ctx(iotlb, start, last, in vhost_iotlb_add_range()
103 void vhost_iotlb_del_range(struct vhost_iotlb *iotlb, u64 start, u64 last) in vhost_iotlb_del_range() argument
107 while ((map = vhost_iotlb_itree_iter_first(&iotlb->root, in vhost_iotlb_del_range()
109 vhost_iotlb_map_free(iotlb, map); in vhost_iotlb_del_range()
122 struct vhost_iotlb *iotlb = kzalloc(sizeof(*iotlb), GFP_KERNEL); in vhost_iotlb_alloc() local
124 if (!iotlb) in vhost_iotlb_alloc()
127 iotlb->root = RB_ROOT_CACHED; in vhost_iotlb_alloc()
128 iotlb->limit = limit; in vhost_iotlb_alloc()
129 iotlb->nmaps = 0; in vhost_iotlb_alloc()
130 iotlb->flags = flags; in vhost_iotlb_alloc()
131 INIT_LIST_HEAD(&iotlb->list); in vhost_iotlb_alloc()
133 return iotlb; in vhost_iotlb_alloc()
141 void vhost_iotlb_reset(struct vhost_iotlb *iotlb) in vhost_iotlb_reset() argument
143 vhost_iotlb_del_range(iotlb, 0ULL, 0ULL - 1); in vhost_iotlb_reset()
151 void vhost_iotlb_free(struct vhost_iotlb *iotlb) in vhost_iotlb_free() argument
153 if (iotlb) { in vhost_iotlb_free()
154 vhost_iotlb_reset(iotlb); in vhost_iotlb_free()
155 kfree(iotlb); in vhost_iotlb_free()
167 vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last) in vhost_iotlb_itree_first() argument
169 return vhost_iotlb_itree_iter_first(&iotlb->root, start, last); in vhost_iotlb_itree_first()