Comments
Patch
@@ -985,6 +985,12 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev)
goto fail_vq;
}
}
+ if (vdev->set_vhost_endpoint) {
+ r = vdev->set_vhost_endpoint(vdev);
+ if (r < 0) {
+ goto fail_vq;
+ }
+ }
for (j = 0; j < hdev->nvqs; ++j) {
r = vhost_virtqueue_start(hdev,
@@ -1051,6 +1057,9 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
}
assert (r >= 0);
+ if (vdev->clear_vhost_endpoint) {
+ vdev->clear_vhost_endpoint(vdev);
+ }
hdev->started = false;
g_free(hdev->log);
hdev->log = NULL;
@@ -134,6 +134,8 @@ struct VirtIODevice
*/
uint32_t (*get_features)(VirtIODevice *vdev, uint32_t requested_features);
uint32_t (*bad_features)(VirtIODevice *vdev);
+ int (*set_vhost_endpoint)(VirtIODevice *vdev);
+ void (*clear_vhost_endpoint)(VirtIODevice *vdev);
void (*set_features)(VirtIODevice *vdev, uint32_t val);
void (*get_config)(VirtIODevice *vdev, uint8_t *config);
void (*set_config)(VirtIODevice *vdev, const uint8_t *config);
Needed for vhost-scsi, see previous commit. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- hw/vhost.c | 9 +++++++++ hw/virtio.h | 2 ++ 2 files changed, 11 insertions(+)