xref: /qemu/hw/virtio/vhost-iova-tree.h (revision fc524567087c2537b5103cdfc1d41e4f442892b6)
1ec6122d8SEugenio Pérez /*
2ec6122d8SEugenio Pérez  * vhost software live migration iova tree
3ec6122d8SEugenio Pérez  *
4ec6122d8SEugenio Pérez  * SPDX-FileCopyrightText: Red Hat, Inc. 2021
5ec6122d8SEugenio Pérez  * SPDX-FileContributor: Author: Eugenio Pérez <eperezma@redhat.com>
6ec6122d8SEugenio Pérez  *
7ec6122d8SEugenio Pérez  * SPDX-License-Identifier: GPL-2.0-or-later
8ec6122d8SEugenio Pérez  */
9ec6122d8SEugenio Pérez 
10ec6122d8SEugenio Pérez #ifndef HW_VIRTIO_VHOST_IOVA_TREE_H
11ec6122d8SEugenio Pérez #define HW_VIRTIO_VHOST_IOVA_TREE_H
12ec6122d8SEugenio Pérez 
13ec6122d8SEugenio Pérez #include "qemu/iova-tree.h"
14*8be545baSRichard Henderson #include "system/memory.h"
15ec6122d8SEugenio Pérez 
16ec6122d8SEugenio Pérez typedef struct VhostIOVATree VhostIOVATree;
17ec6122d8SEugenio Pérez 
18ec6122d8SEugenio Pérez VhostIOVATree *vhost_iova_tree_new(uint64_t iova_first, uint64_t iova_last);
19ec6122d8SEugenio Pérez void vhost_iova_tree_delete(VhostIOVATree *iova_tree);
20ec6122d8SEugenio Pérez G_DEFINE_AUTOPTR_CLEANUP_FUNC(VhostIOVATree, vhost_iova_tree_delete);
21ec6122d8SEugenio Pérez 
22ec6122d8SEugenio Pérez const DMAMap *vhost_iova_tree_find_iova(const VhostIOVATree *iova_tree,
23ec6122d8SEugenio Pérez                                         const DMAMap *map);
2492cf61e7SJonah Palmer int vhost_iova_tree_map_alloc(VhostIOVATree *iova_tree, DMAMap *map,
2592cf61e7SJonah Palmer                               hwaddr taddr);
2669292a8eSEugenio Pérez void vhost_iova_tree_remove(VhostIOVATree *iova_tree, DMAMap map);
2705063f55SJonah Palmer const DMAMap *vhost_iova_tree_find_gpa(const VhostIOVATree *iova_tree,
2805063f55SJonah Palmer                                        const DMAMap *map);
2905063f55SJonah Palmer int vhost_iova_tree_map_alloc_gpa(VhostIOVATree *iova_tree, DMAMap *map,
3005063f55SJonah Palmer                                   hwaddr taddr);
3105063f55SJonah Palmer void vhost_iova_tree_remove_gpa(VhostIOVATree *iova_tree, DMAMap map);
32ec6122d8SEugenio Pérez 
33ec6122d8SEugenio Pérez #endif
34