qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/4] vhost: add set_vhost_endpoint and clear_vhost_e


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH 2/4] vhost: add set_vhost_endpoint and clear_vhost_endpoint callbacks
Date: Wed, 30 Jan 2013 17:41:24 +0100

Needed for vhost-scsi, see previous commit.

Signed-off-by: Paolo Bonzini <address@hidden>
---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]