History

Merge tag 'for-linus-4.19-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen updates from Juergen Gross: - add dma-buf functionality to Xen grant table handling - fix for booting the kernel as Xen PVH dom0 - fix for booting the kernel as a Xen PV guest with CONFIG_DEBUG_VIRTUAL enabled - other minor performance and style fixes * tag 'for-linus-4.19-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/balloon: fix balloon initialization for PVH Dom0 xen: don't use privcmd_call() from xen_mc_flush() xen/pv: Call get_cpu_address_sizes to set x86_virt/phys_bits xen/biomerge: Use true and false for boolean values xen/gntdev: don't dereference a null gntdev_dmabuf on allocation failure xen/spinlock: Don't use pvqspinlock if only 1 vCPU xen/gntdev: Implement dma-buf import functionality xen/gntdev: Implement dma-buf export functionality xen/gntdev: Add initial support for dma-buf UAPI xen/gntdev: Make private routines/structures accessible xen/gntdev: Allow mappings for DMA buffers xen/grant-table: Allow allocating buffers suitable for DMA xen/balloon: Share common memory reservation routines xen/grant-table: Make set/clear page private code shared

Linus Torvalds committed 8 years ago

Commit 31130a12 parents 1202f4f 359692420 files · +1634 −171Browse files

Showing the changes to include/uapi (1 of 20 files). Show all

Unified · Split

include/uapi/xen/gntdev.h+106−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
5 * Interface to /dev/xen/gntdev.5 * Interface to /dev/xen/gntdev.
6 * 6 *
7 * Copyright (c) 2007, D G Murray7 * Copyright (c) 2007, D G Murray
8 * Copyright (c) 2018, Oleksandr Andrushchenko, EPAM Systems Inc.
8 * 9 *
9 * This program is free software; you can redistribute it and/or10 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version 211 * modify it under the terms of the GNU General Public License version 2
@@ -200,4 +201,109 @@ struct ioctl_gntdev_grant_copy { · 189 unmodified lines
200/* Send an interrupt on the indicated event channel */201/* Send an interrupt on the indicated event channel */
201#define UNMAP_NOTIFY_SEND_EVENT 0x2202#define UNMAP_NOTIFY_SEND_EVENT 0x2
202 203
204/*
205 * Flags to be used while requesting memory mapping's backing storage
206 * to be allocated with DMA API.
207 */
208
209/*
210 * The buffer is backed with memory allocated with dma_alloc_wc.
211 */
212#define GNTDEV_DMA_FLAG_WC (1 << 0)
213
214/*
215 * The buffer is backed with memory allocated with dma_alloc_coherent.
216 */
217#define GNTDEV_DMA_FLAG_COHERENT (1 << 1)
218
219/*
220 * Create a dma-buf [1] from grant references @refs of count @count provided
221 * by the foreign domain @domid with flags @flags.
222 *
223 * By default dma-buf is backed by system memory pages, but by providing
224 * one of the GNTDEV_DMA_FLAG_XXX flags it can also be created as
225 * a DMA write-combine or coherent buffer, e.g. allocated with dma_alloc_wc/
226 * dma_alloc_coherent.
227 *
228 * Returns 0 if dma-buf was successfully created and the corresponding
229 * dma-buf's file descriptor is returned in @fd.
230 *
231 * [1] Documentation/driver-api/dma-buf.rst
232 */
233
234#define IOCTL_GNTDEV_DMABUF_EXP_FROM_REFS \
235 _IOC(_IOC_NONE, 'G', 9, \
236 sizeof(struct ioctl_gntdev_dmabuf_exp_from_refs))
237struct ioctl_gntdev_dmabuf_exp_from_refs {
238 /* IN parameters. */
239 /* Specific options for this dma-buf: see GNTDEV_DMA_FLAG_XXX. */
240 __u32 flags;
241 /* Number of grant references in @refs array. */
242 __u32 count;
243 /* OUT parameters. */
244 /* File descriptor of the dma-buf. */
245 __u32 fd;
246 /* The domain ID of the grant references to be mapped. */
247 __u32 domid;
248 /* Variable IN parameter. */
249 /* Array of grant references of size @count. */
250 __u32 refs[1];
251};
252
253/*
254 * This will block until the dma-buf with the file descriptor @fd is
255 * released. This is only valid for buffers created with
256 * IOCTL_GNTDEV_DMABUF_EXP_FROM_REFS.
257 *
258 * If within @wait_to_ms milliseconds the buffer is not released
259 * then -ETIMEDOUT error is returned.
260 * If the buffer with the file descriptor @fd does not exist or has already
261 * been released, then -ENOENT is returned. For valid file descriptors
262 * this must not be treated as error.
263 */
264#define IOCTL_GNTDEV_DMABUF_EXP_WAIT_RELEASED \
265 _IOC(_IOC_NONE, 'G', 10, \
266 sizeof(struct ioctl_gntdev_dmabuf_exp_wait_released))
267struct ioctl_gntdev_dmabuf_exp_wait_released {
268 /* IN parameters */
269 __u32 fd;
270 __u32 wait_to_ms;
271};
272
273/*
274 * Import a dma-buf with file descriptor @fd and export granted references
275 * to the pages of that dma-buf into array @refs of size @count.
276 */
277#define IOCTL_GNTDEV_DMABUF_IMP_TO_REFS \
278 _IOC(_IOC_NONE, 'G', 11, \
279 sizeof(struct ioctl_gntdev_dmabuf_imp_to_refs))
280struct ioctl_gntdev_dmabuf_imp_to_refs {
281 /* IN parameters. */
282 /* File descriptor of the dma-buf. */
283 __u32 fd;
284 /* Number of grant references in @refs array. */
285 __u32 count;
286 /* The domain ID for which references to be granted. */
287 __u32 domid;
288 /* Reserved - must be zero. */
289 __u32 reserved;
290 /* OUT parameters. */
291 /* Array of grant references of size @count. */
292 __u32 refs[1];
293};
294
295/*
296 * This will close all references to the imported buffer with file descriptor
297 * @fd, so it can be released by the owner. This is only valid for buffers
298 * created with IOCTL_GNTDEV_DMABUF_IMP_TO_REFS.
299 */
300#define IOCTL_GNTDEV_DMABUF_IMP_RELEASE \
301 _IOC(_IOC_NONE, 'G', 12, \
302 sizeof(struct ioctl_gntdev_dmabuf_imp_release))
303struct ioctl_gntdev_dmabuf_imp_release {
304 /* IN parameters */
305 __u32 fd;
306 __u32 reserved;
307};
308
203#endif /* __LINUX_PUBLIC_GNTDEV_H__ */309#endif /* __LINUX_PUBLIC_GNTDEV_H__ */