69292a8e40
It's convenient to call iova_tree_remove from a map returned from iova_tree_find or iova_tree_find_iova. With the current code this is not possible, since we will free it, and then we will try to search for it again. Fix it making accepting the map by value, forcing a copy of the argument. Not applying a fixes tag, since there is no use like that at the moment. Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
28 lines
870 B
C
28 lines
870 B
C
/*
|
|
* vhost software live migration iova tree
|
|
*
|
|
* SPDX-FileCopyrightText: Red Hat, Inc. 2021
|
|
* SPDX-FileContributor: Author: Eugenio Pérez <eperezma@redhat.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#ifndef HW_VIRTIO_VHOST_IOVA_TREE_H
|
|
#define HW_VIRTIO_VHOST_IOVA_TREE_H
|
|
|
|
#include "qemu/iova-tree.h"
|
|
#include "exec/memory.h"
|
|
|
|
typedef struct VhostIOVATree VhostIOVATree;
|
|
|
|
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_iova(const VhostIOVATree *iova_tree,
|
|
const DMAMap *map);
|
|
int vhost_iova_tree_map_alloc(VhostIOVATree *iova_tree, DMAMap *map);
|
|
void vhost_iova_tree_remove(VhostIOVATree *iova_tree, DMAMap map);
|
|
|
|
#endif
|