2 * This file is copied from the linux kernel headers. It defines the standard
3 * interface to the xen/gntalloc device.
7 /******************************************************************************
10 * Interface to /dev/xen/gntalloc.
12 * Author: Daniel De Graaf <dgdegra@tycho.nsa.gov>
14 * This file is in the public domain.
17 #ifndef __LINUX_PUBLIC_GNTALLOC_H__
18 #define __LINUX_PUBLIC_GNTALLOC_H__
21 * Allocates a new page and creates a new grant reference.
23 #define IOCTL_GNTALLOC_ALLOC_GREF \
24 _IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))
25 struct ioctl_gntalloc_alloc_gref
{
27 /* The ID of the domain to be given access to the grants. */
29 /* Flags for this mapping */
31 /* Number of pages to map */
34 /* The offset to be used on a subsequent call to mmap(). */
36 /* The grant references of the newly created grant, one per page */
37 /* Variable size, depending on count */
41 #define GNTALLOC_FLAG_WRITABLE 1
44 * Deallocates the grant reference, allowing the associated page to be freed if
45 * no other domains are using it.
47 #define IOCTL_GNTALLOC_DEALLOC_GREF \
48 _IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
49 struct ioctl_gntalloc_dealloc_gref
{
51 /* The offset returned in the map operation */
53 /* Number of references to unmap */
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.
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
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
{
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.
77 /* Action(s) to take on unmap */
79 /* Event channel to notify */
80 uint32_t event_channel_port
;
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
88 #endif /* __LINUX_PUBLIC_GNTALLOC_H__ */