1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2017 Red Hat, Inc.
5 #ifndef _VHOST_IOTLB_H_
6 #define _VHOST_IOTLB_H_
12 static __rte_always_inline void
13 vhost_user_iotlb_rd_lock(struct vhost_virtqueue *vq)
15 rte_rwlock_read_lock(&vq->iotlb_lock);
18 static __rte_always_inline void
19 vhost_user_iotlb_rd_unlock(struct vhost_virtqueue *vq)
21 rte_rwlock_read_unlock(&vq->iotlb_lock);
24 static __rte_always_inline void
25 vhost_user_iotlb_wr_lock(struct vhost_virtqueue *vq)
27 rte_rwlock_write_lock(&vq->iotlb_lock);
30 static __rte_always_inline void
31 vhost_user_iotlb_wr_unlock(struct vhost_virtqueue *vq)
33 rte_rwlock_write_unlock(&vq->iotlb_lock);
36 void vhost_user_iotlb_cache_insert(struct vhost_virtqueue *vq, uint64_t iova,
37 uint64_t uaddr, uint64_t size,
39 void vhost_user_iotlb_cache_remove(struct vhost_virtqueue *vq,
40 uint64_t iova, uint64_t size);
41 uint64_t vhost_user_iotlb_cache_find(struct vhost_virtqueue *vq, uint64_t iova,
42 uint64_t *size, uint8_t perm);
43 bool vhost_user_iotlb_pending_miss(struct vhost_virtqueue *vq, uint64_t iova,
45 void vhost_user_iotlb_pending_insert(struct vhost_virtqueue *vq, uint64_t iova,
47 void vhost_user_iotlb_pending_remove(struct vhost_virtqueue *vq, uint64_t iova,
48 uint64_t size, uint8_t perm);
49 void vhost_user_iotlb_flush_all(struct vhost_virtqueue *vq);
50 int vhost_user_iotlb_init(struct virtio_net *dev, int vq_index);
52 #endif /* _VHOST_IOTLB_H_ */