logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

gntalloc.h (2679B)


  1. /******************************************************************************
  2. * gntalloc.h
  3. *
  4. * Interface to /dev/xen/gntalloc.
  5. *
  6. * Author: Daniel De Graaf <dgdegra@tycho.nsa.gov>
  7. *
  8. * This file is in the public domain.
  9. */
  10. #ifndef __LINUX_PUBLIC_GNTALLOC_H__
  11. #define __LINUX_PUBLIC_GNTALLOC_H__
  12. #include <linux/types.h>
  13. /*
  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))
  18. struct ioctl_gntalloc_alloc_gref {
  19. /* IN parameters */
  20. /* The ID of the domain to be given access to the grants. */
  21. __u16 domid;
  22. /* Flags for this mapping */
  23. __u16 flags;
  24. /* Number of pages to map */
  25. __u32 count;
  26. /* OUT parameters */
  27. /* The offset to be used on a subsequent call to mmap(). */
  28. __u64 index;
  29. /* The grant references of the newly created grant, one per page */
  30. /* Variable size, depending on count */
  31. union {
  32. __u32 gref_ids[1];
  33. __DECLARE_FLEX_ARRAY(__u32, gref_ids_flex);
  34. };
  35. };
  36. #define GNTALLOC_FLAG_WRITABLE 1
  37. /*
  38. * Deallocates the grant reference, allowing the associated page to be freed if
  39. * no other domains are using it.
  40. */
  41. #define IOCTL_GNTALLOC_DEALLOC_GREF \
  42. _IOC(_IOC_NONE, 'G', 6, sizeof(struct ioctl_gntalloc_dealloc_gref))
  43. struct ioctl_gntalloc_dealloc_gref {
  44. /* IN parameters */
  45. /* The offset returned in the map operation */
  46. __u64 index;
  47. /* Number of references to unmap */
  48. __u32 count;
  49. };
  50. /*
  51. * Sets up an unmap notification within the page, so that the other side can do
  52. * cleanup if this side crashes. Required to implement cross-domain robust
  53. * mutexes or close notification on communication channels.
  54. *
  55. * Each mapped page only supports one notification; multiple calls referring to
  56. * the same page overwrite the previous notification. You must clear the
  57. * notification prior to the IOCTL_GNTALLOC_DEALLOC_GREF if you do not want it
  58. * to occur.
  59. */
  60. #define IOCTL_GNTALLOC_SET_UNMAP_NOTIFY \
  61. _IOC(_IOC_NONE, 'G', 7, sizeof(struct ioctl_gntalloc_unmap_notify))
  62. struct ioctl_gntalloc_unmap_notify {
  63. /* IN parameters */
  64. /* Offset in the file descriptor for a byte within the page (same as
  65. * used in mmap). If using UNMAP_NOTIFY_CLEAR_BYTE, this is the byte to
  66. * be cleared. Otherwise, it can be any byte in the page whose
  67. * notification we are adjusting.
  68. */
  69. __u64 index;
  70. /* Action(s) to take on unmap */
  71. __u32 action;
  72. /* Event channel to notify */
  73. __u32 event_channel_port;
  74. };
  75. /* Clear (set to zero) the byte specified by index */
  76. #define UNMAP_NOTIFY_CLEAR_BYTE 0x1
  77. /* Send an interrupt on the indicated event channel */
  78. #define UNMAP_NOTIFY_SEND_EVENT 0x2
  79. #endif /* __LINUX_PUBLIC_GNTALLOC_H__ */