[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 03/15] virtio: introduce virtio_queue_reset()
From: |
Xuan Zhuo |
Subject: |
[PATCH v5 03/15] virtio: introduce virtio_queue_reset() |
Date: |
Wed, 14 Sep 2022 12:20:43 +0800 |
Introduce a new interface function virtio_queue_reset() to implement
reset for vq.
Add a new callback to VirtioDeviceClass for queue reset operation for
each child device.
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
---
hw/virtio/virtio.c | 11 +++++++++++
include/hw/virtio/virtio.h | 2 ++
2 files changed, 13 insertions(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 67d54832a9..0e9d41366f 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2039,6 +2039,17 @@ static void __virtio_queue_reset(VirtIODevice *vdev,
uint32_t i)
virtio_virtqueue_reset_region_cache(&vdev->vq[i]);
}
+void virtio_queue_reset(VirtIODevice *vdev, uint32_t queue_index)
+{
+ VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
+
+ if (k->queue_reset) {
+ k->queue_reset(vdev, queue_index);
+ }
+
+ __virtio_queue_reset(vdev, queue_index);
+}
+
void virtio_reset(void *opaque)
{
VirtIODevice *vdev = opaque;
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index db1c0ddf6b..879394299b 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -130,6 +130,7 @@ struct VirtioDeviceClass {
void (*set_config)(VirtIODevice *vdev, const uint8_t *config);
void (*reset)(VirtIODevice *vdev);
void (*set_status)(VirtIODevice *vdev, uint8_t val);
+ void (*queue_reset)(VirtIODevice *vdev, uint32_t queue_index);
/* For transitional devices, this is a bitmap of features
* that are only exposed on the legacy interface but not
* the modern one.
@@ -268,6 +269,7 @@ int virtio_queue_set_host_notifier_mr(VirtIODevice *vdev,
int n,
MemoryRegion *mr, bool assign);
int virtio_set_status(VirtIODevice *vdev, uint8_t val);
void virtio_reset(void *opaque);
+void virtio_queue_reset(VirtIODevice *vdev, uint32_t queue_index);
void virtio_update_irq(VirtIODevice *vdev);
int virtio_set_features(VirtIODevice *vdev, uint64_t val);
--
2.32.0.3.g01195cf9f
- [PATCH v5 00/15] Support VIRTIO_F_RING_RESET for virtio-net, vhost-net kernel in virtio pci-modern, Xuan Zhuo, 2022/09/14
- [PATCH v5 12/15] virtio-net: introduce flush_or_purge_queued_packets(), Xuan Zhuo, 2022/09/14
- [PATCH v5 10/15] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_reset(), Xuan Zhuo, 2022/09/14
- [PATCH v5 03/15] virtio: introduce virtio_queue_reset(),
Xuan Zhuo <=
- [PATCH v5 09/15] vhost: expose vhost_virtqueue_stop(), Xuan Zhuo, 2022/09/14
- [PATCH v5 08/15] vhost: expose vhost_virtqueue_start(), Xuan Zhuo, 2022/09/14
- [PATCH v5 15/15] vhost: vhost-kernel: enable vq reset feature, Xuan Zhuo, 2022/09/14
- [PATCH v5 07/15] virtio-pci: support queue enable, Xuan Zhuo, 2022/09/14
- [PATCH v5 01/15] virtio: sync relevant definitions with linux, Xuan Zhuo, 2022/09/14
- [PATCH v5 14/15] virtio-net: support queue_enable, Xuan Zhuo, 2022/09/14
- [PATCH v5 05/15] virtio: core: vq reset feature negotation support, Xuan Zhuo, 2022/09/14
- [PATCH v5 02/15] virtio: introduce __virtio_queue_reset(), Xuan Zhuo, 2022/09/14
- [PATCH v5 11/15] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_restart(), Xuan Zhuo, 2022/09/14