Lines Matching defs: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
49 int vhost_iotlb_add_range(struct vhost_iotlb *iotlb,
58 if (iotlb->limit &&
59 iotlb->nmaps == iotlb->limit &&
60 iotlb->flags & VHOST_IOTLB_FLAG_RETIRE) {
61 map = list_first_entry(&iotlb->list, typeof(*map), link);
62 vhost_iotlb_map_free(iotlb, map);
75 iotlb->nmaps++;
76 vhost_iotlb_itree_insert(map, &iotlb->root);
79 list_add_tail(&map->link, &iotlb->list);
87 * @iotlb: the IOTLB
91 void vhost_iotlb_del_range(struct vhost_iotlb *iotlb, u64 start, u64 last)
95 while ((map = vhost_iotlb_itree_iter_first(&iotlb->root,
97 vhost_iotlb_map_free(iotlb, map);
110 struct vhost_iotlb *iotlb = kzalloc(sizeof(*iotlb), GFP_KERNEL);
112 if (!iotlb)
115 iotlb->root = RB_ROOT_CACHED;
116 iotlb->limit = limit;
117 iotlb->nmaps = 0;
118 iotlb->flags = flags;
119 INIT_LIST_HEAD(&iotlb->list);
121 return iotlb;
127 * @iotlb: the IOTLB to be reset
129 void vhost_iotlb_reset(struct vhost_iotlb *iotlb)
131 vhost_iotlb_del_range(iotlb, 0ULL, 0ULL - 1);
137 * @iotlb: the IOTLB to be freed
139 void vhost_iotlb_free(struct vhost_iotlb *iotlb)
141 if (iotlb) {
142 vhost_iotlb_reset(iotlb);
143 kfree(iotlb);
150 * @iotlb: the IOTLB
155 vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last)
157 return vhost_iotlb_itree_iter_first(&iotlb->root, start, last);