virtio_test: fixup for vq reset

Fix virtio test compilation failure caused by vq reset.

../../drivers/virtio/virtio_ring.c: In function ‘vring_create_virtqueue_packed’:
../../drivers/virtio/virtio_ring.c:1999:8: error: ‘struct virtqueue’ has no member named ‘reset’
 1999 |  vq->vq.reset = false;
      |        ^
../../drivers/virtio/virtio_ring.c: In function ‘__vring_new_virtqueue’:
../../drivers/virtio/virtio_ring.c:2493:8: error: ‘struct virtqueue’ has no member named ‘reset’
 2493 |  vq->vq.reset = false;
      |        ^
../../drivers/virtio/virtio_ring.c: In function ‘virtqueue_resize’:
../../drivers/virtio/virtio_ring.c:2587:18: error: ‘struct virtqueue’ has no member named ‘num_max’
 2587 |  if (num > vq->vq.num_max)
      |                  ^
../../drivers/virtio/virtio_ring.c:2596:11: error: ‘struct virtio_device’ has no member named ‘config’
 2596 |  if (!vdev->config->disable_vq_and_reset)
      |           ^~
../../drivers/virtio/virtio_ring.c:2599:11: error: ‘struct virtio_device’ has no member named ‘config’
 2599 |  if (!vdev->config->enable_vq_after_reset)
      |           ^~
../../drivers/virtio/virtio_ring.c:2602:12: error: ‘struct virtio_device’ has no member named ‘config’
 2602 |  err = vdev->config->disable_vq_and_reset(_vq);
      |            ^~
../../drivers/virtio/virtio_ring.c:2614:10: error: ‘struct virtio_device’ has no member named ‘config’
 2614 |  if (vdev->config->enable_vq_after_reset(_vq))
      |          ^~
make: *** [<builtin>: virtio_ring.o] Error 1

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Message-Id: <20220830110549.103168-1-xuanzhuo@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Xuan Zhuo 2022-08-30 19:05:49 +08:00 committed by Michael S. Tsirkin
parent 1bedcf22c0
commit dbe449d8f8
2 changed files with 8 additions and 0 deletions

View File

@ -14,6 +14,7 @@ struct virtio_device {
u64 features; u64 features;
struct list_head vqs; struct list_head vqs;
spinlock_t vqs_list_lock; spinlock_t vqs_list_lock;
const struct virtio_config_ops *config;
}; };
struct virtqueue { struct virtqueue {
@ -23,7 +24,9 @@ struct virtqueue {
struct virtio_device *vdev; struct virtio_device *vdev;
unsigned int index; unsigned int index;
unsigned int num_free; unsigned int num_free;
unsigned int num_max;
void *priv; void *priv;
bool reset;
}; };
/* Interfaces exported by virtio_ring. */ /* Interfaces exported by virtio_ring. */

View File

@ -3,6 +3,11 @@
#include <linux/virtio.h> #include <linux/virtio.h>
#include <uapi/linux/virtio_config.h> #include <uapi/linux/virtio_config.h>
struct virtio_config_ops {
int (*disable_vq_and_reset)(struct virtqueue *vq);
int (*enable_vq_after_reset)(struct virtqueue *vq);
};
/* /*
* __virtio_test_bit - helper to test feature bits. For use by transports. * __virtio_test_bit - helper to test feature bits. For use by transports.
* Devices should normally use virtio_has_feature, * Devices should normally use virtio_has_feature,