| 1 | |
| 2 | * gntalloc.h
|
| 3 | *
|
| 4 | * Interface to /dev/xen/gntalloc.
|
| 5 | *
|
| 6 | * Author: Daniel De Graaf <[email protected]>
|
| 7 | *
|
| 8 | * This file is in the public domain.
|
| 9 |
|
| 10 |
|
| 11 | #ifndef __LINUX_PUBLIC_GNTALLOC_H__
|
| 12 | #define __LINUX_PUBLIC_GNTALLOC_H__
|
| 13 |
|
| 14 | #include <linux/types.h>
|
| 15 |
|
| 16 | |
| 17 | * Allocates a new page and creates a new grant reference.
|
| 18 |
|
| 19 | #define IOCTL_GNTALLOC_ALLOC_GREF \
|
| 20 | _IOC(_IOC_NONE, 'G', 5, sizeof(struct ioctl_gntalloc_alloc_gref))
|
| 21 | struct ioctl_gntalloc_alloc_gref {
|
| 22 |
|
| 23 |
|
| 24 | __u16 domid;
|
| 25 |
|
| 26 | __u16 flags;
|
| 27 |
|
| 28 | __u32 count;
|
| 29 |
|
| 30 |
|
| 31 | __u64 index;
|
| 32 |
|
| 33 |
|
| 34 | union {
|
| 35 | __u32 gref_ids[1];
|
| 36 | __DECLARE_FLEX_ARRAY(__u32, gref_ids_flex);
|
| 37 | };
|
| 38 | };
|
| 39 |
|
| 40 | #define GNTALLOC_FLAG_WRITABLE 1
|
| 41 |
|
| 42 | |
| 43 | * Deallocates the grant reference, allowing the associated page to be freed if
|
| 44 | * no other domains are using it.
|
| 45 |
|
| 46 | #define IOCTL_GNTALLOC_DEALLOC_GREF \
|
| 47 | _IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
|
| 48 | struct ioctl_gntalloc_dealloc_gref {
|
| 49 |
|
| 50 |
|
| 51 | __u64 index;
|
| 52 |
|
| 53 | __u32 count;
|
| 54 | };
|
| 55 |
|
| 56 | |
| 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.
|
| 60 | *
|
| 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
|
| 64 | * to occur.
|
| 65 |
|
| 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 {
|
| 69 |
|
| 70 | |
| 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.
|
| 74 |
|
| 75 | __u64 index;
|
| 76 |
|
| 77 | __u32 action;
|
| 78 |
|
| 79 | __u32 event_channel_port;
|
| 80 | };
|
| 81 |
|
| 82 |
|
| 83 | #define UNMAP_NOTIFY_CLEAR_BYTE 0x1
|
| 84 |
|
| 85 | #define UNMAP_NOTIFY_SEND_EVENT 0x2
|
| 86 |
|
| 87 | #endif
|