在 2021/5/20 上午12:28, Eugenio Pérez 写道:
This operation enable the backend-specific IOTLB entries.

If a backend support this, it start managing its own entries, and vhost
can disable it through this operation and recover control.

Every enable/disable operation must also clear all IOTLB device entries.

At the moment, the only backend that does so is vhost-vdpa. To fully
support these, vdpa needs also to expose a way for vhost subsystem to
map and unmap entries. This will be done in future commits.

Signed-off-by: Eugenio Pérez <epere...@redhat.com>


I think there's probably no need to introduce this helper.

Instead, we can introduce ops like shadow_vq_start()/stop(). Then the details like this could be hided there.

(And hide the backend deatils (avoid calling vhost_vdpa_dma_map()) directly from the vhost.c)

Thanks


---
  include/hw/virtio/vhost-backend.h | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/include/hw/virtio/vhost-backend.h 
b/include/hw/virtio/vhost-backend.h
index bcb112c166..f8eed2ace5 100644
--- a/include/hw/virtio/vhost-backend.h
+++ b/include/hw/virtio/vhost-backend.h
@@ -128,6 +128,9 @@ typedef bool (*vhost_force_iommu_op)(struct vhost_dev *dev);
typedef int (*vhost_vring_pause_op)(struct vhost_dev *dev); +typedef int (*vhost_enable_custom_iommu_op)(struct vhost_dev *dev,
+                                            bool enable);
+
  typedef int (*vhost_get_iova_range)(struct vhost_dev *dev,
                                      hwaddr *first, hwaddr *last);
@@ -177,6 +180,7 @@ typedef struct VhostOps {
      vhost_get_device_id_op vhost_get_device_id;
      vhost_vring_pause_op vhost_vring_pause;
      vhost_force_iommu_op vhost_force_iommu;
+    vhost_enable_custom_iommu_op vhost_enable_custom_iommu;
      vhost_get_iova_range vhost_get_iova_range;
  } VhostOps;


Reply via email to