Blame SOURCES/kvm-vdpa-Remove-SVQ-vring-from-iova_tree-at-shutdown.patch

586cba
From 51c1e9cf1612727ec4c6e795576ae8fa0c0b2d4c Mon Sep 17 00:00:00 2001
586cba
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
586cba
Date: Tue, 23 Aug 2022 20:20:05 +0200
586cba
Subject: [PATCH 07/23] vdpa: Remove SVQ vring from iova_tree at shutdown
586cba
MIME-Version: 1.0
586cba
Content-Type: text/plain; charset=UTF-8
586cba
Content-Transfer-Encoding: 8bit
586cba
586cba
RH-Author: Eugenio Pérez <eperezma@redhat.com>
586cba
RH-MergeRequest: 116: vdpa: Restore device state on destination
586cba
RH-Bugzilla: 2114060
586cba
RH-Acked-by: Cindy Lu <lulu@redhat.com>
586cba
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
586cba
RH-Commit: [6/21] f72e67b9c90103151cbf86bff53e8f14b30f0e5b (eperezmartin/qemu-kvm)
586cba
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2114060
586cba
Upstream status: git@github.com:jasowang/qemu.git net-next
586cba
586cba
Although the device will be reset before usage, the right thing to do is
586cba
to clean it.
586cba
586cba
Reported-by: Lei Yang <leiyang@redhat.com>
586cba
Fixes: 34e3c94eda ("vdpa: Add custom IOTLB translations to SVQ")
586cba
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
586cba
Signed-off-by: Jason Wang <jasowang@redhat.com>
586cba
(cherry picked from commit 0c45fa6c420ec3a1dd9ea9c40fa11bd943bb3be9)
586cba
---
586cba
 hw/virtio/vhost-vdpa.c | 6 ++++++
586cba
 1 file changed, 6 insertions(+)
586cba
586cba
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
586cba
index 39aa70f52d..e5c264fb29 100644
586cba
--- a/hw/virtio/vhost-vdpa.c
586cba
+++ b/hw/virtio/vhost-vdpa.c
586cba
@@ -896,6 +896,12 @@ static bool vhost_vdpa_svq_unmap_ring(struct vhost_vdpa *v,
586cba
 
586cba
     size = ROUND_UP(result->size, qemu_real_host_page_size);
586cba
     r = vhost_vdpa_dma_unmap(v, result->iova, size);
586cba
+    if (unlikely(r < 0)) {
586cba
+        error_report("Unable to unmap SVQ vring: %s (%d)", g_strerror(-r), -r);
586cba
+        return false;
586cba
+    }
586cba
+
586cba
+    vhost_iova_tree_remove(v->iova_tree, *result);
586cba
     return r == 0;
586cba
 }
586cba
 
586cba
-- 
586cba
2.31.1
586cba