Merge branch 'akpm' (patches from Andrew)
[linux-2.6-microblaze.git] / include / linux / vringh.h
index 9e2763d..84db7b8 100644 (file)
@@ -46,6 +46,9 @@ struct vringh {
        /* IOTLB for this vring */
        struct vhost_iotlb *iotlb;
 
+       /* spinlock to synchronize IOTLB accesses */
+       spinlock_t *iotlb_lock;
+
        /* The function to call to notify the guest about added buffers */
        void (*notify)(struct vringh *);
 };
@@ -105,9 +108,9 @@ struct vringh_kiov {
 /* Helpers for userspace vrings. */
 int vringh_init_user(struct vringh *vrh, u64 features,
                     unsigned int num, bool weak_barriers,
-                    struct vring_desc __user *desc,
-                    struct vring_avail __user *avail,
-                    struct vring_used __user *used);
+                    vring_desc_t __user *desc,
+                    vring_avail_t __user *avail,
+                    vring_used_t __user *used);
 
 static inline void vringh_iov_init(struct vringh_iov *iov,
                                   struct iovec *iovec, unsigned num)
@@ -196,6 +199,19 @@ static inline void vringh_kiov_cleanup(struct vringh_kiov *kiov)
        kiov->iov = NULL;
 }
 
+static inline size_t vringh_kiov_length(struct vringh_kiov *kiov)
+{
+       size_t len = 0;
+       int i;
+
+       for (i = kiov->i; i < kiov->used; i++)
+               len += kiov->iov[i].iov_len;
+
+       return len;
+}
+
+void vringh_kiov_advance(struct vringh_kiov *kiov, size_t len);
+
 int vringh_getdesc_kern(struct vringh *vrh,
                        struct vringh_kiov *riov,
                        struct vringh_kiov *wiov,
@@ -258,7 +274,8 @@ static inline __virtio64 cpu_to_vringh64(const struct vringh *vrh, u64 val)
 
 #if IS_REACHABLE(CONFIG_VHOST_IOTLB)
 
-void vringh_set_iotlb(struct vringh *vrh, struct vhost_iotlb *iotlb);
+void vringh_set_iotlb(struct vringh *vrh, struct vhost_iotlb *iotlb,
+                     spinlock_t *iotlb_lock);
 
 int vringh_init_iotlb(struct vringh *vrh, u64 features,
                      unsigned int num, bool weak_barriers,