tmem.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /******************************************************************************
  2. * tmem.h
  3. *
  4. * Guest OS interface to Xen Transcendent Memory.
  5. *
  6. * Permission is hereby granted, free of charge, to any person obtaining a copy
  7. * of this software and associated documentation files (the "Software"), to
  8. * deal in the Software without restriction, including without limitation the
  9. * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  10. * sell copies of the Software, and to permit persons to whom the Software is
  11. * furnished to do so, subject to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  19. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  22. * DEALINGS IN THE SOFTWARE.
  23. *
  24. * Copyright (c) 2004, K A Fraser
  25. */
  26. #ifndef __XEN_PUBLIC_TMEM_H__
  27. #define __XEN_PUBLIC_TMEM_H__
  28. #include "xen.h"
  29. #if __XEN_INTERFACE_VERSION__ < 0x00041300
  30. /* version of ABI */
  31. #define TMEM_SPEC_VERSION 1
  32. #define TMEM_NEW_POOL 1
  33. #define TMEM_DESTROY_POOL 2
  34. #define TMEM_PUT_PAGE 4
  35. #define TMEM_GET_PAGE 5
  36. #define TMEM_FLUSH_PAGE 6
  37. #define TMEM_FLUSH_OBJECT 7
  38. #if __XEN_INTERFACE_VERSION__ < 0x00040400
  39. #define TMEM_NEW_PAGE 3
  40. #define TMEM_READ 8
  41. #define TMEM_WRITE 9
  42. #define TMEM_XCHG 10
  43. #endif
  44. /* Privileged commands now called via XEN_SYSCTL_tmem_op. */
  45. #define TMEM_AUTH 101 /* as XEN_SYSCTL_TMEM_OP_SET_AUTH. */
  46. #define TMEM_RESTORE_NEW 102 /* as XEN_SYSCTL_TMEM_OP_SET_POOL. */
  47. /* Bits for HYPERVISOR_tmem_op(TMEM_NEW_POOL) */
  48. #define TMEM_POOL_PERSIST 1
  49. #define TMEM_POOL_SHARED 2
  50. #define TMEM_POOL_PRECOMPRESSED 4
  51. #define TMEM_POOL_PAGESIZE_SHIFT 4
  52. #define TMEM_POOL_PAGESIZE_MASK 0xf
  53. #define TMEM_POOL_VERSION_SHIFT 24
  54. #define TMEM_POOL_VERSION_MASK 0xff
  55. #define TMEM_POOL_RESERVED_BITS 0x00ffff00
  56. /* Bits for client flags (save/restore) */
  57. #define TMEM_CLIENT_COMPRESS 1
  58. #define TMEM_CLIENT_FROZEN 2
  59. /* Special errno values */
  60. #define EFROZEN 1000
  61. #define EEMPTY 1001
  62. struct xen_tmem_oid {
  63. uint64_t oid[3];
  64. };
  65. typedef struct xen_tmem_oid xen_tmem_oid_t;
  66. DEFINE_XEN_GUEST_HANDLE(xen_tmem_oid_t);
  67. #ifndef __ASSEMBLY__
  68. #if __XEN_INTERFACE_VERSION__ < 0x00040400
  69. typedef xen_pfn_t tmem_cli_mfn_t;
  70. #endif
  71. typedef XEN_GUEST_HANDLE(char) tmem_cli_va_t;
  72. struct tmem_op {
  73. uint32_t cmd;
  74. int32_t pool_id;
  75. union {
  76. struct {
  77. uint64_t uuid[2];
  78. uint32_t flags;
  79. uint32_t arg1;
  80. } creat; /* for cmd == TMEM_NEW_POOL. */
  81. struct {
  82. #if __XEN_INTERFACE_VERSION__ < 0x00040600
  83. uint64_t oid[3];
  84. #else
  85. xen_tmem_oid_t oid;
  86. #endif
  87. uint32_t index;
  88. uint32_t tmem_offset;
  89. uint32_t pfn_offset;
  90. uint32_t len;
  91. xen_pfn_t cmfn; /* client machine page frame */
  92. } gen; /* for all other cmd ("generic") */
  93. } u;
  94. };
  95. typedef struct tmem_op tmem_op_t;
  96. DEFINE_XEN_GUEST_HANDLE(tmem_op_t);
  97. #endif
  98. #endif /* __XEN_INTERFACE_VERSION__ < 0x00041300 */
  99. #endif /* __XEN_PUBLIC_TMEM_H__ */
  100. /*
  101. * Local variables:
  102. * mode: C
  103. * c-file-style: "BSD"
  104. * c-basic-offset: 4
  105. * tab-width: 4
  106. * indent-tabs-mode: nil
  107. * End:
  108. */