/******************************************************************************1* gntalloc.h2*3* Interface to /dev/xen/gntalloc.4*5* Author: Daniel De Graaf <[email protected]>6*7* This file is in the public domain.8*/910#ifndef __LINUX_PUBLIC_GNTALLOC_H__11#define __LINUX_PUBLIC_GNTALLOC_H__1213/*14* Allocates a new page and creates a new grant reference.15*/16#define IOCTL_GNTALLOC_ALLOC_GREF \17_IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))18struct ioctl_gntalloc_alloc_gref {19/* IN parameters */20/* The ID of the domain to be given access to the grants. */21uint16_t domid;22/* Flags for this mapping */23uint16_t flags;24/* Number of pages to map */25uint32_t count;26/* OUT parameters */27/* The offset to be used on a subsequent call to mmap(). */28uint64_t index;29/* The grant references of the newly created grant, one per page */30/* Variable size, depending on count */31uint32_t gref_ids[1];32};3334#define GNTALLOC_FLAG_WRITABLE 13536/*37* Deallocates the grant reference, allowing the associated page to be freed if38* no other domains are using it.39*/40#define IOCTL_GNTALLOC_DEALLOC_GREF \41_IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))42struct ioctl_gntalloc_dealloc_gref {43/* IN parameters */44/* The offset returned in the map operation */45uint64_t index;46/* Number of references to unmap */47uint32_t count;48};4950/*51* Sets up an unmap notification within the page, so that the other side can do52* cleanup if this side crashes. Required to implement cross-domain robust53* mutexes or close notification on communication channels.54*55* Each mapped page only supports one notification; multiple calls referring to56* the same page overwrite the previous notification. You must clear the57* notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it58* to occur.59*/60#define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \61_IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify))62struct ioctl_gntalloc_unmap_notify {63/* IN parameters */64/* Offset in the file descriptor for a byte within the page (same as65* used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to66* be cleared. Otherwise, it can be any byte in the page whose67* notification we are adjusting.68*/69uint64_t index;70/* Action(s) to take on unmap */71uint32_t action;72/* Event channel to notify */73uint32_t event_channel_port;74};7576/* Clear (set to zero) the byte specified by index */77#define UNMAP_NOTIFY_CLEAR_BYTE 0x178/* Send an interrupt on the indicated event channel */79#define UNMAP_NOTIFY_SEND_EVENT 0x28081#endif /* __LINUX_PUBLIC_GNTALLOC_H__ */828384