mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00

Creates and supports a GPA->IOVA tree and a partial IOVA->HVA tree by splitting up guest-backed memory maps and host-only memory maps from the full IOVA->HVA tree. That is, any guest-backed memory maps are now stored in the GPA->IOVA tree and host-only memory maps stay in the IOVA->HVA tree. Also propagates the GPAs (in_addr/out_addr) of a VirtQueueElement to vhost_svq_translate_addr() to translate GPAs to IOVAs via the GPA->IOVA tree (when descriptors are backed by guest memory). For descriptors backed by host-only memory, the existing partial SVQ IOVA->HVA tree is used. GPAs are unique in the guest's address space, ensuring unambiguous IOVA translations. This avoids the issue where different GPAs map to the same HVA, causing the original HVA->IOVA translation to potentially return an IOVA associated with the wrong intended GPA. Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com> Acked-by: Eugenio Pérez <eperezma@redhat.com> Message-Id: <20250217144936.3589907-3-jonah.palmer@oracle.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
33 lines
1.2 KiB
C
33 lines
1.2 KiB
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,
|
|
hwaddr taddr);
|
|
void vhost_iova_tree_remove(VhostIOVATree *iova_tree, DMAMap map);
|
|
const DMAMap *vhost_iova_tree_find_gpa(const VhostIOVATree *iova_tree,
|
|
const DMAMap *map);
|
|
int vhost_iova_tree_map_alloc_gpa(VhostIOVATree *iova_tree, DMAMap *map,
|
|
hwaddr taddr);
|
|
void vhost_iova_tree_remove_gpa(VhostIOVATree *iova_tree, DMAMap map);
|
|
|
|
#endif
|