vdpa: introduce get_vq_dma_device()
authorJason Wang <jasowang@redhat.com>
Thu, 19 Jan 2023 06:15:22 +0000 (14:15 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 21 Feb 2023 00:26:58 +0000 (19:26 -0500)
This patch introduces a new method to query the dma device that is use
for a specific virtqueue.

Reviewed-by: Eli Cohen <elic@nvidia.com>
Tested-by: Eli Cohen <elic@nvidia.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20230119061525.75068-3-jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
include/linux/vdpa.h

index 96d308cbf97bd5fcb794f16cd4ec2d7bec1825dd..43f59ef10cc9d5b692e5f97ad5f1022db9cdcd09 100644 (file)
@@ -285,6 +285,11 @@ struct vdpa_map_file {
  *                             @iova: iova to be unmapped
  *                             @size: size of the area
  *                             Returns integer: success (0) or error (< 0)
+ * @get_vq_dma_dev:            Get the dma device for a specific
+ *                             virtqueue (optional)
+ *                             @vdev: vdpa device
+ *                             @idx: virtqueue index
+ *                             Returns pointer to structure device or error (NULL)
  * @free:                      Free resources that belongs to vDPA (optional)
  *                             @vdev: vdpa device
  */
@@ -345,6 +350,7 @@ struct vdpa_config_ops {
                         u64 iova, u64 size);
        int (*set_group_asid)(struct vdpa_device *vdev, unsigned int group,
                              unsigned int asid);
+       struct device *(*get_vq_dma_dev)(struct vdpa_device *vdev, u16 idx);
 
        /* Free device resources */
        void (*free)(struct vdpa_device *vdev);