vhost-user.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. /*
  2. * vhost-user
  3. *
  4. * Copyright (c) 2013 Virtual Open Systems Sarl.
  5. *
  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.
  8. *
  9. */
  10. #include "qemu/osdep.h"
  11. #include "qapi/error.h"
  12. #include "hw/virtio/vhost.h"
  13. #include "hw/virtio/vhost-backend.h"
  14. #include "hw/virtio/virtio-net.h"
  15. #include "sysemu/char.h"
  16. #include "sysemu/kvm.h"
  17. #include "qemu/error-report.h"
  18. #include "qemu/sockets.h"
  19. #include "migration/migration.h"
  20. #include <sys/ioctl.h>
  21. #include <sys/socket.h>
  22. #include <sys/un.h>
  23. #include <linux/vhost.h>
  24. #define VHOST_MEMORY_MAX_NREGIONS 8
  25. #define VHOST_USER_F_PROTOCOL_FEATURES 30
  26. enum VhostUserProtocolFeature {
  27. VHOST_USER_PROTOCOL_F_MQ = 0,
  28. VHOST_USER_PROTOCOL_F_LOG_SHMFD = 1,
  29. VHOST_USER_PROTOCOL_F_RARP = 2,
  30. VHOST_USER_PROTOCOL_F_MAX
  31. };
  32. #define VHOST_USER_PROTOCOL_FEATURE_MASK ((1 << VHOST_USER_PROTOCOL_F_MAX) - 1)
  33. typedef enum VhostUserRequest {
  34. VHOST_USER_NONE = 0,
  35. VHOST_USER_GET_FEATURES = 1,
  36. VHOST_USER_SET_FEATURES = 2,
  37. VHOST_USER_SET_OWNER = 3,
  38. VHOST_USER_RESET_OWNER = 4,
  39. VHOST_USER_SET_MEM_TABLE = 5,
  40. VHOST_USER_SET_LOG_BASE = 6,
  41. VHOST_USER_SET_LOG_FD = 7,
  42. VHOST_USER_SET_VRING_NUM = 8,
  43. VHOST_USER_SET_VRING_ADDR = 9,
  44. VHOST_USER_SET_VRING_BASE = 10,
  45. VHOST_USER_GET_VRING_BASE = 11,
  46. VHOST_USER_SET_VRING_KICK = 12,
  47. VHOST_USER_SET_VRING_CALL = 13,
  48. VHOST_USER_SET_VRING_ERR = 14,
  49. VHOST_USER_GET_PROTOCOL_FEATURES = 15,
  50. VHOST_USER_SET_PROTOCOL_FEATURES = 16,
  51. VHOST_USER_GET_QUEUE_NUM = 17,
  52. VHOST_USER_SET_VRING_ENABLE = 18,
  53. VHOST_USER_SEND_RARP = 19,
  54. VHOST_USER_MAX
  55. } VhostUserRequest;
  56. typedef struct VhostUserMemoryRegion {
  57. uint64_t guest_phys_addr;
  58. uint64_t memory_size;
  59. uint64_t userspace_addr;
  60. uint64_t mmap_offset;
  61. } VhostUserMemoryRegion;
  62. typedef struct VhostUserMemory {
  63. uint32_t nregions;
  64. uint32_t padding;
  65. VhostUserMemoryRegion regions[VHOST_MEMORY_MAX_NREGIONS];
  66. } VhostUserMemory;
  67. typedef struct VhostUserLog {
  68. uint64_t mmap_size;
  69. uint64_t mmap_offset;
  70. } VhostUserLog;
  71. typedef struct VhostUserMsg {
  72. VhostUserRequest request;
  73. #define VHOST_USER_VERSION_MASK (0x3)
  74. #define VHOST_USER_REPLY_MASK (0x1<<2)
  75. uint32_t flags;
  76. uint32_t size; /* the following payload size */
  77. union {
  78. #define VHOST_USER_VRING_IDX_MASK (0xff)
  79. #define VHOST_USER_VRING_NOFD_MASK (0x1<<8)
  80. uint64_t u64;
  81. struct vhost_vring_state state;
  82. struct vhost_vring_addr addr;
  83. VhostUserMemory memory;
  84. VhostUserLog log;
  85. } payload;
  86. } QEMU_PACKED VhostUserMsg;
  87. static VhostUserMsg m __attribute__ ((unused));
  88. #define VHOST_USER_HDR_SIZE (sizeof(m.request) \
  89. + sizeof(m.flags) \
  90. + sizeof(m.size))
  91. #define VHOST_USER_PAYLOAD_SIZE (sizeof(m) - VHOST_USER_HDR_SIZE)
  92. /* The version of the protocol we support */
  93. #define VHOST_USER_VERSION (0x1)
  94. static bool ioeventfd_enabled(void)
  95. {
  96. return kvm_enabled() && kvm_eventfds_enabled();
  97. }
  98. static int vhost_user_read(struct vhost_dev *dev, VhostUserMsg *msg)
  99. {
  100. CharDriverState *chr = dev->opaque;
  101. uint8_t *p = (uint8_t *) msg;
  102. int r, size = VHOST_USER_HDR_SIZE;
  103. r = qemu_chr_fe_read_all(chr, p, size);
  104. if (r != size) {
  105. error_report("Failed to read msg header. Read %d instead of %d."
  106. " Original request %d.", r, size, msg->request);
  107. goto fail;
  108. }
  109. /* validate received flags */
  110. if (msg->flags != (VHOST_USER_REPLY_MASK | VHOST_USER_VERSION)) {
  111. error_report("Failed to read msg header."
  112. " Flags 0x%x instead of 0x%x.", msg->flags,
  113. VHOST_USER_REPLY_MASK | VHOST_USER_VERSION);
  114. goto fail;
  115. }
  116. /* validate message size is sane */
  117. if (msg->size > VHOST_USER_PAYLOAD_SIZE) {
  118. error_report("Failed to read msg header."
  119. " Size %d exceeds the maximum %zu.", msg->size,
  120. VHOST_USER_PAYLOAD_SIZE);
  121. goto fail;
  122. }
  123. if (msg->size) {
  124. p += VHOST_USER_HDR_SIZE;
  125. size = msg->size;
  126. r = qemu_chr_fe_read_all(chr, p, size);
  127. if (r != size) {
  128. error_report("Failed to read msg payload."
  129. " Read %d instead of %d.", r, msg->size);
  130. goto fail;
  131. }
  132. }
  133. return 0;
  134. fail:
  135. return -1;
  136. }
  137. static bool vhost_user_one_time_request(VhostUserRequest request)
  138. {
  139. switch (request) {
  140. case VHOST_USER_SET_OWNER:
  141. case VHOST_USER_RESET_OWNER:
  142. case VHOST_USER_SET_MEM_TABLE:
  143. case VHOST_USER_GET_QUEUE_NUM:
  144. return true;
  145. default:
  146. return false;
  147. }
  148. }
  149. /* most non-init callers ignore the error */
  150. static int vhost_user_write(struct vhost_dev *dev, VhostUserMsg *msg,
  151. int *fds, int fd_num)
  152. {
  153. CharDriverState *chr = dev->opaque;
  154. int size = VHOST_USER_HDR_SIZE + msg->size;
  155. /*
  156. * For non-vring specific requests, like VHOST_USER_SET_MEM_TABLE,
  157. * we just need send it once in the first time. For later such
  158. * request, we just ignore it.
  159. */
  160. if (vhost_user_one_time_request(msg->request) && dev->vq_index != 0) {
  161. return 0;
  162. }
  163. if (fd_num) {
  164. qemu_chr_fe_set_msgfds(chr, fds, fd_num);
  165. }
  166. return qemu_chr_fe_write_all(chr, (const uint8_t *) msg, size) == size ?
  167. 0 : -1;
  168. }
  169. static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,
  170. struct vhost_log *log)
  171. {
  172. int fds[VHOST_MEMORY_MAX_NREGIONS];
  173. size_t fd_num = 0;
  174. bool shmfd = virtio_has_feature(dev->protocol_features,
  175. VHOST_USER_PROTOCOL_F_LOG_SHMFD);
  176. VhostUserMsg msg = {
  177. .request = VHOST_USER_SET_LOG_BASE,
  178. .flags = VHOST_USER_VERSION,
  179. .payload.log.mmap_size = log->size * sizeof(*(log->log)),
  180. .payload.log.mmap_offset = 0,
  181. .size = sizeof(msg.payload.log),
  182. };
  183. if (shmfd && log->fd != -1) {
  184. fds[fd_num++] = log->fd;
  185. }
  186. vhost_user_write(dev, &msg, fds, fd_num);
  187. if (shmfd) {
  188. msg.size = 0;
  189. if (vhost_user_read(dev, &msg) < 0) {
  190. return 0;
  191. }
  192. if (msg.request != VHOST_USER_SET_LOG_BASE) {
  193. error_report("Received unexpected msg type. "
  194. "Expected %d received %d",
  195. VHOST_USER_SET_LOG_BASE, msg.request);
  196. return -1;
  197. }
  198. }
  199. return 0;
  200. }
  201. static int vhost_user_set_mem_table(struct vhost_dev *dev,
  202. struct vhost_memory *mem)
  203. {
  204. int fds[VHOST_MEMORY_MAX_NREGIONS];
  205. int i, fd;
  206. size_t fd_num = 0;
  207. VhostUserMsg msg = {
  208. .request = VHOST_USER_SET_MEM_TABLE,
  209. .flags = VHOST_USER_VERSION,
  210. };
  211. for (i = 0; i < dev->mem->nregions; ++i) {
  212. struct vhost_memory_region *reg = dev->mem->regions + i;
  213. ram_addr_t offset;
  214. MemoryRegion *mr;
  215. assert((uintptr_t)reg->userspace_addr == reg->userspace_addr);
  216. mr = memory_region_from_host((void *)(uintptr_t)reg->userspace_addr,
  217. &offset);
  218. fd = memory_region_get_fd(mr);
  219. if (fd > 0) {
  220. msg.payload.memory.regions[fd_num].userspace_addr = reg->userspace_addr;
  221. msg.payload.memory.regions[fd_num].memory_size = reg->memory_size;
  222. msg.payload.memory.regions[fd_num].guest_phys_addr = reg->guest_phys_addr;
  223. msg.payload.memory.regions[fd_num].mmap_offset = offset;
  224. assert(fd_num < VHOST_MEMORY_MAX_NREGIONS);
  225. fds[fd_num++] = fd;
  226. }
  227. }
  228. msg.payload.memory.nregions = fd_num;
  229. if (!fd_num) {
  230. error_report("Failed initializing vhost-user memory map, "
  231. "consider using -object memory-backend-file share=on");
  232. return -1;
  233. }
  234. msg.size = sizeof(msg.payload.memory.nregions);
  235. msg.size += sizeof(msg.payload.memory.padding);
  236. msg.size += fd_num * sizeof(VhostUserMemoryRegion);
  237. vhost_user_write(dev, &msg, fds, fd_num);
  238. return 0;
  239. }
  240. static int vhost_user_set_vring_addr(struct vhost_dev *dev,
  241. struct vhost_vring_addr *addr)
  242. {
  243. VhostUserMsg msg = {
  244. .request = VHOST_USER_SET_VRING_ADDR,
  245. .flags = VHOST_USER_VERSION,
  246. .payload.addr = *addr,
  247. .size = sizeof(msg.payload.addr),
  248. };
  249. vhost_user_write(dev, &msg, NULL, 0);
  250. return 0;
  251. }
  252. static int vhost_user_set_vring_endian(struct vhost_dev *dev,
  253. struct vhost_vring_state *ring)
  254. {
  255. error_report("vhost-user trying to send unhandled ioctl");
  256. return -1;
  257. }
  258. static int vhost_set_vring(struct vhost_dev *dev,
  259. unsigned long int request,
  260. struct vhost_vring_state *ring)
  261. {
  262. VhostUserMsg msg = {
  263. .request = request,
  264. .flags = VHOST_USER_VERSION,
  265. .payload.state = *ring,
  266. .size = sizeof(msg.payload.state),
  267. };
  268. vhost_user_write(dev, &msg, NULL, 0);
  269. return 0;
  270. }
  271. static int vhost_user_set_vring_num(struct vhost_dev *dev,
  272. struct vhost_vring_state *ring)
  273. {
  274. return vhost_set_vring(dev, VHOST_USER_SET_VRING_NUM, ring);
  275. }
  276. static int vhost_user_set_vring_base(struct vhost_dev *dev,
  277. struct vhost_vring_state *ring)
  278. {
  279. return vhost_set_vring(dev, VHOST_USER_SET_VRING_BASE, ring);
  280. }
  281. static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable)
  282. {
  283. int i;
  284. if (!virtio_has_feature(dev->features, VHOST_USER_F_PROTOCOL_FEATURES)) {
  285. return -1;
  286. }
  287. for (i = 0; i < dev->nvqs; ++i) {
  288. struct vhost_vring_state state = {
  289. .index = dev->vq_index + i,
  290. .num = enable,
  291. };
  292. vhost_set_vring(dev, VHOST_USER_SET_VRING_ENABLE, &state);
  293. }
  294. return 0;
  295. }
  296. static int vhost_user_get_vring_base(struct vhost_dev *dev,
  297. struct vhost_vring_state *ring)
  298. {
  299. VhostUserMsg msg = {
  300. .request = VHOST_USER_GET_VRING_BASE,
  301. .flags = VHOST_USER_VERSION,
  302. .payload.state = *ring,
  303. .size = sizeof(msg.payload.state),
  304. };
  305. vhost_user_write(dev, &msg, NULL, 0);
  306. if (vhost_user_read(dev, &msg) < 0) {
  307. return 0;
  308. }
  309. if (msg.request != VHOST_USER_GET_VRING_BASE) {
  310. error_report("Received unexpected msg type. Expected %d received %d",
  311. VHOST_USER_GET_VRING_BASE, msg.request);
  312. return -1;
  313. }
  314. if (msg.size != sizeof(msg.payload.state)) {
  315. error_report("Received bad msg size.");
  316. return -1;
  317. }
  318. *ring = msg.payload.state;
  319. return 0;
  320. }
  321. static int vhost_set_vring_file(struct vhost_dev *dev,
  322. VhostUserRequest request,
  323. struct vhost_vring_file *file)
  324. {
  325. int fds[VHOST_MEMORY_MAX_NREGIONS];
  326. size_t fd_num = 0;
  327. VhostUserMsg msg = {
  328. .request = request,
  329. .flags = VHOST_USER_VERSION,
  330. .payload.u64 = file->index & VHOST_USER_VRING_IDX_MASK,
  331. .size = sizeof(msg.payload.u64),
  332. };
  333. if (ioeventfd_enabled() && file->fd > 0) {
  334. fds[fd_num++] = file->fd;
  335. } else {
  336. msg.payload.u64 |= VHOST_USER_VRING_NOFD_MASK;
  337. }
  338. vhost_user_write(dev, &msg, fds, fd_num);
  339. return 0;
  340. }
  341. static int vhost_user_set_vring_kick(struct vhost_dev *dev,
  342. struct vhost_vring_file *file)
  343. {
  344. return vhost_set_vring_file(dev, VHOST_USER_SET_VRING_KICK, file);
  345. }
  346. static int vhost_user_set_vring_call(struct vhost_dev *dev,
  347. struct vhost_vring_file *file)
  348. {
  349. return vhost_set_vring_file(dev, VHOST_USER_SET_VRING_CALL, file);
  350. }
  351. static int vhost_user_set_u64(struct vhost_dev *dev, int request, uint64_t u64)
  352. {
  353. VhostUserMsg msg = {
  354. .request = request,
  355. .flags = VHOST_USER_VERSION,
  356. .payload.u64 = u64,
  357. .size = sizeof(msg.payload.u64),
  358. };
  359. vhost_user_write(dev, &msg, NULL, 0);
  360. return 0;
  361. }
  362. static int vhost_user_set_features(struct vhost_dev *dev,
  363. uint64_t features)
  364. {
  365. return vhost_user_set_u64(dev, VHOST_USER_SET_FEATURES, features);
  366. }
  367. static int vhost_user_set_protocol_features(struct vhost_dev *dev,
  368. uint64_t features)
  369. {
  370. return vhost_user_set_u64(dev, VHOST_USER_SET_PROTOCOL_FEATURES, features);
  371. }
  372. static int vhost_user_get_u64(struct vhost_dev *dev, int request, uint64_t *u64)
  373. {
  374. VhostUserMsg msg = {
  375. .request = request,
  376. .flags = VHOST_USER_VERSION,
  377. };
  378. if (vhost_user_one_time_request(request) && dev->vq_index != 0) {
  379. return 0;
  380. }
  381. vhost_user_write(dev, &msg, NULL, 0);
  382. if (vhost_user_read(dev, &msg) < 0) {
  383. return 0;
  384. }
  385. if (msg.request != request) {
  386. error_report("Received unexpected msg type. Expected %d received %d",
  387. request, msg.request);
  388. return -1;
  389. }
  390. if (msg.size != sizeof(msg.payload.u64)) {
  391. error_report("Received bad msg size.");
  392. return -1;
  393. }
  394. *u64 = msg.payload.u64;
  395. return 0;
  396. }
  397. static int vhost_user_get_features(struct vhost_dev *dev, uint64_t *features)
  398. {
  399. return vhost_user_get_u64(dev, VHOST_USER_GET_FEATURES, features);
  400. }
  401. static int vhost_user_set_owner(struct vhost_dev *dev)
  402. {
  403. VhostUserMsg msg = {
  404. .request = VHOST_USER_SET_OWNER,
  405. .flags = VHOST_USER_VERSION,
  406. };
  407. vhost_user_write(dev, &msg, NULL, 0);
  408. return 0;
  409. }
  410. static int vhost_user_reset_device(struct vhost_dev *dev)
  411. {
  412. VhostUserMsg msg = {
  413. .request = VHOST_USER_RESET_OWNER,
  414. .flags = VHOST_USER_VERSION,
  415. };
  416. vhost_user_write(dev, &msg, NULL, 0);
  417. return 0;
  418. }
  419. static int vhost_user_init(struct vhost_dev *dev, void *opaque)
  420. {
  421. uint64_t features;
  422. int err;
  423. assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
  424. dev->opaque = opaque;
  425. err = vhost_user_get_features(dev, &features);
  426. if (err < 0) {
  427. return err;
  428. }
  429. if (virtio_has_feature(features, VHOST_USER_F_PROTOCOL_FEATURES)) {
  430. dev->backend_features |= 1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
  431. err = vhost_user_get_u64(dev, VHOST_USER_GET_PROTOCOL_FEATURES,
  432. &features);
  433. if (err < 0) {
  434. return err;
  435. }
  436. dev->protocol_features = features & VHOST_USER_PROTOCOL_FEATURE_MASK;
  437. err = vhost_user_set_protocol_features(dev, dev->protocol_features);
  438. if (err < 0) {
  439. return err;
  440. }
  441. /* query the max queues we support if backend supports Multiple Queue */
  442. if (dev->protocol_features & (1ULL << VHOST_USER_PROTOCOL_F_MQ)) {
  443. err = vhost_user_get_u64(dev, VHOST_USER_GET_QUEUE_NUM,
  444. &dev->max_queues);
  445. if (err < 0) {
  446. return err;
  447. }
  448. }
  449. }
  450. if (dev->migration_blocker == NULL &&
  451. !virtio_has_feature(dev->protocol_features,
  452. VHOST_USER_PROTOCOL_F_LOG_SHMFD)) {
  453. error_setg(&dev->migration_blocker,
  454. "Migration disabled: vhost-user backend lacks "
  455. "VHOST_USER_PROTOCOL_F_LOG_SHMFD feature.");
  456. }
  457. return 0;
  458. }
  459. static int vhost_user_cleanup(struct vhost_dev *dev)
  460. {
  461. assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
  462. dev->opaque = 0;
  463. return 0;
  464. }
  465. static int vhost_user_get_vq_index(struct vhost_dev *dev, int idx)
  466. {
  467. assert(idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs);
  468. return idx;
  469. }
  470. static int vhost_user_memslots_limit(struct vhost_dev *dev)
  471. {
  472. return VHOST_MEMORY_MAX_NREGIONS;
  473. }
  474. static bool vhost_user_requires_shm_log(struct vhost_dev *dev)
  475. {
  476. assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
  477. return virtio_has_feature(dev->protocol_features,
  478. VHOST_USER_PROTOCOL_F_LOG_SHMFD);
  479. }
  480. static int vhost_user_migration_done(struct vhost_dev *dev, char* mac_addr)
  481. {
  482. VhostUserMsg msg = { 0 };
  483. int err;
  484. assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
  485. /* If guest supports GUEST_ANNOUNCE do nothing */
  486. if (virtio_has_feature(dev->acked_features, VIRTIO_NET_F_GUEST_ANNOUNCE)) {
  487. return 0;
  488. }
  489. /* if backend supports VHOST_USER_PROTOCOL_F_RARP ask it to send the RARP */
  490. if (virtio_has_feature(dev->protocol_features,
  491. VHOST_USER_PROTOCOL_F_RARP)) {
  492. msg.request = VHOST_USER_SEND_RARP;
  493. msg.flags = VHOST_USER_VERSION;
  494. memcpy((char *)&msg.payload.u64, mac_addr, 6);
  495. msg.size = sizeof(msg.payload.u64);
  496. err = vhost_user_write(dev, &msg, NULL, 0);
  497. return err;
  498. }
  499. return -1;
  500. }
  501. static bool vhost_user_can_merge(struct vhost_dev *dev,
  502. uint64_t start1, uint64_t size1,
  503. uint64_t start2, uint64_t size2)
  504. {
  505. ram_addr_t offset;
  506. int mfd, rfd;
  507. MemoryRegion *mr;
  508. mr = memory_region_from_host((void *)(uintptr_t)start1, &offset);
  509. mfd = memory_region_get_fd(mr);
  510. mr = memory_region_from_host((void *)(uintptr_t)start2, &offset);
  511. rfd = memory_region_get_fd(mr);
  512. return mfd == rfd;
  513. }
  514. const VhostOps user_ops = {
  515. .backend_type = VHOST_BACKEND_TYPE_USER,
  516. .vhost_backend_init = vhost_user_init,
  517. .vhost_backend_cleanup = vhost_user_cleanup,
  518. .vhost_backend_memslots_limit = vhost_user_memslots_limit,
  519. .vhost_set_log_base = vhost_user_set_log_base,
  520. .vhost_set_mem_table = vhost_user_set_mem_table,
  521. .vhost_set_vring_addr = vhost_user_set_vring_addr,
  522. .vhost_set_vring_endian = vhost_user_set_vring_endian,
  523. .vhost_set_vring_num = vhost_user_set_vring_num,
  524. .vhost_set_vring_base = vhost_user_set_vring_base,
  525. .vhost_get_vring_base = vhost_user_get_vring_base,
  526. .vhost_set_vring_kick = vhost_user_set_vring_kick,
  527. .vhost_set_vring_call = vhost_user_set_vring_call,
  528. .vhost_set_features = vhost_user_set_features,
  529. .vhost_get_features = vhost_user_get_features,
  530. .vhost_set_owner = vhost_user_set_owner,
  531. .vhost_reset_device = vhost_user_reset_device,
  532. .vhost_get_vq_index = vhost_user_get_vq_index,
  533. .vhost_set_vring_enable = vhost_user_set_vring_enable,
  534. .vhost_requires_shm_log = vhost_user_requires_shm_log,
  535. .vhost_migration_done = vhost_user_migration_done,
  536. .vhost_backend_can_merge = vhost_user_can_merge,
  537. };