Lines Matching refs:iotlb

41 	struct vhost_iotlb iotlb;  member
69 struct vhost_iotlb *iotlb, u64 start,
72 static inline u32 iotlb_to_asid(struct vhost_iotlb *iotlb) in iotlb_to_asid() argument
74 struct vhost_vdpa_as *as = container_of(iotlb, struct in iotlb_to_asid()
75 vhost_vdpa_as, iotlb); in iotlb_to_asid()
98 return &as->iotlb; in asid_to_iotlb()
116 vhost_iotlb_init(&as->iotlb, 0, 0); in vhost_vdpa_alloc_as()
142 vhost_vdpa_iotlb_unmap(v, &as->iotlb, 0ULL, 0ULL - 1, asid); in vhost_vdpa_remove_as()
702 static void vhost_vdpa_pa_unmap(struct vhost_vdpa *v, struct vhost_iotlb *iotlb, in vhost_vdpa_pa_unmap() argument
710 while ((map = vhost_iotlb_itree_first(iotlb, start, last)) != NULL) { in vhost_vdpa_pa_unmap()
721 vhost_iotlb_map_free(iotlb, map); in vhost_vdpa_pa_unmap()
725 static void vhost_vdpa_va_unmap(struct vhost_vdpa *v, struct vhost_iotlb *iotlb, in vhost_vdpa_va_unmap() argument
731 while ((map = vhost_iotlb_itree_first(iotlb, start, last)) != NULL) { in vhost_vdpa_va_unmap()
736 vhost_iotlb_map_free(iotlb, map); in vhost_vdpa_va_unmap()
741 struct vhost_iotlb *iotlb, u64 start, in vhost_vdpa_iotlb_unmap() argument
747 return vhost_vdpa_va_unmap(v, iotlb, start, last, asid); in vhost_vdpa_iotlb_unmap()
749 return vhost_vdpa_pa_unmap(v, iotlb, start, last, asid); in vhost_vdpa_iotlb_unmap()
774 static int vhost_vdpa_map(struct vhost_vdpa *v, struct vhost_iotlb *iotlb, in vhost_vdpa_map() argument
780 u32 asid = iotlb_to_asid(iotlb); in vhost_vdpa_map()
783 r = vhost_iotlb_add_range_ctx(iotlb, iova, iova + size - 1, in vhost_vdpa_map()
792 r = ops->set_map(vdpa, asid, iotlb); in vhost_vdpa_map()
798 vhost_iotlb_del_range(iotlb, iova, iova + size - 1); in vhost_vdpa_map()
809 struct vhost_iotlb *iotlb, in vhost_vdpa_unmap() argument
814 u32 asid = iotlb_to_asid(iotlb); in vhost_vdpa_unmap()
816 vhost_vdpa_iotlb_unmap(v, iotlb, iova, iova + size - 1, asid); in vhost_vdpa_unmap()
820 ops->set_map(vdpa, asid, iotlb); in vhost_vdpa_unmap()
825 if (!v->in_batch && !iotlb->nmaps) in vhost_vdpa_unmap()
830 struct vhost_iotlb *iotlb, in vhost_vdpa_va_map() argument
860 ret = vhost_vdpa_map(v, iotlb, map_iova, map_size, uaddr, in vhost_vdpa_va_map()
873 vhost_vdpa_unmap(v, iotlb, iova, map_iova - iova); in vhost_vdpa_va_map()
881 struct vhost_iotlb *iotlb, in vhost_vdpa_pa_map() argument
945 ret = vhost_vdpa_map(v, iotlb, iova, csize, in vhost_vdpa_pa_map()
975 ret = vhost_vdpa_map(v, iotlb, iova, PFN_PHYS(last_pfn - map_pfn + 1), in vhost_vdpa_pa_map()
995 vhost_vdpa_unmap(v, iotlb, start, size); in vhost_vdpa_pa_map()
1006 struct vhost_iotlb *iotlb, in vhost_vdpa_process_iotlb_update() argument
1016 if (vhost_iotlb_itree_first(iotlb, msg->iova, in vhost_vdpa_process_iotlb_update()
1021 return vhost_vdpa_va_map(v, iotlb, msg->iova, msg->size, in vhost_vdpa_process_iotlb_update()
1024 return vhost_vdpa_pa_map(v, iotlb, msg->iova, msg->size, msg->uaddr, in vhost_vdpa_process_iotlb_update()
1034 struct vhost_iotlb *iotlb = NULL; in vhost_vdpa_process_iotlb_msg() local
1053 iotlb = &as->iotlb; in vhost_vdpa_process_iotlb_msg()
1055 iotlb = asid_to_iotlb(v, asid); in vhost_vdpa_process_iotlb_msg()
1057 if ((v->in_batch && v->batch_asid != asid) || !iotlb) { in vhost_vdpa_process_iotlb_msg()
1062 if (!iotlb) in vhost_vdpa_process_iotlb_msg()
1070 r = vhost_vdpa_process_iotlb_update(v, iotlb, msg); in vhost_vdpa_process_iotlb_msg()
1073 vhost_vdpa_unmap(v, iotlb, msg->iova, msg->size); in vhost_vdpa_process_iotlb_msg()
1081 ops->set_map(vdpa, asid, iotlb); in vhost_vdpa_process_iotlb_msg()
1083 if (!iotlb->nmaps) in vhost_vdpa_process_iotlb_msg()