diff options
author | Jin Yu | 2020-11-03 13:36:17 +0100 |
---|---|---|
committer | Michael S. Tsirkin | 2020-11-03 22:39:05 +0100 |
commit | 1b0063b3048af65dfaae6422a572c87db8575a92 (patch) | |
tree | 60e22f00578b6e978be8fe155c08712de591140c /hw/virtio | |
parent | Revert "vhost-blk: set features before setting inflight feature" (diff) | |
download | qemu-1b0063b3048af65dfaae6422a572c87db8575a92.tar.gz qemu-1b0063b3048af65dfaae6422a572c87db8575a92.tar.xz qemu-1b0063b3048af65dfaae6422a572c87db8575a92.zip |
vhost-blk: set features before setting inflight feature
Virtqueue has split and packed, so before setting inflight,
you need to inform the back-end virtqueue format.
Signed-off-by: Jin Yu <jin.yu@intel.com>
Acked-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20201103123617.28256-1-jin.yu@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r-- | hw/virtio/vhost.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 79b2be20df..614ccc2bcb 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1645,6 +1645,26 @@ int vhost_dev_load_inflight(struct vhost_inflight *inflight, QEMUFile *f) return 0; } +int vhost_dev_prepare_inflight(struct vhost_dev *hdev, VirtIODevice *vdev) +{ + int r; + + if (hdev->vhost_ops->vhost_get_inflight_fd == NULL || + hdev->vhost_ops->vhost_set_inflight_fd == NULL) { + return 0; + } + + hdev->vdev = vdev; + + r = vhost_dev_set_features(hdev, hdev->log_enabled); + if (r < 0) { + VHOST_OPS_DEBUG("vhost_dev_prepare_inflight failed"); + return r; + } + + return 0; +} + int vhost_dev_set_inflight(struct vhost_dev *dev, struct vhost_inflight *inflight) { |