Back to home page

OSCL-LXR

 
 

    


0001 /******************************************************************************
0002  * gntalloc.h
0003  *
0004  * Interface to /dev/xen/gntalloc.
0005  *
0006  * Author: Daniel De Graaf <dgdegra@tycho.nsa.gov>
0007  *
0008  * This file is in the public domain.
0009  */
0010 
0011 #ifndef __LINUX_PUBLIC_GNTALLOC_H__
0012 #define __LINUX_PUBLIC_GNTALLOC_H__
0013 
0014 #include <linux/types.h>
0015 
0016 /*
0017  * Allocates a new page and creates a new grant reference.
0018  */
0019 #define IOCTL_GNTALLOC_ALLOC_GREF \
0020 _IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))
0021 struct ioctl_gntalloc_alloc_gref {
0022     /* IN parameters */
0023     /* The ID of the domain to be given access to the grants. */
0024     __u16 domid;
0025     /* Flags for this mapping */
0026     __u16 flags;
0027     /* Number of pages to map */
0028     __u32 count;
0029     /* OUT parameters */
0030     /* The offset to be used on a subsequent call to mmap(). */
0031     __u64 index;
0032     /* The grant references of the newly created grant, one per page */
0033     /* Variable size, depending on count */
0034     __u32 gref_ids[1];
0035 };
0036 
0037 #define GNTALLOC_FLAG_WRITABLE 1
0038 
0039 /*
0040  * Deallocates the grant reference, allowing the associated page to be freed if
0041  * no other domains are using it.
0042  */
0043 #define IOCTL_GNTALLOC_DEALLOC_GREF \
0044 _IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
0045 struct ioctl_gntalloc_dealloc_gref {
0046     /* IN parameters */
0047     /* The offset returned in the map operation */
0048     __u64 index;
0049     /* Number of references to unmap */
0050     __u32 count;
0051 };
0052 
0053 /*
0054  * Sets up an unmap notification within the page, so that the other side can do
0055  * cleanup if this side crashes. Required to implement cross-domain robust
0056  * mutexes or close notification on communication channels.
0057  *
0058  * Each mapped page only supports one notification; multiple calls referring to
0059  * the same page overwrite the previous notification. You must clear the
0060  * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
0061  * to occur.
0062  */
0063 #define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \
0064 _IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify))
0065 struct ioctl_gntalloc_unmap_notify {
0066     /* IN parameters */
0067     /* Offset in the file descriptor for a byte within the page (same as
0068      * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to
0069      * be cleared. Otherwise, it can be any byte in the page whose
0070      * notification we are adjusting.
0071      */
0072     __u64 index;
0073     /* Action(s) to take on unmap */
0074     __u32 action;
0075     /* Event channel to notify */
0076     __u32 event_channel_port;
0077 };
0078 
0079 /* Clear (set to zero) the byte specified by index */
0080 #define UNMAP_NOTIFY_CLEAR_BYTE 0x1
0081 /* Send an interrupt on the indicated event channel */
0082 #define UNMAP_NOTIFY_SEND_EVENT 0x2
0083 
0084 #endif /* __LINUX_PUBLIC_GNTALLOC_H__ */