When stopping a vhost-vdpa device, only the first queue pair is marked as 
suspended,
while the remaining queues are not updated to the suspended state.
As a result, when stopping a multi-queue vhost-vdpa device,
the following error message will be printed.

qemu-system-x86_64:vhost VQ 2 ring restore failed: -1: Operation not permitted 
(1)

qemu-system-x86_64:vhost VQ 3 ring restore failed: -1: Operation not permitted 
(1)

Fixes: b6662cb7 ("vdpa: add vhost_vdpa->suspended parameter")

Signed-off-by: Wafer Xie <[email protected]>
---
 hw/virtio/vhost-vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 7061b6e1a3..2d5e6aca74 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -1481,7 +1481,7 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev 
*dev,
         return 0;
     }
 
-    if (!v->suspended) {
+    if (!v->suspended && vhost_vdpa_first_dev(dev)) {
         /*
          * Cannot trust in value returned by device, let vhost recover used
          * idx from guest.
-- 
2.34.1


Reply via email to