[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v6 15/23] vhost: Add vhost_iova_tree_find
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH v6 15/23] vhost: Add vhost_iova_tree_find |
Date: |
Mon, 11 Apr 2022 16:50:18 +0200 |
Just a simple wrapper so we can find DMAMap entries based on iova
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost-iova-tree.h | 2 ++
hw/virtio/vhost-iova-tree.c | 14 ++++++++++++++
2 files changed, 16 insertions(+)
diff --git a/hw/virtio/vhost-iova-tree.h b/hw/virtio/vhost-iova-tree.h
index 6a4f24e0f9..1ffcdc5b57 100644
--- a/hw/virtio/vhost-iova-tree.h
+++ b/hw/virtio/vhost-iova-tree.h
@@ -19,6 +19,8 @@ VhostIOVATree *vhost_iova_tree_new(uint64_t iova_first,
uint64_t iova_last);
void vhost_iova_tree_delete(VhostIOVATree *iova_tree);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(VhostIOVATree, vhost_iova_tree_delete);
+const DMAMap *vhost_iova_tree_find(const VhostIOVATree *iova_tree,
+ const DMAMap *map);
const DMAMap *vhost_iova_tree_find_iova(const VhostIOVATree *iova_tree,
const DMAMap *map);
int vhost_iova_tree_map_alloc(VhostIOVATree *iova_tree, DMAMap *map);
diff --git a/hw/virtio/vhost-iova-tree.c b/hw/virtio/vhost-iova-tree.c
index 55fed1fefb..7d4e8ac499 100644
--- a/hw/virtio/vhost-iova-tree.c
+++ b/hw/virtio/vhost-iova-tree.c
@@ -56,6 +56,20 @@ void vhost_iova_tree_delete(VhostIOVATree *iova_tree)
g_free(iova_tree);
}
+/**
+ * Find a mapping in the tree that matches map
+ *
+ * @iova_tree The iova tree
+ * @map The map
+ *
+ * Return a matching map that contains argument map or NULL
+ */
+const DMAMap *vhost_iova_tree_find(const VhostIOVATree *iova_tree,
+ const DMAMap *map)
+{
+ return iova_tree_find(iova_tree->iova_taddr_map, map);
+}
+
/**
* Find the IOVA address stored from a memory address
*
--
2.27.0
- [RFC PATCH v6 04/23] hw/virtio: Replace g_memdup() by g_memdup2(), (continued)
- [RFC PATCH v6 04/23] hw/virtio: Replace g_memdup() by g_memdup2(), Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 02/23] vdpa: Fix bad index calculus at vhost_vdpa_get_vring_base, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 06/23] vdpa: Add x-svq to NetdevVhostVDPAOptions, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 07/23] vhost: move descriptor translation to vhost_svq_vring_write_descs, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 09/23] virtio-net: Expose ctrl virtqueue logic, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 11/23] virtio: Make virtqueue_alloc_element non-static, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 10/23] vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 13/23] vhost: Add custom used buffer callback, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 08/23] vdpa: Fix index calculus at vhost_vdpa_svqs_start, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 14/23] vdpa: control virtqueue support on shadow virtqueue, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 15/23] vhost: Add vhost_iova_tree_find,
Eugenio Pérez <=
- [RFC PATCH v6 18/23] vdpa: add NetClientState->start() callback, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 12/23] vhost: Add SVQElement, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 21/23] vhost: Make possible to check for device exclusive vq group, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 19/23] vdpa: Add vhost_vdpa_start_control_svq, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 16/23] vdpa: Add map/unmap operation callback to SVQ, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 23/23] vdpa: Add x-cvq-svq, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 17/23] vhost: Add vhost_svq_inject, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 20/23] vhost: Update kernel headers, Eugenio Pérez, 2022/04/11
- [RFC PATCH v6 22/23] vdpa: Add asid attribute to vdpa device, Eugenio Pérez, 2022/04/11