Needed for vhost-scsi, see previous commit.
Signed-off-by: Paolo Bonzini <[email protected]>
---
hw/vhost.c | 9 +++++++++
hw/virtio.h | 2 ++
2 files changed, 11 insertions(+)
diff --git a/hw/vhost.c b/hw/vhost.c
index edb6b08..09fa4e1 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -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;
diff --git a/hw/virtio.h b/hw/virtio.h
index 9cc7b85..dd37d59 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -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);
--
1.8.1