|
@@ -1286,7 +1286,8 @@ static void vhost_virtqueue_cleanup(struct vhost_virtqueue *vq)
|
|
|
}
|
|
|
|
|
|
int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
|
|
|
- VhostBackendType backend_type, uint32_t busyloop_timeout)
|
|
|
+ VhostBackendType backend_type, uint32_t busyloop_timeout,
|
|
|
+ Error **errp)
|
|
|
{
|
|
|
uint64_t features;
|
|
|
int i, r, n_initialized_vqs = 0;
|
|
@@ -1300,24 +1301,26 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
|
|
|
|
|
|
r = hdev->vhost_ops->vhost_backend_init(hdev, opaque);
|
|
|
if (r < 0) {
|
|
|
+ error_setg(errp, "vhost_backend_init failed");
|
|
|
goto fail;
|
|
|
}
|
|
|
|
|
|
r = hdev->vhost_ops->vhost_set_owner(hdev);
|
|
|
if (r < 0) {
|
|
|
- VHOST_OPS_DEBUG("vhost_set_owner failed");
|
|
|
+ error_setg(errp, "vhost_set_owner failed");
|
|
|
goto fail;
|
|
|
}
|
|
|
|
|
|
r = hdev->vhost_ops->vhost_get_features(hdev, &features);
|
|
|
if (r < 0) {
|
|
|
- VHOST_OPS_DEBUG("vhost_get_features failed");
|
|
|
+ error_setg(errp, "vhost_get_features failed");
|
|
|
goto fail;
|
|
|
}
|
|
|
|
|
|
for (i = 0; i < hdev->nvqs; ++i, ++n_initialized_vqs) {
|
|
|
r = vhost_virtqueue_init(hdev, hdev->vqs + i, hdev->vq_index + i);
|
|
|
if (r < 0) {
|
|
|
+ error_setg_errno(errp, -r, "Failed to initialize virtqueue %d", i);
|
|
|
goto fail;
|
|
|
}
|
|
|
}
|
|
@@ -1327,6 +1330,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
|
|
|
r = vhost_virtqueue_set_busyloop_timeout(hdev, hdev->vq_index + i,
|
|
|
busyloop_timeout);
|
|
|
if (r < 0) {
|
|
|
+ error_setg(errp, "Failed to set busyloop timeout");
|
|
|
goto fail_busyloop;
|
|
|
}
|
|
|
}
|
|
@@ -1367,7 +1371,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
|
|
|
if (hdev->migration_blocker != NULL) {
|
|
|
r = migrate_add_blocker(hdev->migration_blocker, &local_err);
|
|
|
if (local_err) {
|
|
|
- error_report_err(local_err);
|
|
|
+ error_propagate(errp, local_err);
|
|
|
error_free(hdev->migration_blocker);
|
|
|
goto fail_busyloop;
|
|
|
}
|
|
@@ -1384,8 +1388,8 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
|
|
|
QLIST_INSERT_HEAD(&vhost_devices, hdev, entry);
|
|
|
|
|
|
if (used_memslots > hdev->vhost_ops->vhost_backend_memslots_limit(hdev)) {
|
|
|
- error_report("vhost backend memory slots limit is less"
|
|
|
- " than current number of present memory slots");
|
|
|
+ error_setg(errp, "vhost backend memory slots limit is less"
|
|
|
+ " than current number of present memory slots");
|
|
|
r = -1;
|
|
|
goto fail_busyloop;
|
|
|
}
|