vki-xen-domctl.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655
  1. /*
  2. This file is part of Valgrind, a dynamic binary instrumentation
  3. framework.
  4. Copyright (C) 2012-2017 Citrix
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the
  8. License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. 02111-1307, USA.
  17. The GNU General Public License is contained in the file COPYING.
  18. */
  19. /* Contributed by Andrew Cooper <andrew.cooper3@citrix.com>
  20. and Ian Campbell <ian.campbell@citrix.com> */
  21. #ifndef __VKI_XEN_DOMCTL_H
  22. #define __VKI_XEN_DOMCTL_H
  23. /*
  24. * The domctl interface is versioned via the interface_version
  25. * field. This structures in this header supports domctl interfaces:
  26. *
  27. * - 0x00000007: Xen 4.1
  28. * - 0x00000008: Xen 4.2
  29. * - 0x00000009: Xen 4.3 & 4.4
  30. * - 0x0000000a: Xen 4.5
  31. * - 0x0000000b: Xen 4.6
  32. * - 0x0000000c: Xen 4.7
  33. *
  34. * When adding a new subop be sure to include the variants used by all
  35. * of the above, both here and in syswrap-xen.c
  36. *
  37. * Structs which are identical in all supported versions have no
  38. * version suffix. Structs which do differ are defined multiple times
  39. * and use the suffix of the latest version to contain that particular
  40. * variant.
  41. */
  42. #define VKI_XEN_DOMCTL_createdomain 1
  43. #define VKI_XEN_DOMCTL_destroydomain 2
  44. #define VKI_XEN_DOMCTL_pausedomain 3
  45. #define VKI_XEN_DOMCTL_unpausedomain 4
  46. #define VKI_XEN_DOMCTL_getdomaininfo 5
  47. #define VKI_XEN_DOMCTL_getmemlist 6
  48. #define VKI_XEN_DOMCTL_getpageframeinfo 7
  49. #define VKI_XEN_DOMCTL_getpageframeinfo2 8
  50. #define VKI_XEN_DOMCTL_setvcpuaffinity 9
  51. #define VKI_XEN_DOMCTL_shadow_op 10
  52. #define VKI_XEN_DOMCTL_max_mem 11
  53. #define VKI_XEN_DOMCTL_setvcpucontext 12
  54. #define VKI_XEN_DOMCTL_getvcpucontext 13
  55. #define VKI_XEN_DOMCTL_getvcpuinfo 14
  56. #define VKI_XEN_DOMCTL_max_vcpus 15
  57. #define VKI_XEN_DOMCTL_scheduler_op 16
  58. #define VKI_XEN_DOMCTL_setdomainhandle 17
  59. #define VKI_XEN_DOMCTL_setdebugging 18
  60. #define VKI_XEN_DOMCTL_irq_permission 19
  61. #define VKI_XEN_DOMCTL_iomem_permission 20
  62. #define VKI_XEN_DOMCTL_ioport_permission 21
  63. #define VKI_XEN_DOMCTL_hypercall_init 22
  64. #define VKI_XEN_DOMCTL_arch_setup 23
  65. #define VKI_XEN_DOMCTL_settimeoffset 24
  66. #define VKI_XEN_DOMCTL_getvcpuaffinity 25
  67. #define VKI_XEN_DOMCTL_real_mode_area 26
  68. #define VKI_XEN_DOMCTL_resumedomain 27
  69. #define VKI_XEN_DOMCTL_sendtrigger 28
  70. #define VKI_XEN_DOMCTL_subscribe 29
  71. #define VKI_XEN_DOMCTL_gethvmcontext 33
  72. #define VKI_XEN_DOMCTL_sethvmcontext 34
  73. #define VKI_XEN_DOMCTL_set_address_size 35
  74. #define VKI_XEN_DOMCTL_get_address_size 36
  75. #define VKI_XEN_DOMCTL_assign_device 37
  76. #define VKI_XEN_DOMCTL_bind_pt_irq 38
  77. #define VKI_XEN_DOMCTL_memory_mapping 39
  78. #define VKI_XEN_DOMCTL_ioport_mapping 40
  79. #define VKI_XEN_DOMCTL_pin_mem_cacheattr 41
  80. #define VKI_XEN_DOMCTL_set_ext_vcpucontext 42
  81. #define VKI_XEN_DOMCTL_get_ext_vcpucontext 43
  82. #define VKI_XEN_DOMCTL_set_opt_feature 44 /*Obsolete IA64 only */
  83. #define VKI_XEN_DOMCTL_test_assign_device 45
  84. #define VKI_XEN_DOMCTL_set_target 46
  85. #define VKI_XEN_DOMCTL_deassign_device 47
  86. #define VKI_XEN_DOMCTL_unbind_pt_irq 48
  87. #define VKI_XEN_DOMCTL_set_cpuid 49
  88. #define VKI_XEN_DOMCTL_get_device_group 50
  89. #define VKI_XEN_DOMCTL_set_machine_address_size 51
  90. #define VKI_XEN_DOMCTL_get_machine_address_size 52
  91. #define VKI_XEN_DOMCTL_suppress_spurious_page_faults 53
  92. #define VKI_XEN_DOMCTL_debug_op 54
  93. #define VKI_XEN_DOMCTL_gethvmcontext_partial 55
  94. #define VKI_XEN_DOMCTL_mem_event_op 56
  95. #define VKI_XEN_DOMCTL_vm_event_op 56 /* name change in 4.6 */
  96. #define VKI_XEN_DOMCTL_mem_sharing_op 57
  97. #define VKI_XEN_DOMCTL_disable_migrate 58
  98. #define VKI_XEN_DOMCTL_gettscinfo 59
  99. #define VKI_XEN_DOMCTL_settscinfo 60
  100. #define VKI_XEN_DOMCTL_getpageframeinfo3 61
  101. #define VKI_XEN_DOMCTL_setvcpuextstate 62
  102. #define VKI_XEN_DOMCTL_getvcpuextstate 63
  103. #define VKI_XEN_DOMCTL_set_access_required 64
  104. #define VKI_XEN_DOMCTL_audit_p2m 65
  105. #define VKI_XEN_DOMCTL_set_virq_handler 66
  106. #define VKI_XEN_DOMCTL_set_broken_page_p2m 67
  107. #define VKI_XEN_DOMCTL_setnodeaffinity 68
  108. #define VKI_XEN_DOMCTL_getnodeaffinity 69
  109. #define VKI_XEN_DOMCTL_set_max_evtchn 70
  110. #define VKI_XEN_DOMCTL_cacheflush 71
  111. #define VKI_XEN_DOMCTL_get_vcpu_msrs 72
  112. #define VKI_XEN_DOMCTL_set_vcpu_msrs 73
  113. #define VKI_XEN_DOMCTL_monitor_op 77 /* new in 4.6 */
  114. #define VKI_XEN_DOMCTL_gdbsx_guestmemio 1000
  115. #define VKI_XEN_DOMCTL_gdbsx_pausevcpu 1001
  116. #define VKI_XEN_DOMCTL_gdbsx_unpausevcpu 1002
  117. #define VKI_XEN_DOMCTL_gdbsx_domstatus 1003
  118. struct vki_xen_domctl_createdomain {
  119. /* IN parameters */
  120. vki_uint32_t ssidref;
  121. vki_xen_domain_handle_t handle;
  122. vki_uint32_t flags;
  123. };
  124. struct vki_xen_domctl_getdomaininfo_00000007 {
  125. /* OUT variables. */
  126. vki_xen_domid_t domain;
  127. vki_uint32_t flags;
  128. vki_xen_uint64_aligned_t tot_pages;
  129. vki_xen_uint64_aligned_t max_pages;
  130. vki_xen_uint64_aligned_t shr_pages;
  131. vki_xen_uint64_aligned_t paged_pages;
  132. vki_xen_uint64_aligned_t shared_info_frame;
  133. vki_xen_uint64_aligned_t cpu_time;
  134. vki_uint32_t nr_online_vcpus;
  135. vki_uint32_t max_vcpu_id;
  136. vki_uint32_t ssidref;
  137. vki_xen_domain_handle_t handle;
  138. vki_uint32_t cpupool;
  139. };
  140. typedef struct vki_xen_domctl_getdomaininfo_00000007 vki_xen_domctl_getdomaininfo_00000007_t;
  141. DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000007_t);
  142. struct vki_xen_domctl_getdomaininfo_00000008 {
  143. /* OUT variables. */
  144. vki_xen_domid_t domain;
  145. vki_uint32_t flags;
  146. vki_xen_uint64_aligned_t tot_pages;
  147. vki_xen_uint64_aligned_t max_pages;
  148. vki_xen_uint64_aligned_t shr_pages;
  149. vki_xen_uint64_aligned_t paged_pages;
  150. vki_xen_uint64_aligned_t shared_info_frame;
  151. vki_xen_uint64_aligned_t cpu_time;
  152. vki_uint32_t nr_online_vcpus;
  153. vki_uint32_t max_vcpu_id;
  154. vki_uint32_t ssidref;
  155. vki_xen_domain_handle_t handle;
  156. vki_uint32_t cpupool;
  157. };
  158. typedef struct vki_xen_domctl_getdomaininfo_00000008 vki_xen_domctl_getdomaininfo_00000008_t;
  159. DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000008_t);
  160. struct vki_xen_domctl_getdomaininfo_00000009 {
  161. /* OUT variables. */
  162. vki_xen_domid_t domain;
  163. vki_uint32_t flags;
  164. vki_xen_uint64_aligned_t tot_pages;
  165. vki_xen_uint64_aligned_t max_pages;
  166. vki_xen_uint64_aligned_t outstanding_pages;
  167. vki_xen_uint64_aligned_t shr_pages;
  168. vki_xen_uint64_aligned_t paged_pages;
  169. vki_xen_uint64_aligned_t shared_info_frame;
  170. vki_xen_uint64_aligned_t cpu_time;
  171. vki_uint32_t nr_online_vcpus;
  172. vki_uint32_t max_vcpu_id;
  173. vki_uint32_t ssidref;
  174. vki_xen_domain_handle_t handle;
  175. vki_uint32_t cpupool;
  176. };
  177. typedef struct vki_xen_domctl_getdomaininfo_00000009 vki_xen_domctl_getdomaininfo_00000009_t;
  178. DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_getdomaininfo_00000009_t);
  179. /* vki_xen_domctl_getdomaininfo_0000000a is the same as 00000009 */
  180. /* Get/set the NUMA node(s) with which the guest has affinity with. */
  181. /* XEN_DOMCTL_setnodeaffinity */
  182. /* XEN_DOMCTL_getnodeaffinity */
  183. struct vki_xen_domctl_nodeaffinity {
  184. struct vki_xenctl_bitmap nodemap;/* IN */
  185. };
  186. typedef struct vki_xen_domctl_nodeaffinity vki_xen_domctl_nodeaffinity_t;
  187. DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_nodeaffinity_t);
  188. struct vki_xen_domctl_getpageframeinfo3 {
  189. vki_xen_uint64_aligned_t num; /* IN */
  190. VKI_XEN_GUEST_HANDLE_64(vki_xen_pfn_t) array; /* IN/OUT */
  191. };
  192. struct vki_xen_domctl_vcpuaffinity_00000009 {
  193. vki_uint32_t vcpu; /* IN */
  194. struct vki_xenctl_bitmap cpumap; /* IN/OUT */
  195. };
  196. struct vki_xen_domctl_vcpuaffinity_0000000a {
  197. vki_uint32_t vcpu; /* IN */
  198. #define VKI_XEN_VCPUAFFINITY_HARD (1U<<0)
  199. #define VKI_XEN_VCPUAFFINITY_SOFT (1U<<1)
  200. vki_uint32_t flags; /* IN */
  201. struct vki_xenctl_bitmap cpumap_hard; /* IN/OUT */
  202. struct vki_xenctl_bitmap cpumap_soft; /* IN/OUT */
  203. };
  204. struct vki_xen_domctl_shadow_op_stats {
  205. vki_uint32_t fault_count;
  206. vki_uint32_t dirty_count;
  207. };
  208. /* vki_xen_domctl_shadow_op.op is an utter mess for compatibily reasons. */
  209. struct vki_xen_domctl_shadow_op {
  210. vki_uint32_t op; /* IN */
  211. #define VKI_XEN_DOMCTL_SHADOW_OP_OFF 0
  212. #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE 32
  213. #define VKI_XEN_DOMCTL_SHADOW_OP_CLEAN 11
  214. #define VKI_XEN_DOMCTL_SHADOW_OP_PEEK 12
  215. #define VKI_XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION 30
  216. #define VKI_XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION 31
  217. #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_TEST 1
  218. #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_LOGDIRTY 2
  219. #define VKI_XEN_DOMCTL_SHADOW_OP_ENABLE_TRANSLATE 3
  220. vki_uint32_t mode;
  221. #define XEN_DOMCTL_SHADOW_ENABLE_REFCOUNT (1 << 1)
  222. #define XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
  223. #define XEN_DOMCTL_SHADOW_ENABLE_TRANSLATE (1 << 3)
  224. #define XEN_DOMCTL_SHADOW_ENABLE_EXTERNAL (1 << 4)
  225. vki_uint32_t mb;
  226. VKI_XEN_GUEST_HANDLE_64(vki_uint8) dirty_bitmap;
  227. vki_xen_uint64_aligned_t pages;
  228. struct vki_xen_domctl_shadow_op_stats stats;
  229. };
  230. struct vki_xen_domctl_max_mem {
  231. /* IN variables. */
  232. vki_xen_uint64_aligned_t max_memkb;
  233. };
  234. struct vki_xen_domctl_vcpucontext {
  235. vki_uint32_t vcpu; /* IN */
  236. VKI_XEN_GUEST_HANDLE_64(vki_xen_vcpu_guest_context_t) ctxt; /* IN/OUT */
  237. };
  238. struct vki_xen_domctl_getvcpuinfo {
  239. /* IN variables. */
  240. vki_uint32_t vcpu;
  241. /* OUT variables. */
  242. vki_uint8_t online; /* currently online (not hotplugged)? */
  243. vki_uint8_t blocked; /* blocked waiting for an event? */
  244. vki_uint8_t running; /* currently scheduled on its CPU? */
  245. vki_xen_uint64_aligned_t cpu_time;/* total cpu time consumed (ns) */
  246. vki_uint32_t cpu; /* current mapping */
  247. };
  248. struct vki_xen_domctl_scheduler_op {
  249. vki_uint32_t sched_id; /* VKI_XEN_SCHEDULER_* */
  250. #define VKI_XEN_SCHEDULER_SEDF 4
  251. #define VKI_XEN_SCHEDULER_CREDIT 5
  252. #define VKI_XEN_SCHEDULER_CREDIT2 6
  253. #define VKI_XEN_SCHEDULER_ARINC653 7
  254. #define VKI_XEN_SCHEDULER_RTDS 8
  255. vki_uint32_t cmd; /* VKI_XEN_DOMCTL_SCHEDOP_* */
  256. #define VKI_XEN_DOMCTL_SCHEDOP_putinfo 0
  257. #define VKI_XEN_DOMCTL_SCHEDOP_getinfo 1
  258. union {
  259. struct xen_domctl_sched_sedf {
  260. vki_xen_uint64_aligned_t period;
  261. vki_xen_uint64_aligned_t slice;
  262. vki_xen_uint64_aligned_t latency;
  263. vki_uint32_t extratime;
  264. vki_uint32_t weight;
  265. } sedf;
  266. struct xen_domctl_sched_credit {
  267. vki_uint16_t weight;
  268. vki_uint16_t cap;
  269. } credit;
  270. struct xen_domctl_sched_credit2 {
  271. vki_uint16_t weight;
  272. } credit2;
  273. struct xen_domctl_sched_rtds {
  274. vki_uint32_t period;
  275. vki_uint32_t budget;
  276. } rtds;
  277. } u;
  278. };
  279. struct vki_xen_domctl_max_vcpus {
  280. vki_uint32_t max; /* maximum number of vcpus */
  281. };
  282. /* XEN_DOMCTL_irq_permission */
  283. struct vki_xen_domctl_irq_permission {
  284. vki_uint8_t pirq;
  285. vki_uint8_t allow_access; /* flag to specify enable/disable of IRQ access */
  286. };
  287. struct vki_xen_domctl_iomem_permission {
  288. vki_xen_uint64_aligned_t first_mfn;/* first page (physical page number) in range */
  289. vki_xen_uint64_aligned_t nr_mfns; /* number of pages in range (>0) */
  290. vki_uint8_t allow_access; /* allow (!0) or deny (0) access to range? */
  291. };
  292. struct vki_xen_domctl_ioport_permission {
  293. vki_uint32_t first_port; /* IN */
  294. vki_uint32_t nr_ports; /* IN */
  295. vki_uint8_t allow_access; /* IN */
  296. };
  297. struct vki_xen_domctl_hypercall_init {
  298. vki_xen_uint64_aligned_t gmfn; /* GMFN to be initialised */
  299. };
  300. struct vki_xen_domctl_settimeoffset {
  301. vki_int32_t time_offset_seconds;
  302. };
  303. struct vki_xen_domctl_cpuid {
  304. vki_uint32_t input[2];
  305. vki_uint32_t eax;
  306. vki_uint32_t ebx;
  307. vki_uint32_t ecx;
  308. vki_uint32_t edx;
  309. };
  310. struct vki_xen_guest_tsc_info {
  311. vki_uint32_t tsc_mode;
  312. vki_uint32_t gtsc_khz;
  313. vki_uint32_t incarnation;
  314. vki_uint32_t pad;
  315. vki_xen_uint64_aligned_t elapsed_nsec;
  316. };
  317. typedef struct vki_xen_guest_tsc_info vki_xen_guest_tsc_info_t;
  318. DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_guest_tsc_info_t);
  319. struct vki_xen_domctl_tsc_info_00000007 {
  320. VKI_XEN_GUEST_HANDLE_64(vki_xen_guest_tsc_info_t) out_info; /* OUT */
  321. vki_xen_guest_tsc_info_t info; /* IN */
  322. };
  323. /* 4.6 removed the output pointer */
  324. struct vki_xen_domctl_tsc_info_0000000b {
  325. /* IN/OUT */
  326. vki_uint32_t tsc_mode;
  327. vki_uint32_t gtsc_khz;
  328. vki_uint32_t incarnation;
  329. vki_uint32_t pad;
  330. vki_xen_uint64_aligned_t elapsed_nsec;
  331. };
  332. struct vki_xen_domctl_hvmcontext {
  333. vki_uint32_t size; /* IN/OUT size of buffer */
  334. VKI_XEN_GUEST_HANDLE_64(vki_uint8) buffer; /* IN/OUT */
  335. };
  336. typedef struct vki_xen_domctl_hvmcontext vki_xen_domctl_hvmcontext_t;
  337. DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_t);
  338. struct vki_xen_domctl_hvmcontext_partial {
  339. vki_uint32_t type; /* IN */
  340. vki_uint32_t instance; /* IN */
  341. VKI_XEN_GUEST_HANDLE_64(vki_uint8) buffer; /* IN/OUT buffer */
  342. };
  343. typedef struct vki_xen_domctl_hvmcontext_partial vki_xen_domctl_hvmcontext_partial_t;
  344. DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_hvmcontext_partial_t);
  345. struct vki_xen_domctl_pin_mem_cacheattr {
  346. vki_xen_uint64_aligned_t start, end; /* IN */
  347. vki_uint32_t type; /* IN */
  348. };
  349. struct vki_xen_domctl_ext_vcpucontext_00000008 {
  350. vki_uint32_t vcpu; /* IN */
  351. /* IN for XEN_DOMCTL_set_ext_vcpucontext
  352. * OUT for XEN_DOMCTL_get_ext_vcpucontext */
  353. vki_uint32_t size;
  354. #if defined(__i386__) || defined(__x86_64__)
  355. vki_xen_uint64_aligned_t syscall32_callback_eip;
  356. vki_xen_uint64_aligned_t sysenter_callback_eip;
  357. vki_uint16_t syscall32_callback_cs;
  358. vki_uint16_t sysenter_callback_cs;
  359. vki_uint8_t syscall32_disables_events;
  360. vki_uint8_t sysenter_disables_events;
  361. vki_xen_uint64_aligned_t mcg_cap;
  362. #endif
  363. };
  364. struct vki_xen_domctl_ext_vcpucontext_00000009 {
  365. vki_uint32_t vcpu; /* IN */
  366. /* IN for XEN_DOMCTL_set_ext_vcpucontext
  367. * OUT for XEN_DOMCTL_get_ext_vcpucontext */
  368. vki_uint32_t size;
  369. #if defined(__i386__) || defined(__x86_64__)
  370. vki_xen_uint64_aligned_t syscall32_callback_eip;
  371. vki_xen_uint64_aligned_t sysenter_callback_eip;
  372. vki_uint16_t syscall32_callback_cs;
  373. vki_uint16_t sysenter_callback_cs;
  374. vki_uint8_t syscall32_disables_events;
  375. vki_uint8_t sysenter_disables_events;
  376. vki_uint64_t caps;
  377. vki_uint64_t mci_ctl2_bank0;
  378. vki_uint64_t mci_ctl2_bank1;
  379. #endif
  380. };
  381. /* vki_xen_domctl_ext_vcpucontext_0000000a is the same as 00000009 */
  382. struct vki_xen_domctl_vcpuextstate {
  383. vki_uint32_t vcpu;
  384. vki_xen_uint64_aligned_t xfeature_mask;
  385. vki_xen_uint64_aligned_t size;
  386. VKI_XEN_GUEST_HANDLE_64(vki_uint64) buffer;
  387. };
  388. struct vki_xen_domctl_address_size {
  389. vki_uint32_t size;
  390. };
  391. /* vki_xen_domctl_assign_device_00000007 is the same up to version 0x0000000b */
  392. struct vki_xen_domctl_assign_device_00000007 {
  393. vki_uint32_t machine_sbdf; /* machine PCI ID of assigned device */
  394. };
  395. #define VKI_XEN_DOMCTL_DEV_PCI 0
  396. #define VKI_XEN_DOMCTL_DEV_DT 1
  397. struct vki_xen_domctl_assign_device_0000000b {
  398. vki_uint32_t dev; /* XEN_DOMCTL_DEV_* */
  399. union {
  400. struct {
  401. vki_uint32_t machine_sbdf; /* machine PCI ID of assigned device */
  402. } pci;
  403. struct {
  404. vki_uint32_t size; /* Length of the path */
  405. VKI_XEN_GUEST_HANDLE_64(vki_uint8) path; /* path to the device tree node */
  406. } dt;
  407. } u;
  408. /* IN */
  409. //#define XEN_DOMCTL_DEV_RDM_RELAXED 1
  410. vki_uint32_t flag; /* flag of assigned device */
  411. };
  412. struct vki_xen_domctl_debug_op {
  413. vki_uint32_t op; /* IN */
  414. vki_uint32_t vcpu; /* IN */
  415. };
  416. typedef struct vki_xen_domctl_debug_op vki_xen_domctl_debug_op_t;
  417. struct vki_xen_domctl_mem_event_op_00000007 {
  418. vki_uint32_t op; /* IN */
  419. vki_uint32_t mode; /* IN */
  420. vki_uint32_t port; /* OUT */
  421. };
  422. /* only a name change in 4.6 */
  423. typedef struct vki_xen_domctl_mem_event_op_00000007 vki_xen_domctl_vm_event_op_0000000b;
  424. struct vki_xen_domctl_set_access_required {
  425. vki_uint8_t access_required; /* IN */
  426. };
  427. struct vki_xen_domctl_set_max_evtchn {
  428. vki_uint32_t max_port;
  429. };
  430. struct vki_xen_domctl_cacheflush {
  431. /* IN: page range to flush. */
  432. vki_xen_pfn_t start_pfn, nr_pfns;
  433. };
  434. struct vki_xen_domctl_vcpu_msr {
  435. vki_uint32_t index;
  436. vki_uint32_t reserved;
  437. vki_xen_uint64_aligned_t value;
  438. };
  439. typedef struct vki_xen_domctl_vcpu_msr vki_xen_domctl_vcpu_msr_t;
  440. DEFINE_VKI_XEN_GUEST_HANDLE(vki_xen_domctl_vcpu_msr_t);
  441. struct vki_xen_domctl_vcpu_msrs {
  442. vki_uint32_t vcpu;
  443. vki_uint32_t msr_count;
  444. VKI_XEN_GUEST_HANDLE_64(vki_xen_domctl_vcpu_msr_t) msrs;
  445. };
  446. #define VKI_XEN_DOMCTL_MONITOR_OP_ENABLE 0
  447. #define VKI_XEN_DOMCTL_MONITOR_OP_DISABLE 1
  448. #define VKI_XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES 2
  449. #define VKI_XEN_DOMCTL_MONITOR_EVENT_WRITE_CTRLREG 0
  450. #define VKI_XEN_DOMCTL_MONITOR_EVENT_MOV_TO_MSR 1
  451. #define VKI_XEN_DOMCTL_MONITOR_EVENT_SINGLESTEP 2
  452. #define VKI_XEN_DOMCTL_MONITOR_EVENT_SOFTWARE_BREAKPOINT 3
  453. #define VKI_XEN_DOMCTL_MONITOR_EVENT_GUEST_REQUEST 4
  454. struct vki_xen_domctl_monitor_op_0000000b {
  455. vki_uint32_t op; /* vki_xen_DOMCTL_MONITOR_OP_* */
  456. /*
  457. * When used with ENABLE/DISABLE this has to be set to
  458. * the requested vki_xen_DOMCTL_MONITOR_EVENT_* value.
  459. * With GET_CAPABILITIES this field returns a bitmap of
  460. * events supported by the platform, in the format
  461. * (1 << vki_xen_DOMCTL_MONITOR_EVENT_*).
  462. */
  463. vki_uint32_t event;
  464. /*
  465. * Further options when issuing vki_xen_DOMCTL_MONITOR_OP_ENABLE.
  466. */
  467. union {
  468. struct {
  469. /* Which control register */
  470. vki_uint8_t index;
  471. /* Pause vCPU until response */
  472. vki_uint8_t sync;
  473. /* Send event only on a change of value */
  474. vki_uint8_t onchangeonly;
  475. } mov_to_cr;
  476. struct {
  477. /* Enable the capture of an extended set of MSRs */
  478. vki_uint8_t extended_capture;
  479. } mov_to_msr;
  480. struct {
  481. /* Pause vCPU until response */
  482. vki_uint8_t sync;
  483. } guest_request;
  484. } u;
  485. };
  486. struct vki_xen_domctl_monitor_op {
  487. vki_uint32_t op;
  488. #define VKI_XEN_DOMCTL_MONITOR_OP_ENABLE 0
  489. #define VKI_XEN_DOMCTL_MONITOR_OP_DISABLE 1
  490. #define VKI_XEN_DOMCTL_MONITOR_OP_GET_CAPABILITIES 2
  491. #define VKI_XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP 3
  492. vki_uint32_t event;
  493. union {
  494. struct {
  495. vki_uint8_t index;
  496. vki_uint8_t sync;
  497. vki_uint8_t onchangeonly;
  498. } mov_to_cr;
  499. struct {
  500. vki_uint8_t extended_capture;
  501. } mov_to_msr;
  502. struct {
  503. vki_uint8_t sync;
  504. } guest_request;
  505. } u;
  506. };
  507. struct vki_xen_domctl {
  508. vki_uint32_t cmd;
  509. vki_uint32_t interface_version; /* XEN_DOMCTL_INTERFACE_VERSION */
  510. vki_xen_domid_t domain;
  511. union {
  512. struct vki_xen_domctl_createdomain createdomain;
  513. struct vki_xen_domctl_getdomaininfo_00000007 getdomaininfo_00000007;
  514. struct vki_xen_domctl_getdomaininfo_00000008 getdomaininfo_00000008;
  515. struct vki_xen_domctl_getdomaininfo_00000009 getdomaininfo_00000009;
  516. //struct vki_xen_domctl_getmemlist getmemlist;
  517. //struct vki_xen_domctl_getpageframeinfo getpageframeinfo;
  518. //struct vki_xen_domctl_getpageframeinfo2 getpageframeinfo2;
  519. struct vki_xen_domctl_getpageframeinfo3 getpageframeinfo3;
  520. struct vki_xen_domctl_nodeaffinity nodeaffinity;
  521. struct vki_xen_domctl_vcpuaffinity_00000009 vcpuaffinity_00000009;
  522. struct vki_xen_domctl_vcpuaffinity_0000000a vcpuaffinity_0000000a;
  523. struct vki_xen_domctl_shadow_op shadow_op;
  524. struct vki_xen_domctl_max_mem max_mem;
  525. struct vki_xen_domctl_vcpucontext vcpucontext;
  526. struct vki_xen_domctl_getvcpuinfo getvcpuinfo;
  527. struct vki_xen_domctl_max_vcpus max_vcpus;
  528. struct vki_xen_domctl_scheduler_op scheduler_op;
  529. //struct vki_xen_domctl_setdomainhandle setdomainhandle;
  530. //struct vki_xen_domctl_setdebugging setdebugging;
  531. struct vki_xen_domctl_irq_permission irq_permission;
  532. struct vki_xen_domctl_iomem_permission iomem_permission;
  533. struct vki_xen_domctl_ioport_permission ioport_permission;
  534. struct vki_xen_domctl_hypercall_init hypercall_init;
  535. //struct vki_xen_domctl_arch_setup arch_setup;
  536. struct vki_xen_domctl_settimeoffset settimeoffset;
  537. //struct vki_xen_domctl_disable_migrate disable_migrate;
  538. struct vki_xen_domctl_tsc_info_00000007 tsc_info_00000007;
  539. struct vki_xen_domctl_tsc_info_0000000b tsc_info_0000000b;
  540. //struct vki_xen_domctl_real_mode_area real_mode_area;
  541. struct vki_xen_domctl_hvmcontext hvmcontext;
  542. struct vki_xen_domctl_hvmcontext_partial hvmcontext_partial;
  543. struct vki_xen_domctl_address_size address_size;
  544. //struct vki_xen_domctl_sendtrigger sendtrigger;
  545. //struct vki_xen_domctl_get_device_group get_device_group;
  546. struct vki_xen_domctl_assign_device_00000007 assign_device_00000007;
  547. struct vki_xen_domctl_assign_device_0000000b assign_device_0000000b;
  548. //struct vki_xen_domctl_bind_pt_irq bind_pt_irq;
  549. //struct vki_xen_domctl_memory_mapping memory_mapping;
  550. //struct vki_xen_domctl_ioport_mapping ioport_mapping;
  551. struct vki_xen_domctl_pin_mem_cacheattr pin_mem_cacheattr;
  552. struct vki_xen_domctl_ext_vcpucontext_00000008 ext_vcpucontext_00000008;
  553. struct vki_xen_domctl_ext_vcpucontext_00000009 ext_vcpucontext_00000009;
  554. //struct vki_xen_domctl_set_target set_target;
  555. //struct vki_xen_domctl_subscribe subscribe;
  556. struct vki_xen_domctl_debug_op debug_op;
  557. struct vki_xen_domctl_mem_event_op_00000007 mem_event_op_00000007;
  558. vki_xen_domctl_vm_event_op_0000000b vm_event_op_0000000b;
  559. //struct vki_xen_domctl_mem_sharing_op mem_sharing_op;
  560. #if defined(__i386__) || defined(__x86_64__)
  561. struct vki_xen_domctl_cpuid cpuid;
  562. struct vki_xen_domctl_vcpuextstate vcpuextstate;
  563. struct vki_xen_domctl_vcpu_msrs vcpu_msrs;
  564. #endif
  565. struct vki_xen_domctl_set_access_required access_required;
  566. //struct vki_xen_domctl_audit_p2m audit_p2m;
  567. //struct vki_xen_domctl_set_virq_handler set_virq_handler;
  568. struct vki_xen_domctl_set_max_evtchn set_max_evtchn;
  569. //struct vki_xen_domctl_gdbsx_memio gdbsx_guest_memio;
  570. //struct vki_xen_domctl_set_broken_page_p2m set_broken_page_p2m;
  571. struct vki_xen_domctl_cacheflush cacheflush;
  572. //struct vki_xen_domctl_gdbsx_pauseunp_vcpu gdbsx_pauseunp_vcpu;
  573. //struct vki_xen_domctl_gdbsx_domstatus gdbsx_domstatus;
  574. struct vki_xen_domctl_monitor_op_0000000b monitor_op_0000000b;
  575. vki_uint8_t pad[128];
  576. } u;
  577. };
  578. #endif // __VKI_XEN_DOMCTL_H
  579. /*--------------------------------------------------------------------*/
  580. /*--- end ---*/
  581. /*--------------------------------------------------------------------*/