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
65 int err = vhost_iotlb_add_range_ctx(iotlb, start, mid, addr, in vhost_iotlb_add_range_ctx()
75 if (iotlb->limit && in vhost_iotlb_add_range_ctx()
76 iotlb->nmaps == iotlb->limit && in vhost_iotlb_add_range_ctx()
77 iotlb->flags & VHOST_IOTLB_FLAG_RETIRE) { in vhost_iotlb_add_range_ctx()
78 map = list_first_entry(&iotlb->list, typeof(*map), link); in vhost_iotlb_add_range_ctx()
79 vhost_iotlb_map_free(iotlb, map); in vhost_iotlb_add_range_ctx()
93 iotlb->nmaps++; in vhost_iotlb_add_range_ctx()
94 vhost_iotlb_itree_insert(map, &iotlb->root); in vhost_iotlb_add_range_ctx()
97 list_add_tail(&map->link, &iotlb->list); in vhost_iotlb_add_range_ctx()
103 int vhost_iotlb_add_range(struct vhost_iotlb *iotlb, in vhost_iotlb_add_range() argument
107 return vhost_iotlb_add_range_ctx(iotlb, start, last, in vhost_iotlb_add_range()
118 void vhost_iotlb_del_range(struct vhost_iotlb *iotlb, u64 start, u64 last) in vhost_iotlb_del_range() argument
122 while ((map = vhost_iotlb_itree_iter_first(&iotlb->root, in vhost_iotlb_del_range()
124 vhost_iotlb_map_free(iotlb, map); in vhost_iotlb_del_range()
134 void vhost_iotlb_init(struct vhost_iotlb *iotlb, unsigned int limit, in vhost_iotlb_init() argument
137 iotlb->root = RB_ROOT_CACHED; in vhost_iotlb_init()
138 iotlb->limit = limit; in vhost_iotlb_init()
139 iotlb->nmaps = 0; in vhost_iotlb_init()
140 iotlb->flags = flags; in vhost_iotlb_init()
141 INIT_LIST_HEAD(&iotlb->list); in vhost_iotlb_init()
154 struct vhost_iotlb *iotlb = kzalloc(sizeof(*iotlb), GFP_KERNEL); in vhost_iotlb_alloc() local
156 if (!iotlb) in vhost_iotlb_alloc()
159 vhost_iotlb_init(iotlb, limit, flags); in vhost_iotlb_alloc()
161 return iotlb; in vhost_iotlb_alloc()
169 void vhost_iotlb_reset(struct vhost_iotlb *iotlb) in vhost_iotlb_reset() argument
171 vhost_iotlb_del_range(iotlb, 0ULL, 0ULL - 1); in vhost_iotlb_reset()
179 void vhost_iotlb_free(struct vhost_iotlb *iotlb) in vhost_iotlb_free() argument
181 if (iotlb) { in vhost_iotlb_free()
182 vhost_iotlb_reset(iotlb); in vhost_iotlb_free()
183 kfree(iotlb); in vhost_iotlb_free()
195 vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last) in vhost_iotlb_itree_first() argument
197 return vhost_iotlb_itree_iter_first(&iotlb->root, start, last); in vhost_iotlb_itree_first()