|
|
016a62 |
From 0f56ff85e38a3925ba8c63af9fcf6a0708f0d10f Mon Sep 17 00:00:00 2001
|
|
|
016a62 |
From: Julia Suvorova <jusual@redhat.com>
|
|
|
016a62 |
Date: Tue, 4 Feb 2020 18:20:05 +0000
|
|
|
016a62 |
Subject: [PATCH 4/6] virtio: add ability to delete vq through a pointer
|
|
|
016a62 |
|
|
|
016a62 |
RH-Author: Julia Suvorova <jusual@redhat.com>
|
|
|
016a62 |
Message-id: <20200204182007.183537-3-jusual@redhat.com>
|
|
|
016a62 |
Patchwork-id: 93705
|
|
|
016a62 |
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH 2/4] virtio: add ability to delete vq through a pointer
|
|
|
016a62 |
Bugzilla: 1708480
|
|
|
016a62 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
016a62 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
016a62 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
016a62 |
|
|
|
016a62 |
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
|
016a62 |
|
|
|
016a62 |
Devices tend to maintain vq pointers, allow deleting them trough a vq pointer.
|
|
|
016a62 |
|
|
|
016a62 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
016a62 |
Reviewed-by: David Hildenbrand <david@redhat.com>
|
|
|
016a62 |
Reviewed-by: David Hildenbrand <david@redhat.com>
|
|
|
016a62 |
(cherry picked from commit 722f8c51d8af223751dfb1d02de40043e8ba067e)
|
|
|
016a62 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
016a62 |
---
|
|
|
016a62 |
hw/virtio/virtio.c | 13 +++++++++----
|
|
|
016a62 |
include/hw/virtio/virtio.h | 2 ++
|
|
|
016a62 |
2 files changed, 11 insertions(+), 4 deletions(-)
|
|
|
016a62 |
|
|
|
016a62 |
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
|
|
|
016a62 |
index 6356bf3..624f6e2 100644
|
|
|
016a62 |
--- a/hw/virtio/virtio.c
|
|
|
016a62 |
+++ b/hw/virtio/virtio.c
|
|
|
016a62 |
@@ -1601,16 +1601,21 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
|
|
|
016a62 |
return &vdev->vq[i];
|
|
|
016a62 |
}
|
|
|
016a62 |
|
|
|
016a62 |
+void virtio_delete_queue(VirtQueue *vq)
|
|
|
016a62 |
+{
|
|
|
016a62 |
+ vq->vring.num = 0;
|
|
|
016a62 |
+ vq->vring.num_default = 0;
|
|
|
016a62 |
+ vq->handle_output = NULL;
|
|
|
016a62 |
+ vq->handle_aio_output = NULL;
|
|
|
016a62 |
+}
|
|
|
016a62 |
+
|
|
|
016a62 |
void virtio_del_queue(VirtIODevice *vdev, int n)
|
|
|
016a62 |
{
|
|
|
016a62 |
if (n < 0 || n >= VIRTIO_QUEUE_MAX) {
|
|
|
016a62 |
abort();
|
|
|
016a62 |
}
|
|
|
016a62 |
|
|
|
016a62 |
- vdev->vq[n].vring.num = 0;
|
|
|
016a62 |
- vdev->vq[n].vring.num_default = 0;
|
|
|
016a62 |
- vdev->vq[n].handle_output = NULL;
|
|
|
016a62 |
- vdev->vq[n].handle_aio_output = NULL;
|
|
|
016a62 |
+ virtio_delete_queue(&vdev->vq[n]);
|
|
|
016a62 |
}
|
|
|
016a62 |
|
|
|
016a62 |
static void virtio_set_isr(VirtIODevice *vdev, int value)
|
|
|
016a62 |
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
|
|
|
016a62 |
index 9c1fa07..90471a1 100644
|
|
|
016a62 |
--- a/include/hw/virtio/virtio.h
|
|
|
016a62 |
+++ b/include/hw/virtio/virtio.h
|
|
|
016a62 |
@@ -163,6 +163,8 @@ VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
|
|
|
016a62 |
|
|
|
016a62 |
void virtio_del_queue(VirtIODevice *vdev, int n);
|
|
|
016a62 |
|
|
|
016a62 |
+void virtio_delete_queue(VirtQueue *vq);
|
|
|
016a62 |
+
|
|
|
016a62 |
void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem,
|
|
|
016a62 |
unsigned int len);
|
|
|
016a62 |
void virtqueue_flush(VirtQueue *vq, unsigned int count);
|
|
|
016a62 |
--
|
|
|
016a62 |
1.8.3.1
|
|
|
016a62 |
|