1 /******************************************************************************
4 * Interface to /dev/xen/gntalloc.
6 * Author: Daniel De Graaf <dgdegra@tycho.nsa.gov>
8 * This file is in the public domain.
11 #ifndef __LINUX_PUBLIC_GNTALLOC_H__
12 #define __LINUX_PUBLIC_GNTALLOC_H__
14 #include <linux/types.h>
17 * Allocates a new page and creates a new grant reference.
19 #define IOCTL_GNTALLOC_ALLOC_GREF \
20 _IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))
21 struct ioctl_gntalloc_alloc_gref
{
23 /* The ID of the domain to be given access to the grants. */
25 /* Flags for this mapping */
27 /* Number of pages to map */
30 /* The offset to be used on a subsequent call to mmap(). */
32 /* The grant references of the newly created grant, one per page */
33 /* Variable size, depending on count */
36 __DECLARE_FLEX_ARRAY(__u32
, gref_ids_flex
);
40 #define GNTALLOC_FLAG_WRITABLE 1
43 * Deallocates the grant reference, allowing the associated page to be freed if
44 * no other domains are using it.
46 #define IOCTL_GNTALLOC_DEALLOC_GREF \
47 _IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
48 struct ioctl_gntalloc_dealloc_gref
{
50 /* The offset returned in the map operation */
52 /* Number of references to unmap */
57 * Sets up an unmap notification within the page, so that the other side can do
58 * cleanup if this side crashes. Required to implement cross-domain robust
59 * mutexes or close notification on communication channels.
61 * Each mapped page only supports one notification; multiple calls referring to
62 * the same page overwrite the previous notification. You must clear the
63 * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
66 #define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \
67 _IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify))
68 struct ioctl_gntalloc_unmap_notify
{
70 /* Offset in the file descriptor for a byte within the page (same as
71 * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to
72 * be cleared. Otherwise, it can be any byte in the page whose
73 * notification we are adjusting.
76 /* Action(s) to take on unmap */
78 /* Event channel to notify */
79 __u32 event_channel_port
;
82 /* Clear (set to zero) the byte specified by index */
83 #define UNMAP_NOTIFY_CLEAR_BYTE 0x1
84 /* Send an interrupt on the indicated event channel */
85 #define UNMAP_NOTIFY_SEND_EVENT 0x2
87 #endif /* __LINUX_PUBLIC_GNTALLOC_H__ */