sr: use bdev_check_media_change
[linux-2.6-microblaze.git] / include / linux / vdpa.h
index 5c530a6..eae0bfd 100644 (file)
@@ -27,6 +27,14 @@ struct vdpa_notification_area {
        resource_size_t size;
 };
 
+/**
+ * vDPA vq_state definition
+ * @avail_index: available index
+ */
+struct vdpa_vq_state {
+       u16     avail_index;
+};
+
 /**
  * vDPA device - representation of a vDPA device
  * @dev: underlying device
@@ -41,6 +49,7 @@ struct vdpa_device {
        const struct vdpa_config_ops *config;
        unsigned int index;
        bool features_valid;
+       int nvqs;
 };
 
 /**
@@ -79,12 +88,12 @@ struct vdpa_device {
  * @set_vq_state:              Set the state for a virtqueue
  *                             @vdev: vdpa device
  *                             @idx: virtqueue index
- *                             @state: virtqueue state (last_avail_idx)
+ *                             @state: pointer to set virtqueue state (last_avail_idx)
  *                             Returns integer: success (0) or error (< 0)
  * @get_vq_state:              Get the state for a virtqueue
  *                             @vdev: vdpa device
  *                             @idx: virtqueue index
- *                             Returns virtqueue state (last_avail_idx)
+ *                             @state: pointer to returned state (last_avail_idx)
  * @get_vq_notification:       Get the notification area for a virtqueue
  *                             @vdev: vdpa device
  *                             @idx: virtqueue index
@@ -182,10 +191,13 @@ struct vdpa_config_ops {
                          struct vdpa_callback *cb);
        void (*set_vq_ready)(struct vdpa_device *vdev, u16 idx, bool ready);
        bool (*get_vq_ready)(struct vdpa_device *vdev, u16 idx);
-       int (*set_vq_state)(struct vdpa_device *vdev, u16 idx, u64 state);
-       u64 (*get_vq_state)(struct vdpa_device *vdev, u16 idx);
+       int (*set_vq_state)(struct vdpa_device *vdev, u16 idx,
+                           const struct vdpa_vq_state *state);
+       int (*get_vq_state)(struct vdpa_device *vdev, u16 idx,
+                           struct vdpa_vq_state *state);
        struct vdpa_notification_area
        (*get_vq_notification)(struct vdpa_device *vdev, u16 idx);
+       /* vq irq is not expected to be changed once DRIVER_OK is set */
        int (*get_vq_irq)(struct vdpa_device *vdv, u16 idx);
 
        /* Device ops */
@@ -217,11 +229,12 @@ struct vdpa_config_ops {
 
 struct vdpa_device *__vdpa_alloc_device(struct device *parent,
                                        const struct vdpa_config_ops *config,
+                                       int nvqs,
                                        size_t size);
 
-#define vdpa_alloc_device(dev_struct, member, parent, config)   \
+#define vdpa_alloc_device(dev_struct, member, parent, config, nvqs)   \
                          container_of(__vdpa_alloc_device( \
-                                      parent, config, \
+                                      parent, config, nvqs, \
                                       sizeof(dev_struct) + \
                                       BUILD_BUG_ON_ZERO(offsetof( \
                                       dev_struct, member))), \