Lines Matching refs:iotlb
41 struct vhost_iotlb iotlb; member
68 static inline u32 iotlb_to_asid(struct vhost_iotlb *iotlb) in iotlb_to_asid() argument
70 struct vhost_vdpa_as *as = container_of(iotlb, struct in iotlb_to_asid()
71 vhost_vdpa_as, iotlb); in iotlb_to_asid()
94 return &as->iotlb; in asid_to_iotlb()
112 vhost_iotlb_init(&as->iotlb, 0, 0); in vhost_vdpa_alloc_as()
138 vhost_iotlb_reset(&as->iotlb); in vhost_vdpa_remove_as()
688 struct vhost_iotlb *iotlb, in vhost_vdpa_pa_unmap() argument
696 while ((map = vhost_iotlb_itree_first(iotlb, start, last)) != NULL) { in vhost_vdpa_pa_unmap()
706 vhost_iotlb_map_free(iotlb, map); in vhost_vdpa_pa_unmap()
711 struct vhost_iotlb *iotlb, in vhost_vdpa_va_unmap() argument
717 while ((map = vhost_iotlb_itree_first(iotlb, start, last)) != NULL) { in vhost_vdpa_va_unmap()
721 vhost_iotlb_map_free(iotlb, map); in vhost_vdpa_va_unmap()
726 struct vhost_iotlb *iotlb, in vhost_vdpa_iotlb_unmap() argument
732 return vhost_vdpa_va_unmap(v, iotlb, start, last); in vhost_vdpa_iotlb_unmap()
734 return vhost_vdpa_pa_unmap(v, iotlb, start, last); in vhost_vdpa_iotlb_unmap()
759 static int vhost_vdpa_map(struct vhost_vdpa *v, struct vhost_iotlb *iotlb, in vhost_vdpa_map() argument
765 u32 asid = iotlb_to_asid(iotlb); in vhost_vdpa_map()
768 r = vhost_iotlb_add_range_ctx(iotlb, iova, iova + size - 1, in vhost_vdpa_map()
777 r = ops->set_map(vdpa, asid, iotlb); in vhost_vdpa_map()
783 vhost_iotlb_del_range(iotlb, iova, iova + size - 1); in vhost_vdpa_map()
794 struct vhost_iotlb *iotlb, in vhost_vdpa_unmap() argument
799 u32 asid = iotlb_to_asid(iotlb); in vhost_vdpa_unmap()
801 vhost_vdpa_iotlb_unmap(v, iotlb, iova, iova + size - 1); in vhost_vdpa_unmap()
807 ops->set_map(vdpa, asid, iotlb); in vhost_vdpa_unmap()
815 if (!v->in_batch && !iotlb->nmaps) in vhost_vdpa_unmap()
820 struct vhost_iotlb *iotlb, in vhost_vdpa_va_map() argument
850 ret = vhost_vdpa_map(v, iotlb, map_iova, map_size, uaddr, in vhost_vdpa_va_map()
863 vhost_vdpa_unmap(v, iotlb, iova, map_iova - iova); in vhost_vdpa_va_map()
871 struct vhost_iotlb *iotlb, in vhost_vdpa_pa_map() argument
935 ret = vhost_vdpa_map(v, iotlb, iova, csize, in vhost_vdpa_pa_map()
965 ret = vhost_vdpa_map(v, iotlb, iova, PFN_PHYS(last_pfn - map_pfn + 1), in vhost_vdpa_pa_map()
985 vhost_vdpa_unmap(v, iotlb, start, size); in vhost_vdpa_pa_map()
996 struct vhost_iotlb *iotlb, in vhost_vdpa_process_iotlb_update() argument
1006 if (vhost_iotlb_itree_first(iotlb, msg->iova, in vhost_vdpa_process_iotlb_update()
1011 return vhost_vdpa_va_map(v, iotlb, msg->iova, msg->size, in vhost_vdpa_process_iotlb_update()
1014 return vhost_vdpa_pa_map(v, iotlb, msg->iova, msg->size, msg->uaddr, in vhost_vdpa_process_iotlb_update()
1024 struct vhost_iotlb *iotlb = NULL; in vhost_vdpa_process_iotlb_msg() local
1043 iotlb = &as->iotlb; in vhost_vdpa_process_iotlb_msg()
1045 iotlb = asid_to_iotlb(v, asid); in vhost_vdpa_process_iotlb_msg()
1047 if ((v->in_batch && v->batch_asid != asid) || !iotlb) { in vhost_vdpa_process_iotlb_msg()
1052 if (!iotlb) in vhost_vdpa_process_iotlb_msg()
1060 r = vhost_vdpa_process_iotlb_update(v, iotlb, msg); in vhost_vdpa_process_iotlb_msg()
1063 vhost_vdpa_unmap(v, iotlb, msg->iova, msg->size); in vhost_vdpa_process_iotlb_msg()
1071 ops->set_map(vdpa, asid, iotlb); in vhost_vdpa_process_iotlb_msg()
1073 if (!iotlb->nmaps) in vhost_vdpa_process_iotlb_msg()