|
|
ddf19c |
From b395ad369278d0923a590975fabbb99ec7716c6b Mon Sep 17 00:00:00 2001
|
|
|
ddf19c |
From: Julia Suvorova <jusual@redhat.com>
|
|
|
ddf19c |
Date: Wed, 19 Feb 2020 21:34:28 +0000
|
|
|
ddf19c |
Subject: [PATCH 4/7] virtio: add ability to delete vq through a pointer
|
|
|
ddf19c |
MIME-Version: 1.0
|
|
|
ddf19c |
Content-Type: text/plain; charset=UTF-8
|
|
|
ddf19c |
Content-Transfer-Encoding: 8bit
|
|
|
ddf19c |
|
|
|
ddf19c |
RH-Author: Julia Suvorova <jusual@redhat.com>
|
|
|
ddf19c |
Message-id: <20200219213431.11913-2-jusual@redhat.com>
|
|
|
ddf19c |
Patchwork-id: 93980
|
|
|
ddf19c |
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH 1/4] virtio: add ability to delete vq through a pointer
|
|
|
ddf19c |
Bugzilla: 1791590
|
|
|
ddf19c |
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
ddf19c |
|
|
|
ddf19c |
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
|
ddf19c |
|
|
|
ddf19c |
Devices tend to maintain vq pointers, allow deleting them trough a vq pointer.
|
|
|
ddf19c |
|
|
|
ddf19c |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
ddf19c |
Reviewed-by: David Hildenbrand <david@redhat.com>
|
|
|
ddf19c |
Reviewed-by: David Hildenbrand <david@redhat.com>
|
|
|
ddf19c |
(cherry picked from commit 722f8c51d8af223751dfb1d02de40043e8ba067e)
|
|
|
ddf19c |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
ddf19c |
---
|
|
|
ddf19c |
hw/virtio/virtio.c | 15 ++++++++++-----
|
|
|
ddf19c |
include/hw/virtio/virtio.h | 2 ++
|
|
|
ddf19c |
2 files changed, 12 insertions(+), 5 deletions(-)
|
|
|
ddf19c |
|
|
|
ddf19c |
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
|
|
|
ddf19c |
index 3211135..d63a369 100644
|
|
|
ddf19c |
--- a/hw/virtio/virtio.c
|
|
|
ddf19c |
+++ b/hw/virtio/virtio.c
|
|
|
ddf19c |
@@ -2335,17 +2335,22 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
|
|
|
ddf19c |
return &vdev->vq[i];
|
|
|
ddf19c |
}
|
|
|
ddf19c |
|
|
|
ddf19c |
+void virtio_delete_queue(VirtQueue *vq)
|
|
|
ddf19c |
+{
|
|
|
ddf19c |
+ vq->vring.num = 0;
|
|
|
ddf19c |
+ vq->vring.num_default = 0;
|
|
|
ddf19c |
+ vq->handle_output = NULL;
|
|
|
ddf19c |
+ vq->handle_aio_output = NULL;
|
|
|
ddf19c |
+ g_free(vq->used_elems);
|
|
|
ddf19c |
+}
|
|
|
ddf19c |
+
|
|
|
ddf19c |
void virtio_del_queue(VirtIODevice *vdev, int n)
|
|
|
ddf19c |
{
|
|
|
ddf19c |
if (n < 0 || n >= VIRTIO_QUEUE_MAX) {
|
|
|
ddf19c |
abort();
|
|
|
ddf19c |
}
|
|
|
ddf19c |
|
|
|
ddf19c |
- vdev->vq[n].vring.num = 0;
|
|
|
ddf19c |
- vdev->vq[n].vring.num_default = 0;
|
|
|
ddf19c |
- vdev->vq[n].handle_output = NULL;
|
|
|
ddf19c |
- vdev->vq[n].handle_aio_output = NULL;
|
|
|
ddf19c |
- g_free(vdev->vq[n].used_elems);
|
|
|
ddf19c |
+ virtio_delete_queue(&vdev->vq[n]);
|
|
|
ddf19c |
}
|
|
|
ddf19c |
|
|
|
ddf19c |
static void virtio_set_isr(VirtIODevice *vdev, int value)
|
|
|
ddf19c |
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
|
|
|
ddf19c |
index 6a20442..91167f6 100644
|
|
|
ddf19c |
--- a/include/hw/virtio/virtio.h
|
|
|
ddf19c |
+++ b/include/hw/virtio/virtio.h
|
|
|
ddf19c |
@@ -183,6 +183,8 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
|
|
|
ddf19c |
|
|
|
ddf19c |
void virtio_del_queue(VirtIODevice *vdev, int n);
|
|
|
ddf19c |
|
|
|
ddf19c |
+void virtio_delete_queue(VirtQueue *vq);
|
|
|
ddf19c |
+
|
|
|
ddf19c |
void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
|
|
|
ddf19c |
unsigned int len);
|
|
|
ddf19c |
void virtqueue_flush(VirtQueue *vq, unsigned int count);
|
|
|
ddf19c |
--
|
|
|
ddf19c |
1.8.3.1
|
|
|
ddf19c |
|