wscalls.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*
  2. * Linux 2.6.32 and later Kernel module for VMware MVP Hypervisor Support
  3. *
  4. * Copyright (C) 2010-2013 VMware, Inc. All rights reserved.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License version 2 as published by
  8. * the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along with
  16. * this program; see the file COPYING. If not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. #line 5
  20. /**
  21. * @file
  22. *
  23. * @brief Worldswitch call parameters
  24. */
  25. #ifndef _WSCALLS_H
  26. #define _WSCALLS_H
  27. #define INCLUDE_ALLOW_MODULE
  28. #define INCLUDE_ALLOW_MONITOR
  29. #define INCLUDE_ALLOW_GPL
  30. #include "include_check.h"
  31. #define WSCALL_ACQUIRE_PAGE 1
  32. #define WSCALL_FLUSH_ALL_DCACHES 2
  33. #define WSCALL_IRQ 3
  34. #define WSCALL_ABORT 4
  35. #define WSCALL_LOG 5
  36. #define WSCALL_WAIT 6
  37. #define WSCALL_MUTEXLOCK 7
  38. #define WSCALL_MUTEXUNLOCK 8
  39. #define WSCALL_MUTEXUNLSLEEP 9
  40. #define WSCALL_MUTEXUNLWAKE 10
  41. #define WSCALL_GET_PAGE_FROM_VMID 11
  42. #define WSCALL_REMOVE_PAGE_FROM_VMID 12
  43. #define WSCALL_RELEASE_PAGE 13
  44. #define WSCALL_READTOD 14
  45. #define WSCALL_QP_GUEST_ATTACH 15
  46. #define WSCALL_MONITOR_TIMER 16
  47. #define WSCALL_COMM_SIGNAL 17
  48. #define WSCALL_QP_NOTIFY 18
  49. /*
  50. * MVPKM V0.5.2.0 supports all the calls above. If new API calls are
  51. * introduced then make sure that the calling function (probably in
  52. * mkhost.c) checks the mvpkm's version stored in wsp->mvpkmVersion
  53. * and invokes the wscall only when it is supported.
  54. */
  55. #define WSCALL_MAX_CALLNO 20
  56. #define WSCALL_LOG_MAX 256
  57. #define WSCALL_MAX_MPNS 16
  58. #include "exitstatus.h"
  59. #include "mutex.h"
  60. #include "mksck_shared.h"
  61. #include "qp.h"
  62. #include "comm_transp.h"
  63. #include "comm_transp_impl.h"
  64. typedef struct WSParams {
  65. uint32 callno;
  66. union {
  67. /**
  68. * @brief Used for both WSCALL_ACQUIRE_PAGE and WSCALL_RELEASE_PAGE.
  69. */
  70. struct {
  71. /** IN Number of pages */
  72. uint16 pages;
  73. /**
  74. * IN Size of each page - 2^(12+order) sized and
  75. * aligned in machine space. (WSCALL_ACQUIRE_PAGE only)
  76. */
  77. uint16 order;
  78. /** IN Region identifier for pages (WSCALL_ACQUIRE_PAGE only) */
  79. PhysMem_RegionType forRegion;
  80. /**
  81. * OUT (on WSCALL_ACQUIRE_PAGE)
  82. * IN (on WSCALL_RELEASE_PAGE)
  83. * Vector of page base MPNs
  84. */
  85. MPN mpns[WSCALL_MAX_MPNS];
  86. } pages;
  87. union {
  88. MPN mpn; /**< IN MPN to query refcount. */
  89. _Bool referenced; /**< OUT Host page tables contain the MPN? */
  90. } refCount;
  91. struct {
  92. ExitStatus status; /**< IN the final status of the monitor */
  93. } abort;
  94. struct {
  95. int level;
  96. char messg[WSCALL_LOG_MAX];
  97. } log;
  98. struct {
  99. HKVA mtxHKVA; /**< IN mutex's host kernel virt addr */
  100. MutexMode mode; /**< IN shared or exclusive */
  101. uint32 cvi; /**< IN condition variable index */
  102. _Bool all; /**< IN wake all waiting threads? */
  103. _Bool ok; /**< OUT Mutex_Lock completed */
  104. } mutex;
  105. struct {
  106. Mksck_VmId vmId; /**< IN translate and lock this vmID */
  107. /**
  108. * OUT true if the lookup was successful, page is found,
  109. * and refc incremented
  110. */
  111. _Bool found;
  112. /** OUT array of MPNs of the requested vmId */
  113. MPN mpn[MKSCKPAGE_TOTAL];
  114. } pageMgmnt;
  115. struct {
  116. /** OUT current time-of-day seconds */
  117. unsigned int now;
  118. /** OUT current time-of-day microseconds */
  119. unsigned int nowusec;
  120. } tod;
  121. struct {
  122. QPId id; /**< IN/OUT shared memory id */
  123. uint32 capacity; /**< IN size of shared region requested */
  124. uint32 type; /**< IN type of queue pair */
  125. uint32 base; /**< IN base MPN of PA vector page */
  126. uint32 nrPages; /**< IN number of pages to map */
  127. int32 rc; /**< OUT return code */
  128. } qp;
  129. struct {
  130. CommTranspID transpID;
  131. CommTranspIOEvent event;
  132. } commEvent;
  133. struct {
  134. uint64 when64; /**< IN timer request */
  135. } timer;
  136. struct {
  137. _Bool suspendMode; /**< Is the guest in suspend mode? */
  138. } wait;
  139. }; /**< anonymous union */
  140. } WSParams;
  141. /**
  142. * @brief Cast the opaque param_ member of the wsp to WSParams type
  143. * @param wsp_ the world switch page structure pointer
  144. * @return the cast pointer
  145. */
  146. static inline WSParams *UNUSED
  147. WSP_Params(WorldSwitchPage *wsp_) {
  148. return (WSParams *)(wsp_->params_);
  149. }
  150. MY_ASSERTS(WSParFn,
  151. ASSERT_ON_COMPILE(sizeof(WSParams) <= WSP_PARAMS_SIZE);
  152. )
  153. #endif