vdpa: Add an opaque pointer for vdpa_config_ops.dma_map()
[linux-2.6-microblaze.git] / include / linux / vdpa.h
index 8cfe49d..f3014aa 100644 (file)
@@ -43,17 +43,17 @@ struct vdpa_vq_state_split {
  * @last_used_idx: used index
  */
 struct vdpa_vq_state_packed {
-        u16    last_avail_counter:1;
-        u16    last_avail_idx:15;
-        u16    last_used_counter:1;
-        u16    last_used_idx:15;
+       u16     last_avail_counter:1;
+       u16     last_avail_idx:15;
+       u16     last_used_counter:1;
+       u16     last_used_idx:15;
 };
 
 struct vdpa_vq_state {
-     union {
-          struct vdpa_vq_state_split split;
-          struct vdpa_vq_state_packed packed;
-     };
+       union {
+               struct vdpa_vq_state_split split;
+               struct vdpa_vq_state_packed packed;
+       };
 };
 
 struct vdpa_mgmt_dev;
@@ -131,7 +131,7 @@ struct vdpa_iova_range {
  *                             @vdev: vdpa device
  *                             @idx: virtqueue index
  *                             @state: pointer to returned state (last_avail_idx)
- * @get_vq_notification:       Get the notification area for a virtqueue
+ * @get_vq_notification:       Get the notification area for a virtqueue
  *                             @vdev: vdpa device
  *                             @idx: virtqueue index
  *                             Returns the notifcation area
@@ -171,6 +171,9 @@ struct vdpa_iova_range {
  * @set_status:                        Set the device status
  *                             @vdev: vdpa device
  *                             @status: virtio device status
+ * @reset:                     Reset device
+ *                             @vdev: vdpa device
+ *                             Returns integer: success (0) or error (< 0)
  * @get_config_size:           Get the size of the configuration space
  *                             @vdev: vdpa device
  *                             Returns size_t: configuration size
@@ -255,6 +258,7 @@ struct vdpa_config_ops {
        u32 (*get_vendor_id)(struct vdpa_device *vdev);
        u8 (*get_status)(struct vdpa_device *vdev);
        void (*set_status)(struct vdpa_device *vdev, u8 status);
+       int (*reset)(struct vdpa_device *vdev);
        size_t (*get_config_size)(struct vdpa_device *vdev);
        void (*get_config)(struct vdpa_device *vdev, unsigned int offset,
                           void *buf, unsigned int len);
@@ -266,7 +270,7 @@ struct vdpa_config_ops {
        /* DMA ops */
        int (*set_map)(struct vdpa_device *vdev, struct vhost_iotlb *iotlb);
        int (*dma_map)(struct vdpa_device *vdev, u64 iova, u64 size,
-                      u64 pa, u32 perm);
+                      u64 pa, u32 perm, void *opaque);
        int (*dma_unmap)(struct vdpa_device *vdev, u64 iova, u64 size);
 
        /* Free device resources */
@@ -348,27 +352,27 @@ static inline struct device *vdpa_get_dma_dev(struct vdpa_device *vdev)
        return vdev->dma_dev;
 }
 
-static inline void vdpa_reset(struct vdpa_device *vdev)
+static inline int vdpa_reset(struct vdpa_device *vdev)
 {
-        const struct vdpa_config_ops *ops = vdev->config;
+       const struct vdpa_config_ops *ops = vdev->config;
 
        vdev->features_valid = false;
-        ops->set_status(vdev, 0);
+       return ops->reset(vdev);
 }
 
 static inline int vdpa_set_features(struct vdpa_device *vdev, u64 features)
 {
-        const struct vdpa_config_ops *ops = vdev->config;
+       const struct vdpa_config_ops *ops = vdev->config;
 
        vdev->features_valid = true;
-        return ops->set_features(vdev, features);
+       return ops->set_features(vdev, features);
 }
 
-
-static inline void vdpa_get_config(struct vdpa_device *vdev, unsigned offset,
-                                  void *buf, unsigned int len)
+static inline void vdpa_get_config(struct vdpa_device *vdev,
+                                  unsigned int offset, void *buf,
+                                  unsigned int len)
 {
-        const struct vdpa_config_ops *ops = vdev->config;
+       const struct vdpa_config_ops *ops = vdev->config;
 
        /*
         * Config accesses aren't supposed to trigger before features are set.