19bc18cc9e
- kvm-vdpa-Skip-the-maps-not-in-the-iova-tree.patch [RHELX-57] - kvm-vdpa-do-not-save-failed-dma-maps-in-SVQ-iova-tree.patch [RHELX-57] - kvm-util-accept-iova_tree_remove_parameter-by-value.patch [RHELX-57] - kvm-vdpa-Remove-SVQ-vring-from-iova_tree-at-shutdown.patch [RHELX-57] - kvm-vdpa-Make-SVQ-vring-unmapping-return-void.patch [RHELX-57] - kvm-vhost-Always-store-new-kick-fd-on-vhost_svq_set_svq_.patch [RHELX-57] - kvm-vdpa-Use-ring-hwaddr-at-vhost_vdpa_svq_unmap_ring.patch [RHELX-57] - kvm-vhost-stop-transfer-elem-ownership-in-vhost_handle_g.patch [RHELX-57] - kvm-vhost-use-SVQ-element-ndescs-instead-of-opaque-data-.patch [RHELX-57] - kvm-vhost-Delete-useless-read-memory-barrier.patch [RHELX-57] - kvm-vhost-Do-not-depend-on-NULL-VirtQueueElement-on-vhos.patch [RHELX-57] - kvm-vhost_net-Add-NetClientInfo-start-callback.patch [RHELX-57] - kvm-vhost_net-Add-NetClientInfo-stop-callback.patch [RHELX-57] - kvm-vdpa-add-net_vhost_vdpa_cvq_info-NetClientInfo.patch [RHELX-57] - kvm-vdpa-Move-command-buffers-map-to-start-of-net-device.patch [RHELX-57] - kvm-vdpa-extract-vhost_vdpa_net_cvq_add-from-vhost_vdpa_.patch [RHELX-57] - kvm-vhost_net-add-NetClientState-load-callback.patch [RHELX-57] - kvm-vdpa-Add-virtio-net-mac-address-via-CVQ-at-start.patch [RHELX-57] - kvm-vdpa-Delete-CVQ-migration-blocker.patch [RHELX-57] - kvm-vdpa-Make-VhostVDPAState-cvq_cmd_in_buffer-control-a.patch [RHELX-57] - kvm-vdpa-extract-vhost_vdpa_net_load_mac-from-vhost_vdpa.patch [RHELX-57] - kvm-vdpa-Add-vhost_vdpa_net_load_mq.patch [RHELX-57] - kvm-vdpa-validate-MQ-CVQ-commands.patch [RHELX-57] - kvm-virtio-net-Update-virtio-net-curr_queue_pairs-in-vdp.patch [RHELX-57] - kvm-vdpa-Allow-MQ-feature-in-SVQ.patch [RHELX-57] - kvm-i386-reset-KVM-nested-state-upon-CPU-reset.patch [bz#2125281] - kvm-i386-do-kvm_put_msr_feature_control-first-thing-when.patch [bz#2125281] - kvm-Revert-Re-enable-capstone-internal-build.patch [bz#2127825] - kvm-spec-Use-capstone-package.patch [bz#2127825] - Resolves: RHELX-57 (vDPA SVQ Multiqueue support ) - Resolves: bz#2125281 ([RHEL9.1] Guests in VMX root operation fail to reboot with QEMU's 'system_reset' command [rhel-9.2.0]) - Resolves: bz#2127825 (Use capstone for qemu-kvm build)
183 lines
6.8 KiB
Diff
183 lines
6.8 KiB
Diff
From 3320d1883222bc551cf8ffd048882be4a97e872f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
|
|
Date: Tue, 23 Aug 2022 20:20:04 +0200
|
|
Subject: [PATCH 03/29] util: accept iova_tree_remove_parameter by value
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
RH-Author: Laurent Vivier <lvivier@redhat.com>
|
|
RH-MergeRequest: 117: vDPA SVQ Multiqueue support
|
|
RH-Jira: RHELX-57
|
|
RH-Acked-by: Jason Wang <jasowang@redhat.com>
|
|
RH-Acked-by: Cindy Lu <lulu@redhat.com>
|
|
RH-Acked-by: Eugenio Pérez <eperezma@redhat.com>
|
|
RH-Commit: [3/25] 98190376f758aed31bc31ce3e478438787eb357c (redhat/centos-stream/src/qemu-kvm)
|
|
|
|
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>
|
|
(cherry picked from commit 69292a8e40f4dae8af5f04724e06392cdf03c09e)
|
|
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
|
|
---
|
|
hw/i386/intel_iommu.c | 6 +++---
|
|
hw/virtio/vhost-iova-tree.c | 2 +-
|
|
hw/virtio/vhost-iova-tree.h | 2 +-
|
|
hw/virtio/vhost-vdpa.c | 6 +++---
|
|
include/qemu/iova-tree.h | 2 +-
|
|
net/vhost-vdpa.c | 4 ++--
|
|
util/iova-tree.c | 4 ++--
|
|
7 files changed, 13 insertions(+), 13 deletions(-)
|
|
|
|
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
|
|
index 2162394e08..05d53a1aa9 100644
|
|
--- a/hw/i386/intel_iommu.c
|
|
+++ b/hw/i386/intel_iommu.c
|
|
@@ -1187,7 +1187,7 @@ static int vtd_page_walk_one(IOMMUTLBEvent *event, vtd_page_walk_info *info)
|
|
return ret;
|
|
}
|
|
/* Drop any existing mapping */
|
|
- iova_tree_remove(as->iova_tree, &target);
|
|
+ iova_tree_remove(as->iova_tree, target);
|
|
/* Recover the correct type */
|
|
event->type = IOMMU_NOTIFIER_MAP;
|
|
entry->perm = cache_perm;
|
|
@@ -1200,7 +1200,7 @@ static int vtd_page_walk_one(IOMMUTLBEvent *event, vtd_page_walk_info *info)
|
|
trace_vtd_page_walk_one_skip_unmap(entry->iova, entry->addr_mask);
|
|
return 0;
|
|
}
|
|
- iova_tree_remove(as->iova_tree, &target);
|
|
+ iova_tree_remove(as->iova_tree, target);
|
|
}
|
|
|
|
trace_vtd_page_walk_one(info->domain_id, entry->iova,
|
|
@@ -3563,7 +3563,7 @@ static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
|
|
|
|
map.iova = n->start;
|
|
map.size = size;
|
|
- iova_tree_remove(as->iova_tree, &map);
|
|
+ iova_tree_remove(as->iova_tree, map);
|
|
}
|
|
|
|
static void vtd_address_space_unmap_all(IntelIOMMUState *s)
|
|
diff --git a/hw/virtio/vhost-iova-tree.c b/hw/virtio/vhost-iova-tree.c
|
|
index 67bf6d57ab..3d03395a77 100644
|
|
--- a/hw/virtio/vhost-iova-tree.c
|
|
+++ b/hw/virtio/vhost-iova-tree.c
|
|
@@ -104,7 +104,7 @@ int vhost_iova_tree_map_alloc(VhostIOVATree *tree, DMAMap *map)
|
|
* @iova_tree: The vhost iova tree
|
|
* @map: The map to remove
|
|
*/
|
|
-void vhost_iova_tree_remove(VhostIOVATree *iova_tree, const DMAMap *map)
|
|
+void vhost_iova_tree_remove(VhostIOVATree *iova_tree, DMAMap map)
|
|
{
|
|
iova_tree_remove(iova_tree->iova_taddr_map, map);
|
|
}
|
|
diff --git a/hw/virtio/vhost-iova-tree.h b/hw/virtio/vhost-iova-tree.h
|
|
index 6a4f24e0f9..4adfd79ff0 100644
|
|
--- a/hw/virtio/vhost-iova-tree.h
|
|
+++ b/hw/virtio/vhost-iova-tree.h
|
|
@@ -22,6 +22,6 @@ 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, const DMAMap *map);
|
|
+void vhost_iova_tree_remove(VhostIOVATree *iova_tree, DMAMap map);
|
|
|
|
#endif
|
|
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
|
|
index 7e28d2f674..87e0ad393f 100644
|
|
--- a/hw/virtio/vhost-vdpa.c
|
|
+++ b/hw/virtio/vhost-vdpa.c
|
|
@@ -240,7 +240,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener,
|
|
|
|
fail_map:
|
|
if (v->shadow_vqs_enabled) {
|
|
- vhost_iova_tree_remove(v->iova_tree, &mem_region);
|
|
+ vhost_iova_tree_remove(v->iova_tree, mem_region);
|
|
}
|
|
|
|
fail:
|
|
@@ -300,7 +300,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,
|
|
return;
|
|
}
|
|
iova = result->iova;
|
|
- vhost_iova_tree_remove(v->iova_tree, result);
|
|
+ vhost_iova_tree_remove(v->iova_tree, *result);
|
|
}
|
|
vhost_vdpa_iotlb_batch_begin_once(v);
|
|
ret = vhost_vdpa_dma_unmap(v, iova, int128_get64(llsize));
|
|
@@ -944,7 +944,7 @@ static bool vhost_vdpa_svq_map_ring(struct vhost_vdpa *v, DMAMap *needle,
|
|
needle->perm == IOMMU_RO);
|
|
if (unlikely(r != 0)) {
|
|
error_setg_errno(errp, -r, "Cannot map region to device");
|
|
- vhost_iova_tree_remove(v->iova_tree, needle);
|
|
+ vhost_iova_tree_remove(v->iova_tree, *needle);
|
|
}
|
|
|
|
return r == 0;
|
|
diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h
|
|
index 16bbfdf5f8..8528e5c98f 100644
|
|
--- a/include/qemu/iova-tree.h
|
|
+++ b/include/qemu/iova-tree.h
|
|
@@ -73,7 +73,7 @@ int iova_tree_insert(IOVATree *tree, const DMAMap *map);
|
|
* all the mappings that are included in the provided range will be
|
|
* removed from the tree. Here map->translated_addr is meaningless.
|
|
*/
|
|
-void iova_tree_remove(IOVATree *tree, const DMAMap *map);
|
|
+void iova_tree_remove(IOVATree *tree, DMAMap map);
|
|
|
|
/**
|
|
* iova_tree_find:
|
|
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
|
|
index 303447a68e..a49e7e649d 100644
|
|
--- a/net/vhost-vdpa.c
|
|
+++ b/net/vhost-vdpa.c
|
|
@@ -244,7 +244,7 @@ static void vhost_vdpa_cvq_unmap_buf(struct vhost_vdpa *v, void *addr)
|
|
error_report("Device cannot unmap: %s(%d)", g_strerror(r), r);
|
|
}
|
|
|
|
- vhost_iova_tree_remove(tree, map);
|
|
+ vhost_iova_tree_remove(tree, *map);
|
|
}
|
|
|
|
static size_t vhost_vdpa_net_cvq_cmd_len(void)
|
|
@@ -297,7 +297,7 @@ static bool vhost_vdpa_cvq_map_buf(struct vhost_vdpa *v,
|
|
return true;
|
|
|
|
dma_map_err:
|
|
- vhost_iova_tree_remove(v->iova_tree, &map);
|
|
+ vhost_iova_tree_remove(v->iova_tree, map);
|
|
return false;
|
|
}
|
|
|
|
diff --git a/util/iova-tree.c b/util/iova-tree.c
|
|
index fee530a579..536789797e 100644
|
|
--- a/util/iova-tree.c
|
|
+++ b/util/iova-tree.c
|
|
@@ -164,11 +164,11 @@ void iova_tree_foreach(IOVATree *tree, iova_tree_iterator iterator)
|
|
g_tree_foreach(tree->tree, iova_tree_traverse, iterator);
|
|
}
|
|
|
|
-void iova_tree_remove(IOVATree *tree, const DMAMap *map)
|
|
+void iova_tree_remove(IOVATree *tree, DMAMap map)
|
|
{
|
|
const DMAMap *overlap;
|
|
|
|
- while ((overlap = iova_tree_find(tree, map))) {
|
|
+ while ((overlap = iova_tree_find(tree, &map))) {
|
|
g_tree_remove(tree->tree, overlap);
|
|
}
|
|
}
|
|
--
|
|
2.31.1
|
|
|