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