2019-08-02 06:59:09 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright (c) 2017 Red Hat, Inc.
|
2017-10-05 08:36:14 +00:00
|
|
|
*/
|
2019-08-02 06:59:09 +00:00
|
|
|
|
2017-10-05 08:36:14 +00:00
|
|
|
#ifndef _VHOST_IOTLB_H_
|
|
|
|
#define _VHOST_IOTLB_H_
|
|
|
|
|
2017-10-05 08:36:15 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2017-10-05 08:36:14 +00:00
|
|
|
#include "vhost.h"
|
|
|
|
|
|
|
|
static __rte_always_inline void
|
|
|
|
vhost_user_iotlb_rd_lock(struct vhost_virtqueue *vq)
|
|
|
|
{
|
|
|
|
rte_rwlock_read_lock(&vq->iotlb_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __rte_always_inline void
|
|
|
|
vhost_user_iotlb_rd_unlock(struct vhost_virtqueue *vq)
|
|
|
|
{
|
|
|
|
rte_rwlock_read_unlock(&vq->iotlb_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __rte_always_inline void
|
|
|
|
vhost_user_iotlb_wr_lock(struct vhost_virtqueue *vq)
|
|
|
|
{
|
|
|
|
rte_rwlock_write_lock(&vq->iotlb_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
static __rte_always_inline void
|
|
|
|
vhost_user_iotlb_wr_unlock(struct vhost_virtqueue *vq)
|
|
|
|
{
|
|
|
|
rte_rwlock_write_unlock(&vq->iotlb_lock);
|
|
|
|
}
|
|
|
|
|
|
|
|
void vhost_user_iotlb_cache_insert(struct vhost_virtqueue *vq, uint64_t iova,
|
|
|
|
uint64_t uaddr, uint64_t size,
|
|
|
|
uint8_t perm);
|
|
|
|
void vhost_user_iotlb_cache_remove(struct vhost_virtqueue *vq,
|
|
|
|
uint64_t iova, uint64_t size);
|
|
|
|
uint64_t vhost_user_iotlb_cache_find(struct vhost_virtqueue *vq, uint64_t iova,
|
|
|
|
uint64_t *size, uint8_t perm);
|
2017-10-05 08:36:15 +00:00
|
|
|
bool vhost_user_iotlb_pending_miss(struct vhost_virtqueue *vq, uint64_t iova,
|
|
|
|
uint8_t perm);
|
|
|
|
void vhost_user_iotlb_pending_insert(struct vhost_virtqueue *vq, uint64_t iova,
|
|
|
|
uint8_t perm);
|
2018-02-05 15:04:57 +00:00
|
|
|
void vhost_user_iotlb_pending_remove(struct vhost_virtqueue *vq, uint64_t iova,
|
|
|
|
uint64_t size, uint8_t perm);
|
2018-08-02 17:21:22 +00:00
|
|
|
void vhost_user_iotlb_flush_all(struct vhost_virtqueue *vq);
|
2017-10-05 08:36:14 +00:00
|
|
|
int vhost_user_iotlb_init(struct virtio_net *dev, int vq_index);
|
|
|
|
|
|
|
|
#endif /* _VHOST_IOTLB_H_ */
|