[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 36/82] virtio: introduce virtio_queue_reset()
From: |
Michael S. Tsirkin |
Subject: |
[PULL v2 36/82] virtio: introduce virtio_queue_reset() |
Date: |
Wed, 2 Nov 2022 12:10:01 -0400 |
From: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
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>
Message-Id: <20221017092558.111082-3-xuanzhuo@linux.alibaba.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/virtio/virtio.h | 2 ++
hw/virtio/virtio.c | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index ebb58feaac..b4c237201d 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -148,6 +148,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.
@@ -286,6 +287,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);
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 6f42fcadd7..cf5f9ca387 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2484,6 +2484,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;
--
MST
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, (continued)
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, Michael S. Tsirkin, 2022/11/05
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, Christian A. Ehrhardt, 2022/11/06
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, Michael S. Tsirkin, 2022/11/07
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, Christian A. Ehrhardt, 2022/11/07
- Re: [PULL v2 31/82] vhost: Change the sequence of device start, Michael S. Tsirkin, 2022/11/07
[PULL v2 34/82] virtio: re-order vm_running and use_started checks, Michael S. Tsirkin, 2022/11/02
[PULL v2 35/82] virtio: introduce __virtio_queue_reset(), Michael S. Tsirkin, 2022/11/02
[PULL v2 33/82] hw/virtio/virtio-iommu-pci: Enforce the device is plugged on the root bus, Michael S. Tsirkin, 2022/11/02
[PULL v2 37/82] virtio: introduce virtio_queue_enable(), Michael S. Tsirkin, 2022/11/02
[PULL v2 38/82] virtio: core: vq reset feature negotation support, Michael S. Tsirkin, 2022/11/02
[PULL v2 36/82] virtio: introduce virtio_queue_reset(),
Michael S. Tsirkin <=
[PULL v2 40/82] virtio-pci: support queue enable, Michael S. Tsirkin, 2022/11/02
[PULL v2 42/82] vhost: expose vhost_virtqueue_stop(), Michael S. Tsirkin, 2022/11/02
[PULL v2 39/82] virtio-pci: support queue reset, Michael S. Tsirkin, 2022/11/02
[PULL v2 41/82] vhost: expose vhost_virtqueue_start(), Michael S. Tsirkin, 2022/11/02
[PULL v2 43/82] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_reset(), Michael S. Tsirkin, 2022/11/02
[PULL v2 44/82] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_restart(), Michael S. Tsirkin, 2022/11/02
[PULL v2 45/82] virtio-net: introduce flush_or_purge_queued_packets(), Michael S. Tsirkin, 2022/11/02
[PULL v2 47/82] virtio-net: support queue_enable, Michael S. Tsirkin, 2022/11/02
[PULL v2 46/82] virtio-net: support queue reset, Michael S. Tsirkin, 2022/11/02
[PULL v2 50/82] virtio-rng-pci: Allow setting nvectors, so we can use MSI-X, Michael S. Tsirkin, 2022/11/02