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>
This commit is contained in:
parent
b7c1bd9d78
commit
1b0063b304
@ -131,6 +131,12 @@ static int vhost_user_blk_start(VirtIODevice *vdev)
|
|||||||
|
|
||||||
s->dev.acked_features = vdev->guest_features;
|
s->dev.acked_features = vdev->guest_features;
|
||||||
|
|
||||||
|
ret = vhost_dev_prepare_inflight(&s->dev, vdev);
|
||||||
|
if (ret < 0) {
|
||||||
|
error_report("Error set inflight format: %d", -ret);
|
||||||
|
goto err_guest_notifiers;
|
||||||
|
}
|
||||||
|
|
||||||
if (!s->inflight->addr) {
|
if (!s->inflight->addr) {
|
||||||
ret = vhost_dev_get_inflight(&s->dev, s->queue_size, s->inflight);
|
ret = vhost_dev_get_inflight(&s->dev, s->queue_size, s->inflight);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -1645,6 +1645,26 @@ int vhost_dev_load_inflight(struct vhost_inflight *inflight, QEMUFile *f)
|
|||||||
return 0;
|
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,
|
int vhost_dev_set_inflight(struct vhost_dev *dev,
|
||||||
struct vhost_inflight *inflight)
|
struct vhost_inflight *inflight)
|
||||||
{
|
{
|
||||||
|
@ -141,6 +141,7 @@ void vhost_dev_reset_inflight(struct vhost_inflight *inflight);
|
|||||||
void vhost_dev_free_inflight(struct vhost_inflight *inflight);
|
void vhost_dev_free_inflight(struct vhost_inflight *inflight);
|
||||||
void vhost_dev_save_inflight(struct vhost_inflight *inflight, QEMUFile *f);
|
void vhost_dev_save_inflight(struct vhost_inflight *inflight, QEMUFile *f);
|
||||||
int vhost_dev_load_inflight(struct vhost_inflight *inflight, QEMUFile *f);
|
int vhost_dev_load_inflight(struct vhost_inflight *inflight, QEMUFile *f);
|
||||||
|
int vhost_dev_prepare_inflight(struct vhost_dev *hdev, VirtIODevice *vdev);
|
||||||
int vhost_dev_set_inflight(struct vhost_dev *dev,
|
int vhost_dev_set_inflight(struct vhost_dev *dev,
|
||||||
struct vhost_inflight *inflight);
|
struct vhost_inflight *inflight);
|
||||||
int vhost_dev_get_inflight(struct vhost_dev *dev, uint16_t queue_size,
|
int vhost_dev_get_inflight(struct vhost_dev *dev, uint16_t queue_size,
|
||||||
|
Loading…
Reference in New Issue
Block a user