grant_table.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. /* SPDX-License-Identifier: MIT */
  2. /******************************************************************************
  3. * grant_table.h
  4. *
  5. * Interface for granting foreign access to page frames, and receiving
  6. * page-ownership transfers.
  7. *
  8. * Copyright (c) 2004, K A Fraser
  9. */
  10. #ifndef __XEN_PUBLIC_GRANT_TABLE_H__
  11. #define __XEN_PUBLIC_GRANT_TABLE_H__
  12. #include <xen/interface/xen.h>
  13. /***********************************
  14. * GRANT TABLE REPRESENTATION
  15. */
  16. /* Some rough guidelines on accessing and updating grant-table entries
  17. * in a concurrency-safe manner. For more information, Linux contains a
  18. * reference implementation for guest OSes (drivers/xen/grant_table.c, see
  19. * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=drivers/xen/grant-table.c;hb=HEAD
  20. *
  21. * NB. WMB is a no-op on current-generation x86 processors. However, a
  22. * compiler barrier will still be required.
  23. *
  24. * Introducing a valid entry into the grant table:
  25. * 1. Write ent->domid.
  26. * 2. Write ent->frame:
  27. * GTF_permit_access: Frame to which access is permitted.
  28. * GTF_accept_transfer: Pseudo-phys frame slot being filled by new
  29. * frame, or zero if none.
  30. * 3. Write memory barrier (WMB).
  31. * 4. Write ent->flags, inc. valid type.
  32. *
  33. * Invalidating an unused GTF_permit_access entry:
  34. * 1. flags = ent->flags.
  35. * 2. Observe that !(flags & (GTF_reading|GTF_writing)).
  36. * 3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
  37. * NB. No need for WMB as reuse of entry is control-dependent on success of
  38. * step 3, and all architectures guarantee ordering of ctrl-dep writes.
  39. *
  40. * Invalidating an in-use GTF_permit_access entry:
  41. * This cannot be done directly. Request assistance from the domain controller
  42. * which can set a timeout on the use of a grant entry and take necessary
  43. * action. (NB. This is not yet implemented!).
  44. *
  45. * Invalidating an unused GTF_accept_transfer entry:
  46. * 1. flags = ent->flags.
  47. * 2. Observe that !(flags & GTF_transfer_committed). [*]
  48. * 3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
  49. * NB. No need for WMB as reuse of entry is control-dependent on success of
  50. * step 3, and all architectures guarantee ordering of ctrl-dep writes.
  51. * [*] If GTF_transfer_committed is set then the grant entry is 'committed'.
  52. * The guest must /not/ modify the grant entry until the address of the
  53. * transferred frame is written. It is safe for the guest to spin waiting
  54. * for this to occur (detect by observing GTF_transfer_completed in
  55. * ent->flags).
  56. *
  57. * Invalidating a committed GTF_accept_transfer entry:
  58. * 1. Wait for (ent->flags & GTF_transfer_completed).
  59. *
  60. * Changing a GTF_permit_access from writable to read-only:
  61. * Use SMP-safe CMPXCHG to set GTF_readonly, while checking !GTF_writing.
  62. *
  63. * Changing a GTF_permit_access from read-only to writable:
  64. * Use SMP-safe bit-setting instruction.
  65. */
  66. /*
  67. * Reference to a grant entry in a specified domain's grant table.
  68. */
  69. typedef uint32_t grant_ref_t;
  70. /*
  71. * A grant table comprises a packed array of grant entries in one or more
  72. * page frames shared between Xen and a guest.
  73. * [XEN]: This field is written by Xen and read by the sharing guest.
  74. * [GST]: This field is written by the guest and read by Xen.
  75. */
  76. /*
  77. * Version 1 of the grant table entry structure is maintained largely for
  78. * backwards compatibility. New guests are recommended to support using
  79. * version 2 to overcome version 1 limitations, but to default to version 1.
  80. */
  81. struct grant_entry_v1 {
  82. /* GTF_xxx: various type and flag information. [XEN,GST] */
  83. uint16_t flags;
  84. /* The domain being granted foreign privileges. [GST] */
  85. domid_t domid;
  86. /*
  87. * GTF_permit_access: GFN that @domid is allowed to map and access. [GST]
  88. * GTF_accept_transfer: GFN that @domid is allowed to transfer into. [GST]
  89. * GTF_transfer_completed: MFN whose ownership transferred by @domid
  90. * (non-translated guests only). [XEN]
  91. */
  92. uint32_t frame;
  93. };
  94. /* The first few grant table entries will be preserved across grant table
  95. * version changes and may be pre-populated at domain creation by tools.
  96. */
  97. #define GNTTAB_NR_RESERVED_ENTRIES 8
  98. #define GNTTAB_RESERVED_CONSOLE 0
  99. #define GNTTAB_RESERVED_XENSTORE 1
  100. /*
  101. * Type of grant entry.
  102. * GTF_invalid: This grant entry grants no privileges.
  103. * GTF_permit_access: Allow @domid to map/access @frame.
  104. * GTF_accept_transfer: Allow @domid to transfer ownership of one page frame
  105. * to this guest. Xen writes the page number to @frame.
  106. * GTF_transitive: Allow @domid to transitively access a subrange of
  107. * @trans_grant in @trans_domid. No mappings are allowed.
  108. */
  109. #define GTF_invalid (0U<<0)
  110. #define GTF_permit_access (1U<<0)
  111. #define GTF_accept_transfer (2U<<0)
  112. #define GTF_transitive (3U<<0)
  113. #define GTF_type_mask (3U<<0)
  114. /*
  115. * Subflags for GTF_permit_access and GTF_transitive.
  116. * GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
  117. * GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
  118. * GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
  119. * Further subflags for GTF_permit_access only.
  120. * GTF_PAT, GTF_PWT, GTF_PCD: (x86) cache attribute flags to be used for
  121. * mappings of the grant [GST]
  122. * GTF_sub_page: Grant access to only a subrange of the page. @domid
  123. * will only be allowed to copy from the grant, and not
  124. * map it. [GST]
  125. */
  126. #define _GTF_readonly (2)
  127. #define GTF_readonly (1U<<_GTF_readonly)
  128. #define _GTF_reading (3)
  129. #define GTF_reading (1U<<_GTF_reading)
  130. #define _GTF_writing (4)
  131. #define GTF_writing (1U<<_GTF_writing)
  132. #define _GTF_PWT (5)
  133. #define GTF_PWT (1U<<_GTF_PWT)
  134. #define _GTF_PCD (6)
  135. #define GTF_PCD (1U<<_GTF_PCD)
  136. #define _GTF_PAT (7)
  137. #define GTF_PAT (1U<<_GTF_PAT)
  138. #define _GTF_sub_page (8)
  139. #define GTF_sub_page (1U<<_GTF_sub_page)
  140. /*
  141. * Subflags for GTF_accept_transfer:
  142. * GTF_transfer_committed: Xen sets this flag to indicate that it is committed
  143. * to transferring ownership of a page frame. When a guest sees this flag
  144. * it must /not/ modify the grant entry until GTF_transfer_completed is
  145. * set by Xen.
  146. * GTF_transfer_completed: It is safe for the guest to spin-wait on this flag
  147. * after reading GTF_transfer_committed. Xen will always write the frame
  148. * address, followed by ORing this flag, in a timely manner.
  149. */
  150. #define _GTF_transfer_committed (2)
  151. #define GTF_transfer_committed (1U<<_GTF_transfer_committed)
  152. #define _GTF_transfer_completed (3)
  153. #define GTF_transfer_completed (1U<<_GTF_transfer_completed)
  154. /*
  155. * Version 2 grant table entries. These fulfil the same role as
  156. * version 1 entries, but can represent more complicated operations.
  157. * Any given domain will have either a version 1 or a version 2 table,
  158. * and every entry in the table will be the same version.
  159. *
  160. * The interface by which domains use grant references does not depend
  161. * on the grant table version in use by the other domain.
  162. */
  163. /*
  164. * Version 1 and version 2 grant entries share a common prefix. The
  165. * fields of the prefix are documented as part of struct
  166. * grant_entry_v1.
  167. */
  168. struct grant_entry_header {
  169. uint16_t flags;
  170. domid_t domid;
  171. };
  172. /*
  173. * Version 2 of the grant entry structure.
  174. */
  175. union grant_entry_v2 {
  176. struct grant_entry_header hdr;
  177. /*
  178. * This member is used for V1-style full page grants, where either:
  179. *
  180. * -- hdr.type is GTF_accept_transfer, or
  181. * -- hdr.type is GTF_permit_access and GTF_sub_page is not set.
  182. *
  183. * In that case, the frame field has the same semantics as the
  184. * field of the same name in the V1 entry structure.
  185. */
  186. struct {
  187. struct grant_entry_header hdr;
  188. uint32_t pad0;
  189. uint64_t frame;
  190. } full_page;
  191. /*
  192. * If the grant type is GTF_grant_access and GTF_sub_page is set,
  193. * @domid is allowed to access bytes [@page_off,@page_off+@length)
  194. * in frame @frame.
  195. */
  196. struct {
  197. struct grant_entry_header hdr;
  198. uint16_t page_off;
  199. uint16_t length;
  200. uint64_t frame;
  201. } sub_page;
  202. /*
  203. * If the grant is GTF_transitive, @domid is allowed to use the
  204. * grant @gref in domain @trans_domid, as if it was the local
  205. * domain. Obviously, the transitive access must be compatible
  206. * with the original grant.
  207. *
  208. * The current version of Xen does not allow transitive grants
  209. * to be mapped.
  210. */
  211. struct {
  212. struct grant_entry_header hdr;
  213. domid_t trans_domid;
  214. uint16_t pad0;
  215. grant_ref_t gref;
  216. } transitive;
  217. uint32_t __spacer[4]; /* Pad to a power of two */
  218. };
  219. typedef uint16_t grant_status_t;
  220. /***********************************
  221. * GRANT TABLE QUERIES AND USES
  222. */
  223. #define GNTTABOP_map_grant_ref 0
  224. #define GNTTABOP_unmap_grant_ref 1
  225. #define GNTTABOP_setup_table 2
  226. #define GNTTABOP_dump_table 3
  227. #define GNTTABOP_transfer 4
  228. #define GNTTABOP_copy 5
  229. #define GNTTABOP_query_size 6
  230. #define GNTTABOP_unmap_and_replace 7
  231. #define GNTTABOP_set_version 8
  232. #define GNTTABOP_get_status_frames 9
  233. #define GNTTABOP_get_version 10
  234. #define GNTTABOP_swap_grant_ref 11
  235. #define GNTTABOP_cache_flush 12
  236. /* ` } */
  237. /*
  238. * Handle to track a mapping created via a grant reference.
  239. */
  240. typedef uint32_t grant_handle_t;
  241. /*
  242. * GNTTABOP_map_grant_ref: Map the grant entry (<dom>,<ref>) for access
  243. * by devices and/or host CPUs. If successful, <handle> is a tracking number
  244. * that must be presented later to destroy the mapping(s). On error, <status>
  245. * is a negative status code.
  246. * NOTES:
  247. * 1. If GNTMAP_device_map is specified then <dev_bus_addr> is the address
  248. * via which I/O devices may access the granted frame.
  249. * 2. If GNTMAP_host_map is specified then a mapping will be added at
  250. * either a host virtual address in the current address space, or at
  251. * a PTE at the specified machine address. The type of mapping to
  252. * perform is selected through the GNTMAP_contains_pte flag, and the
  253. * address is specified in <host_addr>.
  254. * 3. Mappings should only be destroyed via GNTTABOP_unmap_grant_ref. If a
  255. * host mapping is destroyed by other means then it is *NOT* guaranteed
  256. * to be accounted to the correct grant reference!
  257. */
  258. struct gnttab_map_grant_ref {
  259. /* IN parameters. */
  260. uint64_t host_addr;
  261. uint32_t flags; /* GNTMAP_* */
  262. grant_ref_t ref;
  263. domid_t dom;
  264. /* OUT parameters. */
  265. int16_t status; /* GNTST_* */
  266. grant_handle_t handle;
  267. uint64_t dev_bus_addr;
  268. };
  269. DEFINE_GUEST_HANDLE_STRUCT(gnttab_map_grant_ref);
  270. /*
  271. * GNTTABOP_unmap_grant_ref: Destroy one or more grant-reference mappings
  272. * tracked by <handle>. If <host_addr> or <dev_bus_addr> is zero, that
  273. * field is ignored. If non-zero, they must refer to a device/host mapping
  274. * that is tracked by <handle>
  275. * NOTES:
  276. * 1. The call may fail in an undefined manner if either mapping is not
  277. * tracked by <handle>.
  278. * 3. After executing a batch of unmaps, it is guaranteed that no stale
  279. * mappings will remain in the device or host TLBs.
  280. */
  281. struct gnttab_unmap_grant_ref {
  282. /* IN parameters. */
  283. uint64_t host_addr;
  284. uint64_t dev_bus_addr;
  285. grant_handle_t handle;
  286. /* OUT parameters. */
  287. int16_t status; /* GNTST_* */
  288. };
  289. DEFINE_GUEST_HANDLE_STRUCT(gnttab_unmap_grant_ref);
  290. /*
  291. * GNTTABOP_setup_table: Set up a grant table for <dom> comprising at least
  292. * <nr_frames> pages. The frame addresses are written to the <frame_list>.
  293. * Only <nr_frames> addresses are written, even if the table is larger.
  294. * NOTES:
  295. * 1. <dom> may be specified as DOMID_SELF.
  296. * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
  297. * 3. Xen may not support more than a single grant-table page per domain.
  298. */
  299. struct gnttab_setup_table {
  300. /* IN parameters. */
  301. domid_t dom;
  302. uint32_t nr_frames;
  303. /* OUT parameters. */
  304. int16_t status; /* GNTST_* */
  305. GUEST_HANDLE(xen_pfn_t) frame_list;
  306. };
  307. DEFINE_GUEST_HANDLE_STRUCT(gnttab_setup_table);
  308. /*
  309. * GNTTABOP_dump_table: Dump the contents of the grant table to the
  310. * xen console. Debugging use only.
  311. */
  312. struct gnttab_dump_table {
  313. /* IN parameters. */
  314. domid_t dom;
  315. /* OUT parameters. */
  316. int16_t status; /* GNTST_* */
  317. };
  318. DEFINE_GUEST_HANDLE_STRUCT(gnttab_dump_table);
  319. /*
  320. * GNTTABOP_transfer: Transfer <frame> to a foreign domain. The foreign domain
  321. * has previously registered its interest in the transfer via <domid, ref>.
  322. *
  323. * Note that, even if the transfer fails, the specified page no longer belongs
  324. * to the calling domain *unless* the error is GNTST_bad_page.
  325. *
  326. * Note further that only PV guests can use this operation.
  327. */
  328. struct gnttab_transfer {
  329. /* IN parameters. */
  330. xen_pfn_t mfn;
  331. domid_t domid;
  332. grant_ref_t ref;
  333. /* OUT parameters. */
  334. int16_t status;
  335. };
  336. DEFINE_GUEST_HANDLE_STRUCT(gnttab_transfer);
  337. /*
  338. * GNTTABOP_copy: Hypervisor based copy
  339. * source and destinations can be eithers MFNs or, for foreign domains,
  340. * grant references. the foreign domain has to grant read/write access
  341. * in its grant table.
  342. *
  343. * The flags specify what type source and destinations are (either MFN
  344. * or grant reference).
  345. *
  346. * Note that this can also be used to copy data between two domains
  347. * via a third party if the source and destination domains had previously
  348. * grant appropriate access to their pages to the third party.
  349. *
  350. * source_offset specifies an offset in the source frame, dest_offset
  351. * the offset in the target frame and len specifies the number of
  352. * bytes to be copied.
  353. */
  354. #define _GNTCOPY_source_gref (0)
  355. #define GNTCOPY_source_gref (1<<_GNTCOPY_source_gref)
  356. #define _GNTCOPY_dest_gref (1)
  357. #define GNTCOPY_dest_gref (1<<_GNTCOPY_dest_gref)
  358. struct gnttab_copy {
  359. /* IN parameters. */
  360. struct gnttab_copy_ptr {
  361. union {
  362. grant_ref_t ref;
  363. xen_pfn_t gmfn;
  364. } u;
  365. domid_t domid;
  366. uint16_t offset;
  367. } source, dest;
  368. uint16_t len;
  369. uint16_t flags; /* GNTCOPY_* */
  370. /* OUT parameters. */
  371. int16_t status;
  372. };
  373. DEFINE_GUEST_HANDLE_STRUCT(gnttab_copy);
  374. /*
  375. * GNTTABOP_query_size: Query the current and maximum sizes of the shared
  376. * grant table.
  377. * NOTES:
  378. * 1. <dom> may be specified as DOMID_SELF.
  379. * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
  380. */
  381. struct gnttab_query_size {
  382. /* IN parameters. */
  383. domid_t dom;
  384. /* OUT parameters. */
  385. uint32_t nr_frames;
  386. uint32_t max_nr_frames;
  387. int16_t status; /* GNTST_* */
  388. };
  389. DEFINE_GUEST_HANDLE_STRUCT(gnttab_query_size);
  390. /*
  391. * GNTTABOP_unmap_and_replace: Destroy one or more grant-reference mappings
  392. * tracked by <handle> but atomically replace the page table entry with one
  393. * pointing to the machine address under <new_addr>. <new_addr> will be
  394. * redirected to the null entry.
  395. * NOTES:
  396. * 1. The call may fail in an undefined manner if either mapping is not
  397. * tracked by <handle>.
  398. * 2. After executing a batch of unmaps, it is guaranteed that no stale
  399. * mappings will remain in the device or host TLBs.
  400. */
  401. struct gnttab_unmap_and_replace {
  402. /* IN parameters. */
  403. uint64_t host_addr;
  404. uint64_t new_addr;
  405. grant_handle_t handle;
  406. /* OUT parameters. */
  407. int16_t status; /* GNTST_* */
  408. };
  409. DEFINE_GUEST_HANDLE_STRUCT(gnttab_unmap_and_replace);
  410. /*
  411. * GNTTABOP_set_version: Request a particular version of the grant
  412. * table shared table structure. This operation may be used to toggle
  413. * between different versions, but must be performed while no grants
  414. * are active. The only defined versions are 1 and 2.
  415. */
  416. struct gnttab_set_version {
  417. /* IN/OUT parameters */
  418. uint32_t version;
  419. };
  420. DEFINE_GUEST_HANDLE_STRUCT(gnttab_set_version);
  421. /*
  422. * GNTTABOP_get_status_frames: Get the list of frames used to store grant
  423. * status for <dom>. In grant format version 2, the status is separated
  424. * from the other shared grant fields to allow more efficient synchronization
  425. * using barriers instead of atomic cmpexch operations.
  426. * <nr_frames> specify the size of vector <frame_list>.
  427. * The frame addresses are returned in the <frame_list>.
  428. * Only <nr_frames> addresses are returned, even if the table is larger.
  429. * NOTES:
  430. * 1. <dom> may be specified as DOMID_SELF.
  431. * 2. Only a sufficiently-privileged domain may specify <dom> != DOMID_SELF.
  432. */
  433. struct gnttab_get_status_frames {
  434. /* IN parameters. */
  435. uint32_t nr_frames;
  436. domid_t dom;
  437. /* OUT parameters. */
  438. int16_t status; /* GNTST_* */
  439. GUEST_HANDLE(uint64_t) frame_list;
  440. };
  441. DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_status_frames);
  442. /*
  443. * GNTTABOP_get_version: Get the grant table version which is in
  444. * effect for domain <dom>.
  445. */
  446. struct gnttab_get_version {
  447. /* IN parameters */
  448. domid_t dom;
  449. uint16_t pad;
  450. /* OUT parameters */
  451. uint32_t version;
  452. };
  453. DEFINE_GUEST_HANDLE_STRUCT(gnttab_get_version);
  454. /*
  455. * GNTTABOP_swap_grant_ref: Swap the contents of two grant entries.
  456. */
  457. struct gnttab_swap_grant_ref {
  458. /* IN parameters */
  459. grant_ref_t ref_a;
  460. grant_ref_t ref_b;
  461. /* OUT parameters */
  462. int16_t status; /* GNTST_* */
  463. };
  464. DEFINE_GUEST_HANDLE_STRUCT(gnttab_swap_grant_ref);
  465. /*
  466. * Issue one or more cache maintenance operations on a portion of a
  467. * page granted to the calling domain by a foreign domain.
  468. */
  469. struct gnttab_cache_flush {
  470. union {
  471. uint64_t dev_bus_addr;
  472. grant_ref_t ref;
  473. } a;
  474. uint16_t offset; /* offset from start of grant */
  475. uint16_t length; /* size within the grant */
  476. #define GNTTAB_CACHE_CLEAN (1u<<0)
  477. #define GNTTAB_CACHE_INVAL (1u<<1)
  478. #define GNTTAB_CACHE_SOURCE_GREF (1u<<31)
  479. uint32_t op;
  480. };
  481. DEFINE_GUEST_HANDLE_STRUCT(gnttab_cache_flush);
  482. /*
  483. * Bitfield values for gnttab_map_grant_ref.flags.
  484. */
  485. /* Map the grant entry for access by I/O devices. */
  486. #define _GNTMAP_device_map (0)
  487. #define GNTMAP_device_map (1<<_GNTMAP_device_map)
  488. /* Map the grant entry for access by host CPUs. */
  489. #define _GNTMAP_host_map (1)
  490. #define GNTMAP_host_map (1<<_GNTMAP_host_map)
  491. /* Accesses to the granted frame will be restricted to read-only access. */
  492. #define _GNTMAP_readonly (2)
  493. #define GNTMAP_readonly (1<<_GNTMAP_readonly)
  494. /*
  495. * GNTMAP_host_map subflag:
  496. * 0 => The host mapping is usable only by the guest OS.
  497. * 1 => The host mapping is usable by guest OS + current application.
  498. */
  499. #define _GNTMAP_application_map (3)
  500. #define GNTMAP_application_map (1<<_GNTMAP_application_map)
  501. /*
  502. * GNTMAP_contains_pte subflag:
  503. * 0 => This map request contains a host virtual address.
  504. * 1 => This map request contains the machine addess of the PTE to update.
  505. */
  506. #define _GNTMAP_contains_pte (4)
  507. #define GNTMAP_contains_pte (1<<_GNTMAP_contains_pte)
  508. /*
  509. * Bits to be placed in guest kernel available PTE bits (architecture
  510. * dependent; only supported when XENFEAT_gnttab_map_avail_bits is set).
  511. */
  512. #define _GNTMAP_guest_avail0 (16)
  513. #define GNTMAP_guest_avail_mask ((uint32_t)~0 << _GNTMAP_guest_avail0)
  514. /*
  515. * Values for error status returns. All errors are -ve.
  516. */
  517. #define GNTST_okay (0) /* Normal return. */
  518. #define GNTST_general_error (-1) /* General undefined error. */
  519. #define GNTST_bad_domain (-2) /* Unrecognsed domain id. */
  520. #define GNTST_bad_gntref (-3) /* Unrecognised or inappropriate gntref. */
  521. #define GNTST_bad_handle (-4) /* Unrecognised or inappropriate handle. */
  522. #define GNTST_bad_virt_addr (-5) /* Inappropriate virtual address to map. */
  523. #define GNTST_bad_dev_addr (-6) /* Inappropriate device address to unmap.*/
  524. #define GNTST_no_device_space (-7) /* Out of space in I/O MMU. */
  525. #define GNTST_permission_denied (-8) /* Not enough privilege for operation. */
  526. #define GNTST_bad_page (-9) /* Specified page was invalid for op. */
  527. #define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary. */
  528. #define GNTST_address_too_big (-11) /* transfer page address too large. */
  529. #define GNTST_eagain (-12) /* Operation not done; try again. */
  530. #define GNTST_no_space (-13) /* Out of space (handles etc). */
  531. #define GNTTABOP_error_msgs { \
  532. "okay", \
  533. "undefined error", \
  534. "unrecognised domain id", \
  535. "invalid grant reference", \
  536. "invalid mapping handle", \
  537. "invalid virtual address", \
  538. "invalid device address", \
  539. "no spare translation slot in the I/O MMU", \
  540. "permission denied", \
  541. "bad page", \
  542. "copy arguments cross page boundary", \
  543. "page address size too large", \
  544. "operation not done; try again", \
  545. "out of space", \
  546. }
  547. #endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */