* for backwards compatibility. New guests should use version 2.\r
*/\r
#if __XEN_INTERFACE_VERSION__ < 0x0003020a\r
-#define grant_entry_v1 grant_entry\r
-#define grant_entry_v1_t grant_entry_t\r
+#define grant_entry_v1 grant_entry\r
+#define grant_entry_v1_t grant_entry_t\r
#endif\r
struct grant_entry_v1 {\r
- /* GTF_xxx: various type and flag information. [XEN,GST] */\r
- UINT16 flags;\r
- /* The domain being granted foreign privileges. [GST] */\r
- domid_t domid;\r
- /*\r
- * GTF_permit_access: Frame that @domid is allowed to map and access. [GST]\r
- * GTF_accept_transfer: Frame whose ownership transferred by @domid. [XEN]\r
- */\r
- UINT32 frame;\r
+ /* GTF_xxx: various type and flag information. [XEN,GST] */\r
+ UINT16 flags;\r
+ /* The domain being granted foreign privileges. [GST] */\r
+ domid_t domid;\r
+\r
+ /*\r
+ * GTF_permit_access: Frame that @domid is allowed to map and access. [GST]\r
+ * GTF_accept_transfer: Frame whose ownership transferred by @domid. [XEN]\r
+ */\r
+ UINT32 frame;\r
};\r
+\r
typedef struct grant_entry_v1 grant_entry_v1_t;\r
\r
/* The first few grant table entries will be preserved across grant table\r
* version changes and may be pre-populated at domain creation by tools.\r
*/\r
-#define GNTTAB_NR_RESERVED_ENTRIES 8\r
-#define GNTTAB_RESERVED_CONSOLE 0\r
-#define GNTTAB_RESERVED_XENSTORE 1\r
+#define GNTTAB_NR_RESERVED_ENTRIES 8\r
+#define GNTTAB_RESERVED_CONSOLE 0\r
+#define GNTTAB_RESERVED_XENSTORE 1\r
\r
/*\r
* Type of grant entry.\r
* GTF_transitive: Allow @domid to transitively access a subrange of\r
* @trans_grant in @trans_domid. No mappings are allowed.\r
*/\r
-#define GTF_invalid (0U<<0)\r
-#define GTF_permit_access (1U<<0)\r
-#define GTF_accept_transfer (2U<<0)\r
-#define GTF_transitive (3U<<0)\r
-#define GTF_type_mask (3U<<0)\r
+#define GTF_invalid (0U<<0)\r
+#define GTF_permit_access (1U<<0)\r
+#define GTF_accept_transfer (2U<<0)\r
+#define GTF_transitive (3U<<0)\r
+#define GTF_type_mask (3U<<0)\r
\r
/*\r
* Subflags for GTF_permit_access.\r
* will only be allowed to copy from the grant, and not\r
* map it. [GST]\r
*/\r
-#define _GTF_readonly (2)\r
-#define GTF_readonly (1U<<_GTF_readonly)\r
-#define _GTF_reading (3)\r
-#define GTF_reading (1U<<_GTF_reading)\r
-#define _GTF_writing (4)\r
-#define GTF_writing (1U<<_GTF_writing)\r
-#define _GTF_PWT (5)\r
-#define GTF_PWT (1U<<_GTF_PWT)\r
-#define _GTF_PCD (6)\r
-#define GTF_PCD (1U<<_GTF_PCD)\r
-#define _GTF_PAT (7)\r
-#define GTF_PAT (1U<<_GTF_PAT)\r
-#define _GTF_sub_page (8)\r
-#define GTF_sub_page (1U<<_GTF_sub_page)\r
+#define _GTF_readonly (2)\r
+#define GTF_readonly (1U<<_GTF_readonly)\r
+#define _GTF_reading (3)\r
+#define GTF_reading (1U<<_GTF_reading)\r
+#define _GTF_writing (4)\r
+#define GTF_writing (1U<<_GTF_writing)\r
+#define _GTF_PWT (5)\r
+#define GTF_PWT (1U<<_GTF_PWT)\r
+#define _GTF_PCD (6)\r
+#define GTF_PCD (1U<<_GTF_PCD)\r
+#define _GTF_PAT (7)\r
+#define GTF_PAT (1U<<_GTF_PAT)\r
+#define _GTF_sub_page (8)\r
+#define GTF_sub_page (1U<<_GTF_sub_page)\r
\r
/*\r
* Subflags for GTF_accept_transfer:\r
* after reading GTF_transfer_committed. Xen will always write the frame\r
* address, followed by ORing this flag, in a timely manner.\r
*/\r
-#define _GTF_transfer_committed (2)\r
-#define GTF_transfer_committed (1U<<_GTF_transfer_committed)\r
-#define _GTF_transfer_completed (3)\r
-#define GTF_transfer_completed (1U<<_GTF_transfer_completed)\r
+#define _GTF_transfer_committed (2)\r
+#define GTF_transfer_committed (1U<<_GTF_transfer_committed)\r
+#define _GTF_transfer_completed (3)\r
+#define GTF_transfer_completed (1U<<_GTF_transfer_completed)\r
\r
/*\r
* Version 2 grant table entries. These fulfil the same role as\r
* on the grant table version in use by the other domain.\r
*/\r
#if __XEN_INTERFACE_VERSION__ >= 0x0003020a\r
+\r
/*\r
* Version 1 and version 2 grant entries share a common prefix. The\r
* fields of the prefix are documented as part of struct\r
* grant_entry_v1.\r
*/\r
struct grant_entry_header {\r
- UINT16 flags;\r
- domid_t domid;\r
+ UINT16 flags;\r
+ domid_t domid;\r
};\r
+\r
typedef struct grant_entry_header grant_entry_header_t;\r
\r
/*\r
* Version 2 of the grant entry structure.\r
*/\r
union grant_entry_v2 {\r
- grant_entry_header_t hdr;\r
-\r
- /*\r
- * This member is used for V1-style full page grants, where either:\r
- *\r
- * -- hdr.type is GTF_accept_transfer, or\r
- * -- hdr.type is GTF_permit_access and GTF_sub_page is not set.\r
- *\r
- * In that case, the frame field has the same semantics as the\r
- * field of the same name in the V1 entry structure.\r
- */\r
- struct {\r
- grant_entry_header_t hdr;\r
- UINT32 pad0;\r
- UINT64 frame;\r
- } full_page;\r
-\r
- /*\r
- * If the grant type is GTF_grant_access and GTF_sub_page is set,\r
- * @domid is allowed to access bytes [@page_off,@page_off+@length)\r
- * in frame @frame.\r
- */\r
- struct {\r
- grant_entry_header_t hdr;\r
- UINT16 page_off;\r
- UINT16 length;\r
- UINT64 frame;\r
- } sub_page;\r
-\r
- /*\r
- * If the grant is GTF_transitive, @domid is allowed to use the\r
- * grant @gref in domain @trans_domid, as if it was the local\r
- * domain. Obviously, the transitive access must be compatible\r
- * with the original grant.\r
- *\r
- * The current version of Xen does not allow transitive grants\r
- * to be mapped.\r
- */\r
- struct {\r
- grant_entry_header_t hdr;\r
- domid_t trans_domid;\r
- UINT16 pad0;\r
- grant_ref_t gref;\r
- } transitive;\r
-\r
- UINT32 __spacer[4]; /* Pad to a power of two */\r
+ grant_entry_header_t hdr;\r
+\r
+ /*\r
+ * This member is used for V1-style full page grants, where either:\r
+ *\r
+ * -- hdr.type is GTF_accept_transfer, or\r
+ * -- hdr.type is GTF_permit_access and GTF_sub_page is not set.\r
+ *\r
+ * In that case, the frame field has the same semantics as the\r
+ * field of the same name in the V1 entry structure.\r
+ */\r
+ struct {\r
+ grant_entry_header_t hdr;\r
+ UINT32 pad0;\r
+ UINT64 frame;\r
+ } full_page;\r
+\r
+ /*\r
+ * If the grant type is GTF_grant_access and GTF_sub_page is set,\r
+ * @domid is allowed to access bytes [@page_off,@page_off+@length)\r
+ * in frame @frame.\r
+ */\r
+ struct {\r
+ grant_entry_header_t hdr;\r
+ UINT16 page_off;\r
+ UINT16 length;\r
+ UINT64 frame;\r
+ } sub_page;\r
+\r
+ /*\r
+ * If the grant is GTF_transitive, @domid is allowed to use the\r
+ * grant @gref in domain @trans_domid, as if it was the local\r
+ * domain. Obviously, the transitive access must be compatible\r
+ * with the original grant.\r
+ *\r
+ * The current version of Xen does not allow transitive grants\r
+ * to be mapped.\r
+ */\r
+ struct {\r
+ grant_entry_header_t hdr;\r
+ domid_t trans_domid;\r
+ UINT16 pad0;\r
+ grant_ref_t gref;\r
+ } transitive;\r
+\r
+ UINT32 __spacer[4]; /* Pad to a power of two */\r
};\r
+\r
typedef union grant_entry_v2 grant_entry_v2_t;\r
\r
typedef UINT16 grant_status_t;\r
*/\r
\r
/* ` enum grant_table_op { // GNTTABOP_* => struct gnttab_* */\r
-#define GNTTABOP_map_grant_ref 0\r
-#define GNTTABOP_unmap_grant_ref 1\r
+#define GNTTABOP_map_grant_ref 0\r
+#define GNTTABOP_unmap_grant_ref 1\r
/* ` } */\r
\r
/*\r
* to be accounted to the correct grant reference!\r
*/\r
struct gnttab_map_grant_ref {\r
- /* IN parameters. */\r
- UINT64 host_addr;\r
- UINT32 flags; /* GNTMAP_* */\r
- grant_ref_t ref;\r
- domid_t dom;\r
- /* OUT parameters. */\r
- INT16 status; /* => enum grant_status */\r
- grant_handle_t handle;\r
- UINT64 dev_bus_addr;\r
+ /* IN parameters. */\r
+ UINT64 host_addr;\r
+ UINT32 flags; /* GNTMAP_* */\r
+ grant_ref_t ref;\r
+ domid_t dom;\r
+ /* OUT parameters. */\r
+ INT16 status; /* => enum grant_status */\r
+ grant_handle_t handle;\r
+ UINT64 dev_bus_addr;\r
};\r
+\r
typedef struct gnttab_map_grant_ref gnttab_map_grant_ref_t;\r
-DEFINE_XEN_GUEST_HANDLE(gnttab_map_grant_ref_t);\r
+DEFINE_XEN_GUEST_HANDLE (gnttab_map_grant_ref_t);\r
\r
/*\r
* GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings\r
* mappings will remain in the device or host TLBs.\r
*/\r
struct gnttab_unmap_grant_ref {\r
- /* IN parameters. */\r
- UINT64 host_addr;\r
- UINT64 dev_bus_addr;\r
- grant_handle_t handle;\r
- /* OUT parameters. */\r
- INT16 status; /* => enum grant_status */\r
+ /* IN parameters. */\r
+ UINT64 host_addr;\r
+ UINT64 dev_bus_addr;\r
+ grant_handle_t handle;\r
+ /* OUT parameters. */\r
+ INT16 status; /* => enum grant_status */\r
};\r
+\r
typedef struct gnttab_unmap_grant_ref gnttab_unmap_grant_ref_t;\r
-DEFINE_XEN_GUEST_HANDLE(gnttab_unmap_grant_ref_t);\r
+DEFINE_XEN_GUEST_HANDLE (gnttab_unmap_grant_ref_t);\r
\r
/*\r
* Bitfield values for gnttab_map_grant_ref.flags.\r
*/\r
- /* Map the grant entry for access by I/O devices. */\r
-#define _GNTMAP_device_map (0)\r
-#define GNTMAP_device_map (1<<_GNTMAP_device_map)\r
- /* Map the grant entry for access by host CPUs. */\r
-#define _GNTMAP_host_map (1)\r
-#define GNTMAP_host_map (1<<_GNTMAP_host_map)\r
- /* Accesses to the granted frame will be restricted to read-only access. */\r
-#define _GNTMAP_readonly (2)\r
-#define GNTMAP_readonly (1<<_GNTMAP_readonly)\r
- /*\r
- * GNTMAP_host_map subflag:\r
- * 0 => The host mapping is usable only by the guest OS.\r
- * 1 => The host mapping is usable by guest OS + current application.\r
- */\r
-#define _GNTMAP_application_map (3)\r
-#define GNTMAP_application_map (1<<_GNTMAP_application_map)\r
-\r
- /*\r
- * GNTMAP_contains_pte subflag:\r
- * 0 => This map request contains a host virtual address.\r
- * 1 => This map request contains the machine address of the PTE to update.\r
- */\r
-#define _GNTMAP_contains_pte (4)\r
-#define GNTMAP_contains_pte (1<<_GNTMAP_contains_pte)\r
-\r
-#define _GNTMAP_can_fail (5)\r
-#define GNTMAP_can_fail (1<<_GNTMAP_can_fail)\r
+/* Map the grant entry for access by I/O devices. */\r
+#define _GNTMAP_device_map (0)\r
+#define GNTMAP_device_map (1<<_GNTMAP_device_map)\r
+/* Map the grant entry for access by host CPUs. */\r
+#define _GNTMAP_host_map (1)\r
+#define GNTMAP_host_map (1<<_GNTMAP_host_map)\r
+/* Accesses to the granted frame will be restricted to read-only access. */\r
+#define _GNTMAP_readonly (2)\r
+#define GNTMAP_readonly (1<<_GNTMAP_readonly)\r
+\r
+/*\r
+ * GNTMAP_host_map subflag:\r
+ * 0 => The host mapping is usable only by the guest OS.\r
+ * 1 => The host mapping is usable by guest OS + current application.\r
+ */\r
+#define _GNTMAP_application_map (3)\r
+#define GNTMAP_application_map (1<<_GNTMAP_application_map)\r
+\r
+/*\r
+ * GNTMAP_contains_pte subflag:\r
+ * 0 => This map request contains a host virtual address.\r
+ * 1 => This map request contains the machine address of the PTE to update.\r
+ */\r
+#define _GNTMAP_contains_pte (4)\r
+#define GNTMAP_contains_pte (1<<_GNTMAP_contains_pte)\r
+\r
+#define _GNTMAP_can_fail (5)\r
+#define GNTMAP_can_fail (1<<_GNTMAP_can_fail)\r
\r
/*\r
* Bits to be placed in guest kernel available PTE bits (architecture\r
* dependent; only supported when XENFEAT_gnttab_map_avail_bits is set).\r
*/\r
-#define _GNTMAP_guest_avail0 (16)\r
-#define GNTMAP_guest_avail_mask ((UINT32)~0 << _GNTMAP_guest_avail0)\r
+#define _GNTMAP_guest_avail0 (16)\r
+#define GNTMAP_guest_avail_mask ((UINT32)~0 << _GNTMAP_guest_avail0)\r
\r
/*\r
* Values for error status returns. All errors are -ve.\r
*/\r
/* ` enum grant_status { */\r
-#define GNTST_okay (0) /* Normal return. */\r
-#define GNTST_general_error (-1) /* General undefined error. */\r
-#define GNTST_bad_domain (-2) /* Unrecognised domain id. */\r
-#define GNTST_bad_gntref (-3) /* Unrecognised or inappropriate gntref. */\r
-#define GNTST_bad_handle (-4) /* Unrecognised or inappropriate handle. */\r
-#define GNTST_bad_virt_addr (-5) /* Inappropriate virtual address to map. */\r
-#define GNTST_bad_dev_addr (-6) /* Inappropriate device address to unmap.*/\r
-#define GNTST_no_device_space (-7) /* Out of space in I/O MMU. */\r
-#define GNTST_permission_denied (-8) /* Not enough privilege for operation. */\r
-#define GNTST_bad_page (-9) /* Specified page was invalid for op. */\r
-#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary. */\r
-#define GNTST_address_too_big (-11) /* transfer page address too large. */\r
-#define GNTST_eagain (-12) /* Operation not done; try again. */\r
+#define GNTST_okay (0) /* Normal return. */\r
+#define GNTST_general_error (-1) /* General undefined error. */\r
+#define GNTST_bad_domain (-2) /* Unrecognised domain id. */\r
+#define GNTST_bad_gntref (-3) /* Unrecognised or inappropriate gntref. */\r
+#define GNTST_bad_handle (-4) /* Unrecognised or inappropriate handle. */\r
+#define GNTST_bad_virt_addr (-5) /* Inappropriate virtual address to map. */\r
+#define GNTST_bad_dev_addr (-6) /* Inappropriate device address to unmap.*/\r
+#define GNTST_no_device_space (-7) /* Out of space in I/O MMU. */\r
+#define GNTST_permission_denied (-8) /* Not enough privilege for operation. */\r
+#define GNTST_bad_page (-9) /* Specified page was invalid for op. */\r
+#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary. */\r
+#define GNTST_address_too_big (-11) /* transfer page address too large. */\r
+#define GNTST_eagain (-12) /* Operation not done; try again. */\r
/* ` } */\r
\r
-#define GNTTABOP_error_msgs { \\r
+#define GNTTABOP_error_msgs { \\r
"okay", \\r
"undefined error", \\r
"unrecognised domain id", \\r