xref: /qemu/hw/virtio/vhost-iova-tree.h (revision a6af54434400099b8afd59ba036cf9a662006d1e)
1 /*
2  * vhost software live migration iova tree
3  *
4  * SPDX-FileCopyrightText: Red Hat, Inc. 2021
5  * SPDX-FileContributor: Author: Eugenio PĂ©rez <eperezma@redhat.com>
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 #ifndef HW_VIRTIO_VHOST_IOVA_TREE_H
11 #define HW_VIRTIO_VHOST_IOVA_TREE_H
12 
13 #include "qemu/iova-tree.h"
14 #include "exec/memory.h"
15 
16 typedef struct VhostIOVATree VhostIOVATree;
17 
18 VhostIOVATree *vhost_iova_tree_new(uint64_t iova_first, uint64_t iova_last);
19 void vhost_iova_tree_delete(VhostIOVATree *iova_tree);
20 G_DEFINE_AUTOPTR_CLEANUP_FUNC(VhostIOVATree, vhost_iova_tree_delete);
21 
22 const DMAMap *vhost_iova_tree_find_iova(const VhostIOVATree *iova_tree,
23                                         const DMAMap *map);
24 int vhost_iova_tree_map_alloc(VhostIOVATree *iova_tree, DMAMap *map,
25                               hwaddr taddr);
26 void vhost_iova_tree_remove(VhostIOVATree *iova_tree, DMAMap map);
27 const DMAMap *vhost_iova_tree_find_gpa(const VhostIOVATree *iova_tree,
28                                        const DMAMap *map);
29 int vhost_iova_tree_map_alloc_gpa(VhostIOVATree *iova_tree, DMAMap *map,
30                                   hwaddr taddr);
31 void vhost_iova_tree_remove_gpa(VhostIOVATree *iova_tree, DMAMap map);
32 
33 #endif
34