]> code.delx.au - pulseaudio/blob - src/modules/xen/gntalloc.h
xen: Add Xen paravirtualized sink support.
[pulseaudio] / src / modules / xen / gntalloc.h
1 /*
2 * This file is copied from the linux kernel headers. It defines the standard
3 * interface to the xen/gntalloc device.
4 *
5 */
6
7 /******************************************************************************
8 * gntalloc.h
9 *
10 * Interface to /dev/xen/gntalloc.
11 *
12 * Author: Daniel De Graaf <dgdegra@tycho.nsa.gov>
13 *
14 * This file is in the public domain.
15 */
16
17 #ifndef __LINUX_PUBLIC_GNTALLOC_H__
18 #define __LINUX_PUBLIC_GNTALLOC_H__
19
20 /*
21 * Allocates a new page and creates a new grant reference.
22 */
23 #define IOCTL_GNTALLOC_ALLOC_GREF \
24 _IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))
25 struct ioctl_gntalloc_alloc_gref {
26 /* IN parameters */
27 /* The ID of the domain to be given access to the grants. */
28 uint16_t domid;
29 /* Flags for this mapping */
30 uint16_t flags;
31 /* Number of pages to map */
32 uint32_t count;
33 /* OUT parameters */
34 /* The offset to be used on a subsequent call to mmap(). */
35 uint64_t index;
36 /* The grant references of the newly created grant, one per page */
37 /* Variable size, depending on count */
38 uint32_t gref_ids[1];
39 };
40
41 #define GNTALLOC_FLAG_WRITABLE 1
42
43 /*
44 * Deallocates the grant reference, allowing the associated page to be freed if
45 * no other domains are using it.
46 */
47 #define IOCTL_GNTALLOC_DEALLOC_GREF \
48 _IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
49 struct ioctl_gntalloc_dealloc_gref {
50 /* IN parameters */
51 /* The offset returned in the map operation */
52 uint64_t index;
53 /* Number of references to unmap */
54 uint32_t count;
55 };
56
57 /*
58 * Sets up an unmap notification within the page, so that the other side can do
59 * cleanup if this side crashes. Required to implement cross-domain robust
60 * mutexes or close notification on communication channels.
61 *
62 * Each mapped page only supports one notification; multiple calls referring to
63 * the same page overwrite the previous notification. You must clear the
64 * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
65 * to occur.
66 */
67 #define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \
68 _IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify))
69 struct ioctl_gntalloc_unmap_notify {
70 /* IN parameters */
71 /* Offset in the file descriptor for a byte within the page (same as
72 * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to
73 * be cleared. Otherwise, it can be any byte in the page whose
74 * notification we are adjusting.
75 */
76 uint64_t index;
77 /* Action(s) to take on unmap */
78 uint32_t action;
79 /* Event channel to notify */
80 uint32_t event_channel_port;
81 };
82
83 /* Clear (set to zero) the byte specified by index */
84 #define UNMAP_NOTIFY_CLEAR_BYTE 0x1
85 /* Send an interrupt on the indicated event channel */
86 #define UNMAP_NOTIFY_SEND_EVENT 0x2
87
88 #endif /* __LINUX_PUBLIC_GNTALLOC_H__ */