Lines Matching refs:iotlb

25  * @iotlb: the IOTLB
28 void vhost_iotlb_map_free(struct vhost_iotlb *iotlb,
31 vhost_iotlb_itree_remove(map, &iotlb->root);
34 iotlb->nmaps--;
40 * @iotlb: the IOTLB
50 int vhost_iotlb_add_range_ctx(struct vhost_iotlb *iotlb,
65 int err = vhost_iotlb_add_range_ctx(iotlb, start, mid, addr,
75 if (iotlb->limit &&
76 iotlb->nmaps == iotlb->limit &&
77 iotlb->flags & VHOST_IOTLB_FLAG_RETIRE) {
78 map = list_first_entry(&iotlb->list, typeof(*map), link);
79 vhost_iotlb_map_free(iotlb, map);
93 iotlb->nmaps++;
94 vhost_iotlb_itree_insert(map, &iotlb->root);
97 list_add_tail(&map->link, &iotlb->list);
103 int vhost_iotlb_add_range(struct vhost_iotlb *iotlb,
107 return vhost_iotlb_add_range_ctx(iotlb, start, last,
114 * @iotlb: the IOTLB
118 void vhost_iotlb_del_range(struct vhost_iotlb *iotlb, u64 start, u64 last)
122 while ((map = vhost_iotlb_itree_iter_first(&iotlb->root,
124 vhost_iotlb_map_free(iotlb, map);
130 * @iotlb: the IOTLB that needs to be initialized
134 void vhost_iotlb_init(struct vhost_iotlb *iotlb, unsigned int limit,
137 iotlb->root = RB_ROOT_CACHED;
138 iotlb->limit = limit;
139 iotlb->nmaps = 0;
140 iotlb->flags = flags;
141 INIT_LIST_HEAD(&iotlb->list);
154 struct vhost_iotlb *iotlb = kzalloc(sizeof(*iotlb), GFP_KERNEL);
156 if (!iotlb)
159 vhost_iotlb_init(iotlb, limit, flags);
161 return iotlb;
167 * @iotlb: the IOTLB to be reset
169 void vhost_iotlb_reset(struct vhost_iotlb *iotlb)
171 vhost_iotlb_del_range(iotlb, 0ULL, 0ULL - 1);
177 * @iotlb: the IOTLB to be freed
179 void vhost_iotlb_free(struct vhost_iotlb *iotlb)
181 if (iotlb) {
182 vhost_iotlb_reset(iotlb);
183 kfree(iotlb);
190 * @iotlb: the IOTLB
195 vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last)
197 return vhost_iotlb_itree_iter_first(&iotlb->root, start, last);