/******************************************************************************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#include <linux/types.h>1415/*16* Allocates a new page and creates a new grant reference.17*/18#define IOCTL_GNTALLOC_ALLOC_GREF \19_IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))20struct ioctl_gntalloc_alloc_gref {21/* IN parameters */22/* The ID of the domain to be given access to the grants. */23__u16 domid;24/* Flags for this mapping */25__u16 flags;26/* Number of pages to map */27__u32 count;28/* OUT parameters */29/* The offset to be used on a subsequent call to mmap(). */30__u64 index;31/* The grant references of the newly created grant, one per page */32/* Variable size, depending on count */33union {34__u32 gref_ids[1];35__DECLARE_FLEX_ARRAY(__u32, gref_ids_flex);36};37};3839#define GNTALLOC_FLAG_WRITABLE 14041/*42* Deallocates the grant reference, allowing the associated page to be freed if43* no other domains are using it.44*/45#define IOCTL_GNTALLOC_DEALLOC_GREF \46_IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))47struct ioctl_gntalloc_dealloc_gref {48/* IN parameters */49/* The offset returned in the map operation */50__u64 index;51/* Number of references to unmap */52__u32 count;53};5455/*56* Sets up an unmap notification within the page, so that the other side can do57* cleanup if this side crashes. Required to implement cross-domain robust58* mutexes or close notification on communication channels.59*60* Each mapped page only supports one notification; multiple calls referring to61* the same page overwrite the previous notification. You must clear the62* notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it63* to occur.64*/65#define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \66_IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify))67struct ioctl_gntalloc_unmap_notify {68/* IN parameters */69/* Offset in the file descriptor for a byte within the page (same as70* used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to71* be cleared. Otherwise, it can be any byte in the page whose72* notification we are adjusting.73*/74__u64 index;75/* Action(s) to take on unmap */76__u32 action;77/* Event channel to notify */78__u32 event_channel_port;79};8081/* Clear (set to zero) the byte specified by index */82#define UNMAP_NOTIFY_CLEAR_BYTE 0x183/* Send an interrupt on the indicated event channel */84#define UNMAP_NOTIFY_SEND_EVENT 0x28586#endif /* __LINUX_PUBLIC_GNTALLOC_H__ */878889