vhost-user: add vhost_user to hold the chr
[qemu/ar7.git] / hw / virtio / vhost-user.c
blobbd13b2379ba2371701df74e4537efc00b2d7b48e
1 /*
2 * vhost-user
4 * Copyright (c) 2013 Virtual Open Systems Sarl.
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
9 */
11 #include "qemu/osdep.h"
12 #include "qapi/error.h"
13 #include "hw/virtio/vhost.h"
14 #include "hw/virtio/vhost-backend.h"
15 #include "hw/virtio/virtio-net.h"
16 #include "sysemu/char.h"
17 #include "sysemu/kvm.h"
18 #include "qemu/error-report.h"
19 #include "qemu/sockets.h"
21 #include <sys/ioctl.h>
22 #include <sys/socket.h>
23 #include <sys/un.h>
24 #include <linux/vhost.h>
26 #define VHOST_MEMORY_MAX_NREGIONS 8
27 #define VHOST_USER_F_PROTOCOL_FEATURES 30
29 enum VhostUserProtocolFeature {
30 VHOST_USER_PROTOCOL_F_MQ = 0,
31 VHOST_USER_PROTOCOL_F_LOG_SHMFD = 1,
32 VHOST_USER_PROTOCOL_F_RARP = 2,
33 VHOST_USER_PROTOCOL_F_REPLY_ACK = 3,
34 VHOST_USER_PROTOCOL_F_NET_MTU = 4,
36 VHOST_USER_PROTOCOL_F_MAX
39 #define VHOST_USER_PROTOCOL_FEATURE_MASK ((1 << VHOST_USER_PROTOCOL_F_MAX) - 1)
41 typedef enum VhostUserRequest {
42 VHOST_USER_NONE = 0,
43 VHOST_USER_GET_FEATURES = 1,
44 VHOST_USER_SET_FEATURES = 2,
45 VHOST_USER_SET_OWNER = 3,
46 VHOST_USER_RESET_OWNER = 4,
47 VHOST_USER_SET_MEM_TABLE = 5,
48 VHOST_USER_SET_LOG_BASE = 6,
49 VHOST_USER_SET_LOG_FD = 7,
50 VHOST_USER_SET_VRING_NUM = 8,
51 VHOST_USER_SET_VRING_ADDR = 9,
52 VHOST_USER_SET_VRING_BASE = 10,
53 VHOST_USER_GET_VRING_BASE = 11,
54 VHOST_USER_SET_VRING_KICK = 12,
55 VHOST_USER_SET_VRING_CALL = 13,
56 VHOST_USER_SET_VRING_ERR = 14,
57 VHOST_USER_GET_PROTOCOL_FEATURES = 15,
58 VHOST_USER_SET_PROTOCOL_FEATURES = 16,
59 VHOST_USER_GET_QUEUE_NUM = 17,
60 VHOST_USER_SET_VRING_ENABLE = 18,
61 VHOST_USER_SEND_RARP = 19,
62 VHOST_USER_NET_SET_MTU = 20,
63 VHOST_USER_MAX
64 } VhostUserRequest;
66 typedef struct VhostUserMemoryRegion {
67 uint64_t guest_phys_addr;
68 uint64_t memory_size;
69 uint64_t userspace_addr;
70 uint64_t mmap_offset;
71 } VhostUserMemoryRegion;
73 typedef struct VhostUserMemory {
74 uint32_t nregions;
75 uint32_t padding;
76 VhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS];
77 } VhostUserMemory;
79 typedef struct VhostUserLog {
80 uint64_t mmap_size;
81 uint64_t mmap_offset;
82 } VhostUserLog;
84 typedef struct VhostUserMsg {
85 VhostUserRequest request;
87 #define VHOST_USER_VERSION_MASK (0x3)
88 #define VHOST_USER_REPLY_MASK (0x1<<2)
89 #define VHOST_USER_NEED_REPLY_MASK (0x1 << 3)
90 uint32_t flags;
91 uint32_t size; /* the following payload size */
92 union {
93 #define VHOST_USER_VRING_IDX_MASK (0xff)
94 #define VHOST_USER_VRING_NOFD_MASK (0x1<<8)
95 uint64_t u64;
96 struct vhost_vring_state state;
97 struct vhost_vring_addr addr;
98 VhostUserMemory memory;
99 VhostUserLog log;
100 } payload;
101 } QEMU_PACKED VhostUserMsg;
103 static VhostUserMsg m __attribute__ ((unused));
104 #define VHOST_USER_HDR_SIZE (sizeof(m.request) \
105 + sizeof(m.flags) \
106 + sizeof(m.size))
108 #define VHOST_USER_PAYLOAD_SIZE (sizeof(m) - VHOST_USER_HDR_SIZE)
110 /* The version of the protocol we support */
111 #define VHOST_USER_VERSION (0x1)
113 struct vhost_user {
114 CharBackend *chr;
117 static bool ioeventfd_enabled(void)
119 return kvm_enabled() && kvm_eventfds_enabled();
122 static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg)
124 struct vhost_user *u = dev->opaque;
125 CharBackend *chr = u->chr;
126 uint8_t *p = (uint8_t *) msg;
127 int r, size = VHOST_USER_HDR_SIZE;
129 r = qemu_chr_fe_read_all(chr, p, size);
130 if (r != size) {
131 error_report("Failed to read msg header. Read %d instead of %d."
132 " Original request %d.", r, size, msg->request);
133 goto fail;
136 /* validate received flags */
137 if (msg->flags != (VHOST_USER_REPLY_MASK | VHOST_USER_VERSION)) {
138 error_report("Failed to read msg header."
139 " Flags 0x%x instead of 0x%x.", msg->flags,
140 VHOST_USER_REPLY_MASK | VHOST_USER_VERSION);
141 goto fail;
144 /* validate message size is sane */
145 if (msg->size > VHOST_USER_PAYLOAD_SIZE) {
146 error_report("Failed to read msg header."
147 " Size %d exceeds the maximum %zu.", msg->size,
148 VHOST_USER_PAYLOAD_SIZE);
149 goto fail;
152 if (msg->size) {
153 p += VHOST_USER_HDR_SIZE;
154 size = msg->size;
155 r = qemu_chr_fe_read_all(chr, p, size);
156 if (r != size) {
157 error_report("Failed to read msg payload."
158 " Read %d instead of %d.", r, msg->size);
159 goto fail;
163 return 0;
165 fail:
166 return -1;
169 static int process_message_reply(struct vhost_dev *dev,
170 const VhostUserMsg *msg)
172 VhostUserMsg msg_reply;
174 if ((msg->flags & VHOST_USER_NEED_REPLY_MASK) == 0) {
175 return 0;
178 if (vhost_user_read(dev, &msg_reply) < 0) {
179 return -1;
182 if (msg_reply.request != msg->request) {
183 error_report("Received unexpected msg type."
184 "Expected %d received %d",
185 msg->request, msg_reply.request);
186 return -1;
189 return msg_reply.payload.u64 ? -1 : 0;
192 static bool vhost_user_one_time_request(VhostUserRequest request)
194 switch (request) {
195 case VHOST_USER_SET_OWNER:
196 case VHOST_USER_RESET_OWNER:
197 case VHOST_USER_SET_MEM_TABLE:
198 case VHOST_USER_GET_QUEUE_NUM:
199 case VHOST_USER_NET_SET_MTU:
200 return true;
201 default:
202 return false;
206 /* most non-init callers ignore the error */
207 static int vhost_user_write(struct vhost_dev *dev, VhostUserMsg *msg,
208 int *fds, int fd_num)
210 struct vhost_user *u = dev->opaque;
211 CharBackend *chr = u->chr;
212 int ret, size = VHOST_USER_HDR_SIZE + msg->size;
215 * For non-vring specific requests, like VHOST_USER_SET_MEM_TABLE,
216 * we just need send it once in the first time. For later such
217 * request, we just ignore it.
219 if (vhost_user_one_time_request(msg->request) && dev->vq_index != 0) {
220 msg->flags &= ~VHOST_USER_NEED_REPLY_MASK;
221 return 0;
224 if (qemu_chr_fe_set_msgfds(chr, fds, fd_num) < 0) {
225 error_report("Failed to set msg fds.");
226 return -1;
229 ret = qemu_chr_fe_write_all(chr, (const uint8_t *) msg, size);
230 if (ret != size) {
231 error_report("Failed to write msg."
232 " Wrote %d instead of %d.", ret, size);
233 return -1;
236 return 0;
239 static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,
240 struct vhost_log *log)
242 int fds[VHOST_MEMORY_MAX_NREGIONS];
243 size_t fd_num = 0;
244 bool shmfd = virtio_has_feature(dev->protocol_features,
245 VHOST_USER_PROTOCOL_F_LOG_SHMFD);
246 VhostUserMsg msg = {
247 .request = VHOST_USER_SET_LOG_BASE,
248 .flags = VHOST_USER_VERSION,
249 .payload.log.mmap_size = log->size * sizeof(*(log->log)),
250 .payload.log.mmap_offset = 0,
251 .size = sizeof(msg.payload.log),
254 if (shmfd && log->fd != -1) {
255 fds[fd_num++] = log->fd;
258 if (vhost_user_write(dev, &msg, fds, fd_num) < 0) {
259 return -1;
262 if (shmfd) {
263 msg.size = 0;
264 if (vhost_user_read(dev, &msg) < 0) {
265 return -1;
268 if (msg.request != VHOST_USER_SET_LOG_BASE) {
269 error_report("Received unexpected msg type. "
270 "Expected %d received %d",
271 VHOST_USER_SET_LOG_BASE, msg.request);
272 return -1;
276 return 0;
279 static int vhost_user_set_mem_table(struct vhost_dev *dev,
280 struct vhost_memory *mem)
282 int fds[VHOST_MEMORY_MAX_NREGIONS];
283 int i, fd;
284 size_t fd_num = 0;
285 bool reply_supported = virtio_has_feature(dev->protocol_features,
286 VHOST_USER_PROTOCOL_F_REPLY_ACK);
288 VhostUserMsg msg = {
289 .request = VHOST_USER_SET_MEM_TABLE,
290 .flags = VHOST_USER_VERSION,
293 if (reply_supported) {
294 msg.flags |= VHOST_USER_NEED_REPLY_MASK;
297 for (i = 0; i < dev->mem->nregions; ++i) {
298 struct vhost_memory_region *reg = dev->mem->regions + i;
299 ram_addr_t offset;
300 MemoryRegion *mr;
302 assert((uintptr_t)reg->userspace_addr == reg->userspace_addr);
303 mr = memory_region_from_host((void *)(uintptr_t)reg->userspace_addr,
304 &offset);
305 fd = memory_region_get_fd(mr);
306 if (fd > 0) {
307 msg.payload.memory.regions[fd_num].userspace_addr = reg->userspace_addr;
308 msg.payload.memory.regions[fd_num].memory_size = reg->memory_size;
309 msg.payload.memory.regions[fd_num].guest_phys_addr = reg->guest_phys_addr;
310 msg.payload.memory.regions[fd_num].mmap_offset = offset;
311 assert(fd_num < VHOST_MEMORY_MAX_NREGIONS);
312 fds[fd_num++] = fd;
316 msg.payload.memory.nregions = fd_num;
318 if (!fd_num) {
319 error_report("Failed initializing vhost-user memory map, "
320 "consider using -object memory-backend-file share=on");
321 return -1;
324 msg.size = sizeof(msg.payload.memory.nregions);
325 msg.size += sizeof(msg.payload.memory.padding);
326 msg.size += fd_num * sizeof(VhostUserMemoryRegion);
328 if (vhost_user_write(dev, &msg, fds, fd_num) < 0) {
329 return -1;
332 if (reply_supported) {
333 return process_message_reply(dev, &msg);
336 return 0;
339 static int vhost_user_set_vring_addr(struct vhost_dev *dev,
340 struct vhost_vring_addr *addr)
342 VhostUserMsg msg = {
343 .request = VHOST_USER_SET_VRING_ADDR,
344 .flags = VHOST_USER_VERSION,
345 .payload.addr = *addr,
346 .size = sizeof(msg.payload.addr),
349 if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
350 return -1;
353 return 0;
356 static int vhost_user_set_vring_endian(struct vhost_dev *dev,
357 struct vhost_vring_state *ring)
359 error_report("vhost-user trying to send unhandled ioctl");
360 return -1;
363 static int vhost_set_vring(struct vhost_dev *dev,
364 unsigned long int request,
365 struct vhost_vring_state *ring)
367 VhostUserMsg msg = {
368 .request = request,
369 .flags = VHOST_USER_VERSION,
370 .payload.state = *ring,
371 .size = sizeof(msg.payload.state),
374 if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
375 return -1;
378 return 0;
381 static int vhost_user_set_vring_num(struct vhost_dev *dev,
382 struct vhost_vring_state *ring)
384 return vhost_set_vring(dev, VHOST_USER_SET_VRING_NUM, ring);
387 static int vhost_user_set_vring_base(struct vhost_dev *dev,
388 struct vhost_vring_state *ring)
390 return vhost_set_vring(dev, VHOST_USER_SET_VRING_BASE, ring);
393 static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable)
395 int i;
397 if (!virtio_has_feature(dev->features, VHOST_USER_F_PROTOCOL_FEATURES)) {
398 return -1;
401 for (i = 0; i < dev->nvqs; ++i) {
402 struct vhost_vring_state state = {
403 .index = dev->vq_index + i,
404 .num = enable,
407 vhost_set_vring(dev, VHOST_USER_SET_VRING_ENABLE, &state);
410 return 0;
413 static int vhost_user_get_vring_base(struct vhost_dev *dev,
414 struct vhost_vring_state *ring)
416 VhostUserMsg msg = {
417 .request = VHOST_USER_GET_VRING_BASE,
418 .flags = VHOST_USER_VERSION,
419 .payload.state = *ring,
420 .size = sizeof(msg.payload.state),
423 if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
424 return -1;
427 if (vhost_user_read(dev, &msg) < 0) {
428 return -1;
431 if (msg.request != VHOST_USER_GET_VRING_BASE) {
432 error_report("Received unexpected msg type. Expected %d received %d",
433 VHOST_USER_GET_VRING_BASE, msg.request);
434 return -1;
437 if (msg.size != sizeof(msg.payload.state)) {
438 error_report("Received bad msg size.");
439 return -1;
442 *ring = msg.payload.state;
444 return 0;
447 static int vhost_set_vring_file(struct vhost_dev *dev,
448 VhostUserRequest request,
449 struct vhost_vring_file *file)
451 int fds[VHOST_MEMORY_MAX_NREGIONS];
452 size_t fd_num = 0;
453 VhostUserMsg msg = {
454 .request = request,
455 .flags = VHOST_USER_VERSION,
456 .payload.u64 = file->index & VHOST_USER_VRING_IDX_MASK,
457 .size = sizeof(msg.payload.u64),
460 if (ioeventfd_enabled() && file->fd > 0) {
461 fds[fd_num++] = file->fd;
462 } else {
463 msg.payload.u64 |= VHOST_USER_VRING_NOFD_MASK;
466 if (vhost_user_write(dev, &msg, fds, fd_num) < 0) {
467 return -1;
470 return 0;
473 static int vhost_user_set_vring_kick(struct vhost_dev *dev,
474 struct vhost_vring_file *file)
476 return vhost_set_vring_file(dev, VHOST_USER_SET_VRING_KICK, file);
479 static int vhost_user_set_vring_call(struct vhost_dev *dev,
480 struct vhost_vring_file *file)
482 return vhost_set_vring_file(dev, VHOST_USER_SET_VRING_CALL, file);
485 static int vhost_user_set_u64(struct vhost_dev *dev, int request, uint64_t u64)
487 VhostUserMsg msg = {
488 .request = request,
489 .flags = VHOST_USER_VERSION,
490 .payload.u64 = u64,
491 .size = sizeof(msg.payload.u64),
494 if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
495 return -1;
498 return 0;
501 static int vhost_user_set_features(struct vhost_dev *dev,
502 uint64_t features)
504 return vhost_user_set_u64(dev, VHOST_USER_SET_FEATURES, features);
507 static int vhost_user_set_protocol_features(struct vhost_dev *dev,
508 uint64_t features)
510 return vhost_user_set_u64(dev, VHOST_USER_SET_PROTOCOL_FEATURES, features);
513 static int vhost_user_get_u64(struct vhost_dev *dev, int request, uint64_t *u64)
515 VhostUserMsg msg = {
516 .request = request,
517 .flags = VHOST_USER_VERSION,
520 if (vhost_user_one_time_request(request) && dev->vq_index != 0) {
521 return 0;
524 if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
525 return -1;
528 if (vhost_user_read(dev, &msg) < 0) {
529 return -1;
532 if (msg.request != request) {
533 error_report("Received unexpected msg type. Expected %d received %d",
534 request, msg.request);
535 return -1;
538 if (msg.size != sizeof(msg.payload.u64)) {
539 error_report("Received bad msg size.");
540 return -1;
543 *u64 = msg.payload.u64;
545 return 0;
548 static int vhost_user_get_features(struct vhost_dev *dev, uint64_t *features)
550 return vhost_user_get_u64(dev, VHOST_USER_GET_FEATURES, features);
553 static int vhost_user_set_owner(struct vhost_dev *dev)
555 VhostUserMsg msg = {
556 .request = VHOST_USER_SET_OWNER,
557 .flags = VHOST_USER_VERSION,
560 if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
561 return -1;
564 return 0;
567 static int vhost_user_reset_device(struct vhost_dev *dev)
569 VhostUserMsg msg = {
570 .request = VHOST_USER_RESET_OWNER,
571 .flags = VHOST_USER_VERSION,
574 if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
575 return -1;
578 return 0;
581 static int vhost_user_init(struct vhost_dev *dev, void *opaque)
583 uint64_t features;
584 struct vhost_user *u;
585 int err;
587 assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
589 u = g_new0(struct vhost_user, 1);
590 u->chr = opaque;
591 dev->opaque = u;
593 err = vhost_user_get_features(dev, &features);
594 if (err < 0) {
595 return err;
598 if (virtio_has_feature(features, VHOST_USER_F_PROTOCOL_FEATURES)) {
599 dev->backend_features |= 1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
601 err = vhost_user_get_u64(dev, VHOST_USER_GET_PROTOCOL_FEATURES,
602 &features);
603 if (err < 0) {
604 return err;
607 dev->protocol_features = features & VHOST_USER_PROTOCOL_FEATURE_MASK;
608 err = vhost_user_set_protocol_features(dev, dev->protocol_features);
609 if (err < 0) {
610 return err;
613 /* query the max queues we support if backend supports Multiple Queue */
614 if (dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_MQ)) {
615 err = vhost_user_get_u64(dev, VHOST_USER_GET_QUEUE_NUM,
616 &dev->max_queues);
617 if (err < 0) {
618 return err;
623 if (dev->migration_blocker == NULL &&
624 !virtio_has_feature(dev->protocol_features,
625 VHOST_USER_PROTOCOL_F_LOG_SHMFD)) {
626 error_setg(&dev->migration_blocker,
627 "Migration disabled: vhost-user backend lacks "
628 "VHOST_USER_PROTOCOL_F_LOG_SHMFD feature.");
631 return 0;
634 static int vhost_user_cleanup(struct vhost_dev *dev)
636 struct vhost_user *u;
638 assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
640 u = dev->opaque;
641 g_free(u);
642 dev->opaque = 0;
644 return 0;
647 static int vhost_user_get_vq_index(struct vhost_dev *dev, int idx)
649 assert(idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs);
651 return idx;
654 static int vhost_user_memslots_limit(struct vhost_dev *dev)
656 return VHOST_MEMORY_MAX_NREGIONS;
659 static bool vhost_user_requires_shm_log(struct vhost_dev *dev)
661 assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
663 return virtio_has_feature(dev->protocol_features,
664 VHOST_USER_PROTOCOL_F_LOG_SHMFD);
667 static int vhost_user_migration_done(struct vhost_dev *dev, char* mac_addr)
669 VhostUserMsg msg = { 0 };
671 assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
673 /* If guest supports GUEST_ANNOUNCE do nothing */
674 if (virtio_has_feature(dev->acked_features, VIRTIO_NET_F_GUEST_ANNOUNCE)) {
675 return 0;
678 /* if backend supports VHOST_USER_PROTOCOL_F_RARP ask it to send the RARP */
679 if (virtio_has_feature(dev->protocol_features,
680 VHOST_USER_PROTOCOL_F_RARP)) {
681 msg.request = VHOST_USER_SEND_RARP;
682 msg.flags = VHOST_USER_VERSION;
683 memcpy((char *)&msg.payload.u64, mac_addr, 6);
684 msg.size = sizeof(msg.payload.u64);
686 return vhost_user_write(dev, &msg, NULL, 0);
688 return -1;
691 static bool vhost_user_can_merge(struct vhost_dev *dev,
692 uint64_t start1, uint64_t size1,
693 uint64_t start2, uint64_t size2)
695 ram_addr_t offset;
696 int mfd, rfd;
697 MemoryRegion *mr;
699 mr = memory_region_from_host((void *)(uintptr_t)start1, &offset);
700 mfd = memory_region_get_fd(mr);
702 mr = memory_region_from_host((void *)(uintptr_t)start2, &offset);
703 rfd = memory_region_get_fd(mr);
705 return mfd == rfd;
708 static int vhost_user_net_set_mtu(struct vhost_dev *dev, uint16_t mtu)
710 VhostUserMsg msg;
711 bool reply_supported = virtio_has_feature(dev->protocol_features,
712 VHOST_USER_PROTOCOL_F_REPLY_ACK);
714 if (!(dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_NET_MTU))) {
715 return 0;
718 msg.request = VHOST_USER_NET_SET_MTU;
719 msg.payload.u64 = mtu;
720 msg.size = sizeof(msg.payload.u64);
721 msg.flags = VHOST_USER_VERSION;
722 if (reply_supported) {
723 msg.flags |= VHOST_USER_NEED_REPLY_MASK;
726 if (vhost_user_write(dev, &msg, NULL, 0) < 0) {
727 return -1;
730 /* If reply_ack supported, slave has to ack specified MTU is valid */
731 if (reply_supported) {
732 return process_message_reply(dev, &msg);
735 return 0;
738 const VhostOps user_ops = {
739 .backend_type = VHOST_BACKEND_TYPE_USER,
740 .vhost_backend_init = vhost_user_init,
741 .vhost_backend_cleanup = vhost_user_cleanup,
742 .vhost_backend_memslots_limit = vhost_user_memslots_limit,
743 .vhost_set_log_base = vhost_user_set_log_base,
744 .vhost_set_mem_table = vhost_user_set_mem_table,
745 .vhost_set_vring_addr = vhost_user_set_vring_addr,
746 .vhost_set_vring_endian = vhost_user_set_vring_endian,
747 .vhost_set_vring_num = vhost_user_set_vring_num,
748 .vhost_set_vring_base = vhost_user_set_vring_base,
749 .vhost_get_vring_base = vhost_user_get_vring_base,
750 .vhost_set_vring_kick = vhost_user_set_vring_kick,
751 .vhost_set_vring_call = vhost_user_set_vring_call,
752 .vhost_set_features = vhost_user_set_features,
753 .vhost_get_features = vhost_user_get_features,
754 .vhost_set_owner = vhost_user_set_owner,
755 .vhost_reset_device = vhost_user_reset_device,
756 .vhost_get_vq_index = vhost_user_get_vq_index,
757 .vhost_set_vring_enable = vhost_user_set_vring_enable,
758 .vhost_requires_shm_log = vhost_user_requires_shm_log,
759 .vhost_migration_done = vhost_user_migration_done,
760 .vhost_backend_can_merge = vhost_user_can_merge,
761 .vhost_net_set_mtu = vhost_user_net_set_mtu,