Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 2 | #define _GNU_SOURCE |
| 3 | #include <getopt.h> |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 4 | #include <limits.h> |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 5 | #include <string.h> |
| 6 | #include <poll.h> |
| 7 | #include <sys/eventfd.h> |
| 8 | #include <stdlib.h> |
| 9 | #include <assert.h> |
| 10 | #include <unistd.h> |
| 11 | #include <sys/ioctl.h> |
| 12 | #include <sys/stat.h> |
| 13 | #include <sys/types.h> |
| 14 | #include <fcntl.h> |
Rusty Russell | 61d0b5a | 2013-03-18 13:22:19 +1030 | [diff] [blame] | 15 | #include <stdbool.h> |
Michael S. Tsirkin | 2d7ce0e | 2014-12-15 23:47:07 +0200 | [diff] [blame] | 16 | #include <linux/virtio_types.h> |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 17 | #include <linux/vhost.h> |
| 18 | #include <linux/virtio.h> |
| 19 | #include <linux/virtio_ring.h> |
| 20 | #include "../../drivers/vhost/test.h" |
| 21 | |
Eugenio Pérez | 7add78b | 2020-04-18 12:22:12 +0200 | [diff] [blame] | 22 | #define RANDOM_BATCH -1 |
| 23 | |
Rusty Russell | 61d0b5a | 2013-03-18 13:22:19 +1030 | [diff] [blame] | 24 | /* Unused */ |
| 25 | void *__kmalloc_fake, *__kfree_ignore_start, *__kfree_ignore_end; |
| 26 | |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 27 | struct vq_info { |
| 28 | int kick; |
| 29 | int call; |
| 30 | int num; |
| 31 | int idx; |
| 32 | void *ring; |
| 33 | /* copy used for control */ |
| 34 | struct vring vring; |
| 35 | struct virtqueue *vq; |
| 36 | }; |
| 37 | |
| 38 | struct vdev_info { |
| 39 | struct virtio_device vdev; |
| 40 | int control; |
| 41 | struct pollfd fds[1]; |
| 42 | struct vq_info vqs[1]; |
| 43 | int nvqs; |
| 44 | void *buf; |
| 45 | size_t buf_size; |
| 46 | struct vhost_memory *mem; |
| 47 | }; |
| 48 | |
Eugenio Pérez | 264ee5a | 2020-04-18 12:22:13 +0200 | [diff] [blame] | 49 | static const struct vhost_vring_file no_backend = { .fd = -1 }, |
| 50 | backend = { .fd = 1 }; |
| 51 | |
Heinz Graalfs | 46f9c2b | 2013-10-29 09:38:50 +1030 | [diff] [blame] | 52 | bool vq_notify(struct virtqueue *vq) |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 53 | { |
| 54 | struct vq_info *info = vq->priv; |
| 55 | unsigned long long v = 1; |
| 56 | int r; |
| 57 | r = write(info->kick, &v, sizeof v); |
| 58 | assert(r == sizeof v); |
Heinz Graalfs | 46f9c2b | 2013-10-29 09:38:50 +1030 | [diff] [blame] | 59 | return true; |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | void vq_callback(struct virtqueue *vq) |
| 63 | { |
| 64 | } |
| 65 | |
| 66 | |
| 67 | void vhost_vq_setup(struct vdev_info *dev, struct vq_info *info) |
| 68 | { |
| 69 | struct vhost_vring_state state = { .index = info->idx }; |
| 70 | struct vhost_vring_file file = { .index = info->idx }; |
Michael S. Tsirkin | e16e12b | 2014-10-07 16:39:42 +0200 | [diff] [blame] | 71 | unsigned long long features = dev->vdev.features; |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 72 | struct vhost_vring_addr addr = { |
| 73 | .index = info->idx, |
| 74 | .desc_user_addr = (uint64_t)(unsigned long)info->vring.desc, |
| 75 | .avail_user_addr = (uint64_t)(unsigned long)info->vring.avail, |
| 76 | .used_user_addr = (uint64_t)(unsigned long)info->vring.used, |
| 77 | }; |
| 78 | int r; |
| 79 | r = ioctl(dev->control, VHOST_SET_FEATURES, &features); |
| 80 | assert(r >= 0); |
| 81 | state.num = info->vring.num; |
| 82 | r = ioctl(dev->control, VHOST_SET_VRING_NUM, &state); |
| 83 | assert(r >= 0); |
| 84 | state.num = 0; |
| 85 | r = ioctl(dev->control, VHOST_SET_VRING_BASE, &state); |
| 86 | assert(r >= 0); |
| 87 | r = ioctl(dev->control, VHOST_SET_VRING_ADDR, &addr); |
| 88 | assert(r >= 0); |
| 89 | file.fd = info->kick; |
| 90 | r = ioctl(dev->control, VHOST_SET_VRING_KICK, &file); |
| 91 | assert(r >= 0); |
| 92 | file.fd = info->call; |
| 93 | r = ioctl(dev->control, VHOST_SET_VRING_CALL, &file); |
| 94 | assert(r >= 0); |
| 95 | } |
| 96 | |
Eugenio Pérez | 6741239 | 2020-04-18 12:22:15 +0200 | [diff] [blame^] | 97 | static void vq_reset(struct vq_info *info, int num, struct virtio_device *vdev) |
| 98 | { |
| 99 | if (info->vq) |
| 100 | vring_del_virtqueue(info->vq); |
| 101 | |
| 102 | memset(info->ring, 0, vring_size(num, 4096)); |
| 103 | vring_init(&info->vring, num, info->ring, 4096); |
| 104 | info->vq = __vring_new_virtqueue(info->idx, info->vring, vdev, true, |
| 105 | false, vq_notify, vq_callback, "test"); |
| 106 | assert(info->vq); |
| 107 | info->vq->priv = info; |
| 108 | } |
| 109 | |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 110 | static void vq_info_add(struct vdev_info *dev, int num) |
| 111 | { |
| 112 | struct vq_info *info = &dev->vqs[dev->nvqs]; |
| 113 | int r; |
| 114 | info->idx = dev->nvqs; |
| 115 | info->kick = eventfd(0, EFD_NONBLOCK); |
| 116 | info->call = eventfd(0, EFD_NONBLOCK); |
| 117 | r = posix_memalign(&info->ring, 4096, vring_size(num, 4096)); |
| 118 | assert(r >= 0); |
Eugenio Pérez | 6741239 | 2020-04-18 12:22:15 +0200 | [diff] [blame^] | 119 | vq_reset(info, num, &dev->vdev); |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 120 | vhost_vq_setup(dev, info); |
| 121 | dev->fds[info->idx].fd = info->call; |
| 122 | dev->fds[info->idx].events = POLLIN; |
| 123 | dev->nvqs++; |
| 124 | } |
| 125 | |
| 126 | static void vdev_info_init(struct vdev_info* dev, unsigned long long features) |
| 127 | { |
| 128 | int r; |
| 129 | memset(dev, 0, sizeof *dev); |
Michael S. Tsirkin | e16e12b | 2014-10-07 16:39:42 +0200 | [diff] [blame] | 130 | dev->vdev.features = features; |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 131 | dev->buf_size = 1024; |
| 132 | dev->buf = malloc(dev->buf_size); |
| 133 | assert(dev->buf); |
| 134 | dev->control = open("/dev/vhost-test", O_RDWR); |
| 135 | assert(dev->control >= 0); |
| 136 | r = ioctl(dev->control, VHOST_SET_OWNER, NULL); |
| 137 | assert(r >= 0); |
| 138 | dev->mem = malloc(offsetof(struct vhost_memory, regions) + |
| 139 | sizeof dev->mem->regions[0]); |
| 140 | assert(dev->mem); |
| 141 | memset(dev->mem, 0, offsetof(struct vhost_memory, regions) + |
| 142 | sizeof dev->mem->regions[0]); |
| 143 | dev->mem->nregions = 1; |
| 144 | dev->mem->regions[0].guest_phys_addr = (long)dev->buf; |
| 145 | dev->mem->regions[0].userspace_addr = (long)dev->buf; |
| 146 | dev->mem->regions[0].memory_size = dev->buf_size; |
| 147 | r = ioctl(dev->control, VHOST_SET_MEM_TABLE, dev->mem); |
| 148 | assert(r >= 0); |
| 149 | } |
| 150 | |
| 151 | /* TODO: this is pretty bad: we get a cache line bounce |
| 152 | * for the wait queue on poll and another one on read, |
| 153 | * plus the read which is there just to clear the |
| 154 | * current state. */ |
| 155 | static void wait_for_interrupt(struct vdev_info *dev) |
| 156 | { |
| 157 | int i; |
| 158 | unsigned long long val; |
| 159 | poll(dev->fds, dev->nvqs, -1); |
| 160 | for (i = 0; i < dev->nvqs; ++i) |
| 161 | if (dev->fds[i].revents & POLLIN) { |
| 162 | read(dev->fds[i].fd, &val, sizeof val); |
| 163 | } |
| 164 | } |
| 165 | |
Michael S. Tsirkin | 64d0988 | 2012-04-16 10:11:12 -0400 | [diff] [blame] | 166 | static void run_test(struct vdev_info *dev, struct vq_info *vq, |
Eugenio Pérez | 264ee5a | 2020-04-18 12:22:13 +0200 | [diff] [blame] | 167 | bool delayed, int batch, int reset_n, int bufs) |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 168 | { |
| 169 | struct scatterlist sl; |
Eugenio Pérez | 264ee5a | 2020-04-18 12:22:13 +0200 | [diff] [blame] | 170 | long started = 0, completed = 0, next_reset = reset_n; |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 171 | long completed_before, started_before; |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 172 | int r, test = 1; |
| 173 | unsigned len; |
| 174 | long long spurious = 0; |
Eugenio Pérez | 7add78b | 2020-04-18 12:22:12 +0200 | [diff] [blame] | 175 | const bool random_batch = batch == RANDOM_BATCH; |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 176 | r = ioctl(dev->control, VHOST_TEST_RUN, &test); |
| 177 | assert(r >= 0); |
| 178 | for (;;) { |
| 179 | virtqueue_disable_cb(vq->vq); |
| 180 | completed_before = completed; |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 181 | started_before = started; |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 182 | do { |
Eugenio Pérez | 264ee5a | 2020-04-18 12:22:13 +0200 | [diff] [blame] | 183 | const bool reset = reset_n && completed > next_reset; |
Eugenio Pérez | 7add78b | 2020-04-18 12:22:12 +0200 | [diff] [blame] | 184 | if (random_batch) |
| 185 | batch = (random() % vq->vring.num) + 1; |
| 186 | |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 187 | while (started < bufs && |
| 188 | (started - completed) < batch) { |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 189 | sg_init_one(&sl, dev->buf, dev->buf_size); |
Rusty Russell | cf994e0 | 2013-03-20 15:44:30 +1030 | [diff] [blame] | 190 | r = virtqueue_add_outbuf(vq->vq, &sl, 1, |
| 191 | dev->buf + started, |
| 192 | GFP_ATOMIC); |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 193 | if (unlikely(r != 0)) { |
| 194 | if (r == -ENOSPC && |
| 195 | started > started_before) |
| 196 | r = 0; |
| 197 | else |
Heinz Graalfs | 53c18c9 | 2013-10-29 09:40:11 +1030 | [diff] [blame] | 198 | r = -1; |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 199 | break; |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 200 | } |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 201 | |
| 202 | ++started; |
| 203 | |
| 204 | if (unlikely(!virtqueue_kick(vq->vq))) { |
| 205 | r = -1; |
| 206 | break; |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | if (started >= bufs) |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 211 | r = -1; |
| 212 | |
Eugenio Pérez | 264ee5a | 2020-04-18 12:22:13 +0200 | [diff] [blame] | 213 | if (reset) { |
| 214 | r = ioctl(dev->control, VHOST_TEST_SET_BACKEND, |
| 215 | &no_backend); |
| 216 | assert(!r); |
| 217 | } |
| 218 | |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 219 | /* Flush out completed bufs if any */ |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 220 | while (virtqueue_get_buf(vq->vq, &len)) { |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 221 | ++completed; |
| 222 | r = 0; |
| 223 | } |
| 224 | |
Eugenio Pérez | 264ee5a | 2020-04-18 12:22:13 +0200 | [diff] [blame] | 225 | if (reset) { |
| 226 | r = ioctl(dev->control, VHOST_TEST_SET_BACKEND, |
| 227 | &backend); |
| 228 | assert(!r); |
| 229 | |
| 230 | while (completed > next_reset) |
| 231 | next_reset += completed; |
| 232 | } |
Rusty Russell | de929b0 | 2012-10-16 23:56:16 +1030 | [diff] [blame] | 233 | } while (r == 0); |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 234 | if (completed == completed_before && started == started_before) |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 235 | ++spurious; |
| 236 | assert(completed <= bufs); |
| 237 | assert(started <= bufs); |
| 238 | if (completed == bufs) |
| 239 | break; |
Michael S. Tsirkin | 64d0988 | 2012-04-16 10:11:12 -0400 | [diff] [blame] | 240 | if (delayed) { |
| 241 | if (virtqueue_enable_cb_delayed(vq->vq)) |
| 242 | wait_for_interrupt(dev); |
| 243 | } else { |
| 244 | if (virtqueue_enable_cb(vq->vq)) |
| 245 | wait_for_interrupt(dev); |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 246 | } |
| 247 | } |
| 248 | test = 0; |
| 249 | r = ioctl(dev->control, VHOST_TEST_RUN, &test); |
| 250 | assert(r >= 0); |
Colin Ian King | 96fb20c | 2017-04-29 23:14:21 +0100 | [diff] [blame] | 251 | fprintf(stderr, "spurious wakeups: 0x%llx\n", spurious); |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 252 | } |
| 253 | |
| 254 | const char optstring[] = "h"; |
| 255 | const struct option longopts[] = { |
| 256 | { |
| 257 | .name = "help", |
| 258 | .val = 'h', |
| 259 | }, |
| 260 | { |
Michael S. Tsirkin | 4423fe4 | 2011-05-20 02:11:05 +0300 | [diff] [blame] | 261 | .name = "event-idx", |
| 262 | .val = 'E', |
| 263 | }, |
| 264 | { |
| 265 | .name = "no-event-idx", |
| 266 | .val = 'e', |
| 267 | }, |
| 268 | { |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 269 | .name = "indirect", |
| 270 | .val = 'I', |
| 271 | }, |
| 272 | { |
| 273 | .name = "no-indirect", |
| 274 | .val = 'i', |
| 275 | }, |
| 276 | { |
Michael S. Tsirkin | 43b0912 | 2014-12-14 22:49:16 +0200 | [diff] [blame] | 277 | .name = "virtio-1", |
| 278 | .val = '1', |
| 279 | }, |
| 280 | { |
| 281 | .name = "no-virtio-1", |
| 282 | .val = '0', |
| 283 | }, |
| 284 | { |
Michael S. Tsirkin | 64d0988 | 2012-04-16 10:11:12 -0400 | [diff] [blame] | 285 | .name = "delayed-interrupt", |
| 286 | .val = 'D', |
| 287 | }, |
| 288 | { |
| 289 | .name = "no-delayed-interrupt", |
| 290 | .val = 'd', |
| 291 | }, |
| 292 | { |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 293 | .name = "batch", |
| 294 | .val = 'b', |
| 295 | .has_arg = required_argument, |
| 296 | }, |
| 297 | { |
Eugenio Pérez | 264ee5a | 2020-04-18 12:22:13 +0200 | [diff] [blame] | 298 | .name = "reset", |
| 299 | .val = 'r', |
| 300 | .has_arg = optional_argument, |
| 301 | }, |
| 302 | { |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 303 | } |
| 304 | }; |
| 305 | |
Cong Ding | 4a7d645 | 2012-12-03 10:24:54 +0000 | [diff] [blame] | 306 | static void help(void) |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 307 | { |
Michael S. Tsirkin | 4423fe4 | 2011-05-20 02:11:05 +0300 | [diff] [blame] | 308 | fprintf(stderr, "Usage: virtio_test [--help]" |
| 309 | " [--no-indirect]" |
| 310 | " [--no-event-idx]" |
Michael S. Tsirkin | 43b0912 | 2014-12-14 22:49:16 +0200 | [diff] [blame] | 311 | " [--no-virtio-1]" |
Michael S. Tsirkin | 64d0988 | 2012-04-16 10:11:12 -0400 | [diff] [blame] | 312 | " [--delayed-interrupt]" |
Eugenio Pérez | 7add78b | 2020-04-18 12:22:12 +0200 | [diff] [blame] | 313 | " [--batch=random/N]" |
Eugenio Pérez | 264ee5a | 2020-04-18 12:22:13 +0200 | [diff] [blame] | 314 | " [--reset=N]" |
Michael S. Tsirkin | 4423fe4 | 2011-05-20 02:11:05 +0300 | [diff] [blame] | 315 | "\n"); |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 316 | } |
| 317 | |
| 318 | int main(int argc, char **argv) |
| 319 | { |
| 320 | struct vdev_info dev; |
Michael S. Tsirkin | 4423fe4 | 2011-05-20 02:11:05 +0300 | [diff] [blame] | 321 | unsigned long long features = (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | |
Michael S. Tsirkin | 43b0912 | 2014-12-14 22:49:16 +0200 | [diff] [blame] | 322 | (1ULL << VIRTIO_RING_F_EVENT_IDX) | (1ULL << VIRTIO_F_VERSION_1); |
Eugenio Pérez | 264ee5a | 2020-04-18 12:22:13 +0200 | [diff] [blame] | 323 | long batch = 1, reset = 0; |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 324 | int o; |
Michael S. Tsirkin | 64d0988 | 2012-04-16 10:11:12 -0400 | [diff] [blame] | 325 | bool delayed = false; |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 326 | |
| 327 | for (;;) { |
| 328 | o = getopt_long(argc, argv, optstring, longopts, NULL); |
| 329 | switch (o) { |
| 330 | case -1: |
| 331 | goto done; |
| 332 | case '?': |
| 333 | help(); |
| 334 | exit(2); |
Michael S. Tsirkin | 4423fe4 | 2011-05-20 02:11:05 +0300 | [diff] [blame] | 335 | case 'e': |
| 336 | features &= ~(1ULL << VIRTIO_RING_F_EVENT_IDX); |
| 337 | break; |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 338 | case 'h': |
| 339 | help(); |
| 340 | goto done; |
| 341 | case 'i': |
| 342 | features &= ~(1ULL << VIRTIO_RING_F_INDIRECT_DESC); |
| 343 | break; |
Michael S. Tsirkin | 43b0912 | 2014-12-14 22:49:16 +0200 | [diff] [blame] | 344 | case '0': |
| 345 | features &= ~(1ULL << VIRTIO_F_VERSION_1); |
| 346 | break; |
Michael S. Tsirkin | 64d0988 | 2012-04-16 10:11:12 -0400 | [diff] [blame] | 347 | case 'D': |
| 348 | delayed = true; |
| 349 | break; |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 350 | case 'b': |
Eugenio Pérez | 7add78b | 2020-04-18 12:22:12 +0200 | [diff] [blame] | 351 | if (0 == strcmp(optarg, "random")) { |
| 352 | batch = RANDOM_BATCH; |
| 353 | } else { |
| 354 | batch = strtol(optarg, NULL, 10); |
| 355 | assert(batch > 0); |
| 356 | assert(batch < (long)INT_MAX + 1); |
| 357 | } |
Eugenio Pérez | 633fae3 | 2020-04-18 12:22:11 +0200 | [diff] [blame] | 358 | break; |
Eugenio Pérez | 264ee5a | 2020-04-18 12:22:13 +0200 | [diff] [blame] | 359 | case 'r': |
| 360 | if (!optarg) { |
| 361 | reset = 1; |
| 362 | } else { |
| 363 | reset = strtol(optarg, NULL, 10); |
| 364 | assert(reset > 0); |
| 365 | assert(reset < (long)INT_MAX + 1); |
| 366 | } |
| 367 | break; |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 368 | default: |
| 369 | assert(0); |
| 370 | break; |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | done: |
| 375 | vdev_info_init(&dev, features); |
| 376 | vq_info_add(&dev, 256); |
Eugenio Pérez | 264ee5a | 2020-04-18 12:22:13 +0200 | [diff] [blame] | 377 | run_test(&dev, &dev.vqs[0], delayed, batch, reset, 0x100000); |
Michael S. Tsirkin | 4e53f78 | 2010-11-29 19:16:37 +0200 | [diff] [blame] | 378 | return 0; |
| 379 | } |