aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/xen
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@citrix.com>2014-12-02 11:13:26 -0500
committerDavid Vrabel <david.vrabel@citrix.com>2016-01-07 08:21:53 -0500
commita4cdb556cae05cd3e7b602b3a44c01420c4e2258 (patch)
treef21957dcd64da3d2be1a0891b523b8ff46e58d1d /include/uapi/xen
parent6a1f513776b78c994045287073e55bae44ed9f8c (diff)
xen/gntdev: add ioctl for grant copy
Add IOCTL_GNTDEV_GRANT_COPY to allow applications to copy between user space buffers and grant references. This interface is similar to the GNTTABOP_copy hypercall ABI except the local buffers are provided using a virtual address (instead of a GFN and offset). To avoid userspace from having to page align its buffers the driver will use two or more ops if required. If the ioctl returns 0, the application must check the status of each segment with the segments status field. If the ioctl returns a -ve error code (EINVAL or EFAULT), the status of individual ops is undefined. Signed-off-by: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Diffstat (limited to 'include/uapi/xen')
-rw-r--r--include/uapi/xen/gntdev.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/include/uapi/xen/gntdev.h b/include/uapi/xen/gntdev.h
index aa7610a9b867..d0661977667e 100644
--- a/include/uapi/xen/gntdev.h
+++ b/include/uapi/xen/gntdev.h
@@ -144,6 +144,56 @@ struct ioctl_gntdev_unmap_notify {
144 __u32 event_channel_port; 144 __u32 event_channel_port;
145}; 145};
146 146
147struct gntdev_grant_copy_segment {
148 union {
149 void __user *virt;
150 struct {
151 grant_ref_t ref;
152 __u16 offset;
153 domid_t domid;
154 } foreign;
155 } source, dest;
156 __u16 len;
157
158 __u16 flags; /* GNTCOPY_* */
159 __s16 status; /* GNTST_* */
160};
161
162/*
163 * Copy between grant references and local buffers.
164 *
165 * The copy is split into @count @segments, each of which can copy
166 * to/from one grant reference.
167 *
168 * Each segment is similar to struct gnttab_copy in the hypervisor ABI
169 * except the local buffer is specified using a virtual address
170 * (instead of a GFN and offset).
171 *
172 * The local buffer may cross a Xen page boundary -- the driver will
173 * split segments into multiple ops if required.
174 *
175 * Returns 0 if all segments have been processed and @status in each
176 * segment is valid. Note that one or more segments may have failed
177 * (status != GNTST_okay).
178 *
179 * If the driver had to split a segment into two or more ops, @status
180 * includes the status of the first failed op for that segment (or
181 * GNTST_okay if all ops were successful).
182 *
183 * If -1 is returned, the status of all segments is undefined.
184 *
185 * EINVAL: A segment has local buffers for both source and
186 * destination.
187 * EINVAL: A segment crosses the boundary of a foreign page.
188 * EFAULT: A segment's local buffer is not accessible.
189 */
190#define IOCTL_GNTDEV_GRANT_COPY \
191 _IOC(_IOC_NONE, 'G', 8, sizeof(struct ioctl_gntdev_grant_copy))
192struct ioctl_gntdev_grant_copy {
193 unsigned int count;
194 struct gntdev_grant_copy_segment __user *segments;
195};
196
147/* Clear (set to zero) the byte specified by index */ 197/* Clear (set to zero) the byte specified by index */
148#define UNMAP_NOTIFY_CLEAR_BYTE 0x1 198#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
149/* Send an interrupt on the indicated event channel */ 199/* Send an interrupt on the indicated event channel */