qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v1 08/10] vhost: implement vhost_dev_start method


From: Jason Wang
Subject: Re: [PATCH v1 08/10] vhost: implement vhost_dev_start method
Date: Tue, 23 Jun 2020 15:21:31 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0


On 2020/6/22 下午11:37, Cindy Lu wrote:
use the vhost_dev_start callback to send the status to backend


I suggest to squash this into previous patch.



Signed-off-by: Cindy Lu <lulu@redhat.com>
---
  hw/virtio/vhost.c         | 17 +++++++++++++++++
  include/hw/virtio/vhost.h |  2 ++
  2 files changed, 19 insertions(+)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 01ebe12f28..bfd7f9ce1f 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -744,6 +744,7 @@ static void vhost_iommu_region_del(MemoryListener *listener,
      }
  }
+
  static int vhost_virtqueue_set_addr(struct vhost_dev *dev,
                                      struct vhost_virtqueue *vq,
                                      unsigned idx, bool enable_log)
@@ -1661,6 +1662,11 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice 
*vdev)
          }
      }
+ r = vhost_set_start(hdev, true);


I think we need a better name for this function.


+    if (r) {
+        goto fail_log;
+    }
+
      if (vhost_dev_has_iommu(hdev)) {
          hdev->vhost_ops->vhost_set_iotlb_callback(hdev, true);
@@ -1697,6 +1703,8 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev)
      /* should only be called after backend is connected */
      assert(hdev->vhost_ops);
+ vhost_set_start(hdev, false);
+
      for (i = 0; i < hdev->nvqs; ++i) {
          vhost_virtqueue_stop(hdev,
                               vdev,
@@ -1722,3 +1730,12 @@ int vhost_net_set_backend(struct vhost_dev *hdev,
return -1;
  }
+
+int vhost_set_start(struct vhost_dev *hdev, bool started)
+{
+
+    if (hdev->vhost_ops->vhost_dev_start) {
+        hdev->vhost_ops->vhost_dev_start(hdev, started);
+    }
+    return 0;
+}
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h
index 085450c6f8..59ea53f8c2 100644
--- a/include/hw/virtio/vhost.h
+++ b/include/hw/virtio/vhost.h
@@ -92,6 +92,7 @@ struct vhost_dev {
      const VhostDevConfigOps *config_ops;
  };
+
  int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
                     VhostBackendType backend_type,
                     uint32_t busyloop_timeout);
@@ -137,4 +138,5 @@ int vhost_dev_set_inflight(struct vhost_dev *dev,
                             struct vhost_inflight *inflight);
  int vhost_dev_get_inflight(struct vhost_dev *dev, uint16_t queue_size,
                             struct vhost_inflight *inflight);
+int vhost_set_start(struct vhost_dev *dev, bool started);


Any reason for exporting this? It looks to me there's no real user out this file.

Thanks


  #endif




reply via email to

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