virtio: struct virtio_config_ops add callbacks for queue_reset
ANBZ: #8907
commit 3086e9fc91
upstream.
reset can be divided into the following four steps (example):
1. transport: notify the device to reset the queue
2. vring: recycle the buffer submitted
3. vring: reset/resize the vring (may re-alloc)
4. transport: mmap vring to device, and enable the queue
In order to support queue reset, add two callbacks in struct
virtio_config_ops to implement steps 1 and 4.
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20220801063902.129329-3-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Reviewed-by: Heng Qi <hengqi@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/3110
This commit is contained in:
parent
831659ab64
commit
cf811d47af
|
@ -73,6 +73,18 @@ struct virtio_shm_region {
|
|||
* @set_vq_affinity: set the affinity for a virtqueue (optional).
|
||||
* @get_vq_affinity: get the affinity for a virtqueue (optional).
|
||||
* @get_shm_region: get a shared memory region based on the index.
|
||||
* @disable_vq_and_reset: reset a queue individually (optional).
|
||||
* vq: the virtqueue
|
||||
* Returns 0 on success or error status
|
||||
* disable_vq_and_reset will guarantee that the callbacks are disabled and
|
||||
* synchronized.
|
||||
* Except for the callback, the caller should guarantee that the vring is
|
||||
* not accessed by any functions of virtqueue.
|
||||
* @enable_vq_after_reset: enable a reset queue
|
||||
* vq: the virtqueue
|
||||
* Returns 0 on success or error status
|
||||
* If disable_vq_and_reset is set, then enable_vq_after_reset must also be
|
||||
* set.
|
||||
*/
|
||||
typedef void vq_callback_t(struct virtqueue *);
|
||||
struct virtio_config_ops {
|
||||
|
@ -98,6 +110,8 @@ struct virtio_config_ops {
|
|||
int index);
|
||||
bool (*get_shm_region)(struct virtio_device *vdev,
|
||||
struct virtio_shm_region *region, u8 id);
|
||||
int (*disable_vq_and_reset)(struct virtqueue *vq);
|
||||
int (*enable_vq_after_reset)(struct virtqueue *vq);
|
||||
};
|
||||
|
||||
/* If driver didn't advertise the feature, it will never appear. */
|
||||
|
|
Loading…
Reference in New Issue