hypercall.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. /******************************************************************************
  2. * hypercall.h
  3. *
  4. * Linux-specific hypervisor handling.
  5. *
  6. * Copyright (c) 2002-2004, K A Fraser
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License version 2
  10. * as published by the Free Software Foundation; or, when distributed
  11. * separately from the Linux kernel or incorporated into other
  12. * software packages, subject to the following license:
  13. *
  14. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15. * of this source file (the "Software"), to deal in the Software without
  16. * restriction, including without limitation the rights to use, copy, modify,
  17. * merge, publish, distribute, sublicense, and/or sell copies of the Software,
  18. * and to permit persons to whom the Software is furnished to do so, subject to
  19. * the following conditions:
  20. *
  21. * The above copyright notice and this permission notice shall be included in
  22. * all copies or substantial portions of the Software.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  26. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  27. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  28. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  29. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  30. * IN THE SOFTWARE.
  31. */
  32. #ifndef _ASM_X86_XEN_HYPERCALL_H
  33. #define _ASM_X86_XEN_HYPERCALL_H
  34. #include <linux/kernel.h>
  35. #include <linux/spinlock.h>
  36. #include <linux/errno.h>
  37. #include <linux/string.h>
  38. #include <linux/types.h>
  39. #include <trace/events/xen.h>
  40. #include <asm/page.h>
  41. #include <asm/pgtable.h>
  42. #include <asm/smap.h>
  43. #include <xen/interface/xen.h>
  44. #include <xen/interface/sched.h>
  45. #include <xen/interface/physdev.h>
  46. #include <xen/interface/platform.h>
  47. #include <xen/interface/xen-mca.h>
  48. struct xen_dm_op_buf;
  49. /*
  50. * The hypercall asms have to meet several constraints:
  51. * - Work on 32- and 64-bit.
  52. * The two architectures put their arguments in different sets of
  53. * registers.
  54. *
  55. * - Work around asm syntax quirks
  56. * It isn't possible to specify one of the rNN registers in a
  57. * constraint, so we use explicit register variables to get the
  58. * args into the right place.
  59. *
  60. * - Mark all registers as potentially clobbered
  61. * Even unused parameters can be clobbered by the hypervisor, so we
  62. * need to make sure gcc knows it.
  63. *
  64. * - Avoid compiler bugs.
  65. * This is the tricky part. Because x86_32 has such a constrained
  66. * register set, gcc versions below 4.3 have trouble generating
  67. * code when all the arg registers and memory are trashed by the
  68. * asm. There are syntactically simpler ways of achieving the
  69. * semantics below, but they cause the compiler to crash.
  70. *
  71. * The only combination I found which works is:
  72. * - assign the __argX variables first
  73. * - list all actually used parameters as "+r" (__argX)
  74. * - clobber the rest
  75. *
  76. * The result certainly isn't pretty, and it really shows up cpp's
  77. * weakness as as macro language. Sorry. (But let's just give thanks
  78. * there aren't more than 5 arguments...)
  79. */
  80. extern struct { char _entry[32]; } hypercall_page[];
  81. #define __HYPERCALL "call hypercall_page+%c[offset]"
  82. #define __HYPERCALL_ENTRY(x) \
  83. [offset] "i" (__HYPERVISOR_##x * sizeof(hypercall_page[0]))
  84. #ifdef CONFIG_X86_32
  85. #define __HYPERCALL_RETREG "eax"
  86. #define __HYPERCALL_ARG1REG "ebx"
  87. #define __HYPERCALL_ARG2REG "ecx"
  88. #define __HYPERCALL_ARG3REG "edx"
  89. #define __HYPERCALL_ARG4REG "esi"
  90. #define __HYPERCALL_ARG5REG "edi"
  91. #else
  92. #define __HYPERCALL_RETREG "rax"
  93. #define __HYPERCALL_ARG1REG "rdi"
  94. #define __HYPERCALL_ARG2REG "rsi"
  95. #define __HYPERCALL_ARG3REG "rdx"
  96. #define __HYPERCALL_ARG4REG "r10"
  97. #define __HYPERCALL_ARG5REG "r8"
  98. #endif
  99. #define __HYPERCALL_DECLS \
  100. register unsigned long __res asm(__HYPERCALL_RETREG); \
  101. register unsigned long __arg1 asm(__HYPERCALL_ARG1REG) = __arg1; \
  102. register unsigned long __arg2 asm(__HYPERCALL_ARG2REG) = __arg2; \
  103. register unsigned long __arg3 asm(__HYPERCALL_ARG3REG) = __arg3; \
  104. register unsigned long __arg4 asm(__HYPERCALL_ARG4REG) = __arg4; \
  105. register unsigned long __arg5 asm(__HYPERCALL_ARG5REG) = __arg5; \
  106. register void *__sp asm(_ASM_SP);
  107. #define __HYPERCALL_0PARAM "=r" (__res), "+r" (__sp)
  108. #define __HYPERCALL_1PARAM __HYPERCALL_0PARAM, "+r" (__arg1)
  109. #define __HYPERCALL_2PARAM __HYPERCALL_1PARAM, "+r" (__arg2)
  110. #define __HYPERCALL_3PARAM __HYPERCALL_2PARAM, "+r" (__arg3)
  111. #define __HYPERCALL_4PARAM __HYPERCALL_3PARAM, "+r" (__arg4)
  112. #define __HYPERCALL_5PARAM __HYPERCALL_4PARAM, "+r" (__arg5)
  113. #define __HYPERCALL_0ARG()
  114. #define __HYPERCALL_1ARG(a1) \
  115. __HYPERCALL_0ARG() __arg1 = (unsigned long)(a1);
  116. #define __HYPERCALL_2ARG(a1,a2) \
  117. __HYPERCALL_1ARG(a1) __arg2 = (unsigned long)(a2);
  118. #define __HYPERCALL_3ARG(a1,a2,a3) \
  119. __HYPERCALL_2ARG(a1,a2) __arg3 = (unsigned long)(a3);
  120. #define __HYPERCALL_4ARG(a1,a2,a3,a4) \
  121. __HYPERCALL_3ARG(a1,a2,a3) __arg4 = (unsigned long)(a4);
  122. #define __HYPERCALL_5ARG(a1,a2,a3,a4,a5) \
  123. __HYPERCALL_4ARG(a1,a2,a3,a4) __arg5 = (unsigned long)(a5);
  124. #define __HYPERCALL_CLOBBER5 "memory"
  125. #define __HYPERCALL_CLOBBER4 __HYPERCALL_CLOBBER5, __HYPERCALL_ARG5REG
  126. #define __HYPERCALL_CLOBBER3 __HYPERCALL_CLOBBER4, __HYPERCALL_ARG4REG
  127. #define __HYPERCALL_CLOBBER2 __HYPERCALL_CLOBBER3, __HYPERCALL_ARG3REG
  128. #define __HYPERCALL_CLOBBER1 __HYPERCALL_CLOBBER2, __HYPERCALL_ARG2REG
  129. #define __HYPERCALL_CLOBBER0 __HYPERCALL_CLOBBER1, __HYPERCALL_ARG1REG
  130. #define _hypercall0(type, name) \
  131. ({ \
  132. __HYPERCALL_DECLS; \
  133. __HYPERCALL_0ARG(); \
  134. asm volatile (__HYPERCALL \
  135. : __HYPERCALL_0PARAM \
  136. : __HYPERCALL_ENTRY(name) \
  137. : __HYPERCALL_CLOBBER0); \
  138. (type)__res; \
  139. })
  140. #define _hypercall1(type, name, a1) \
  141. ({ \
  142. __HYPERCALL_DECLS; \
  143. __HYPERCALL_1ARG(a1); \
  144. asm volatile (__HYPERCALL \
  145. : __HYPERCALL_1PARAM \
  146. : __HYPERCALL_ENTRY(name) \
  147. : __HYPERCALL_CLOBBER1); \
  148. (type)__res; \
  149. })
  150. #define _hypercall2(type, name, a1, a2) \
  151. ({ \
  152. __HYPERCALL_DECLS; \
  153. __HYPERCALL_2ARG(a1, a2); \
  154. asm volatile (__HYPERCALL \
  155. : __HYPERCALL_2PARAM \
  156. : __HYPERCALL_ENTRY(name) \
  157. : __HYPERCALL_CLOBBER2); \
  158. (type)__res; \
  159. })
  160. #define _hypercall3(type, name, a1, a2, a3) \
  161. ({ \
  162. __HYPERCALL_DECLS; \
  163. __HYPERCALL_3ARG(a1, a2, a3); \
  164. asm volatile (__HYPERCALL \
  165. : __HYPERCALL_3PARAM \
  166. : __HYPERCALL_ENTRY(name) \
  167. : __HYPERCALL_CLOBBER3); \
  168. (type)__res; \
  169. })
  170. #define _hypercall4(type, name, a1, a2, a3, a4) \
  171. ({ \
  172. __HYPERCALL_DECLS; \
  173. __HYPERCALL_4ARG(a1, a2, a3, a4); \
  174. asm volatile (__HYPERCALL \
  175. : __HYPERCALL_4PARAM \
  176. : __HYPERCALL_ENTRY(name) \
  177. : __HYPERCALL_CLOBBER4); \
  178. (type)__res; \
  179. })
  180. #define _hypercall5(type, name, a1, a2, a3, a4, a5) \
  181. ({ \
  182. __HYPERCALL_DECLS; \
  183. __HYPERCALL_5ARG(a1, a2, a3, a4, a5); \
  184. asm volatile (__HYPERCALL \
  185. : __HYPERCALL_5PARAM \
  186. : __HYPERCALL_ENTRY(name) \
  187. : __HYPERCALL_CLOBBER5); \
  188. (type)__res; \
  189. })
  190. static inline long
  191. privcmd_call(unsigned call,
  192. unsigned long a1, unsigned long a2,
  193. unsigned long a3, unsigned long a4,
  194. unsigned long a5)
  195. {
  196. __HYPERCALL_DECLS;
  197. __HYPERCALL_5ARG(a1, a2, a3, a4, a5);
  198. stac();
  199. asm volatile("call *%[call]"
  200. : __HYPERCALL_5PARAM
  201. : [call] "a" (&hypercall_page[call])
  202. : __HYPERCALL_CLOBBER5);
  203. clac();
  204. return (long)__res;
  205. }
  206. static inline int
  207. HYPERVISOR_set_trap_table(struct trap_info *table)
  208. {
  209. return _hypercall1(int, set_trap_table, table);
  210. }
  211. static inline int
  212. HYPERVISOR_mmu_update(struct mmu_update *req, int count,
  213. int *success_count, domid_t domid)
  214. {
  215. return _hypercall4(int, mmu_update, req, count, success_count, domid);
  216. }
  217. static inline int
  218. HYPERVISOR_mmuext_op(struct mmuext_op *op, int count,
  219. int *success_count, domid_t domid)
  220. {
  221. return _hypercall4(int, mmuext_op, op, count, success_count, domid);
  222. }
  223. static inline int
  224. HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
  225. {
  226. return _hypercall2(int, set_gdt, frame_list, entries);
  227. }
  228. static inline int
  229. HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
  230. {
  231. return _hypercall2(int, stack_switch, ss, esp);
  232. }
  233. #ifdef CONFIG_X86_32
  234. static inline int
  235. HYPERVISOR_set_callbacks(unsigned long event_selector,
  236. unsigned long event_address,
  237. unsigned long failsafe_selector,
  238. unsigned long failsafe_address)
  239. {
  240. return _hypercall4(int, set_callbacks,
  241. event_selector, event_address,
  242. failsafe_selector, failsafe_address);
  243. }
  244. #else /* CONFIG_X86_64 */
  245. static inline int
  246. HYPERVISOR_set_callbacks(unsigned long event_address,
  247. unsigned long failsafe_address,
  248. unsigned long syscall_address)
  249. {
  250. return _hypercall3(int, set_callbacks,
  251. event_address, failsafe_address,
  252. syscall_address);
  253. }
  254. #endif /* CONFIG_X86_{32,64} */
  255. static inline int
  256. HYPERVISOR_callback_op(int cmd, void *arg)
  257. {
  258. return _hypercall2(int, callback_op, cmd, arg);
  259. }
  260. static inline int
  261. HYPERVISOR_fpu_taskswitch(int set)
  262. {
  263. return _hypercall1(int, fpu_taskswitch, set);
  264. }
  265. static inline int
  266. HYPERVISOR_sched_op(int cmd, void *arg)
  267. {
  268. return _hypercall2(int, sched_op, cmd, arg);
  269. }
  270. static inline long
  271. HYPERVISOR_set_timer_op(u64 timeout)
  272. {
  273. unsigned long timeout_hi = (unsigned long)(timeout>>32);
  274. unsigned long timeout_lo = (unsigned long)timeout;
  275. return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
  276. }
  277. static inline int
  278. HYPERVISOR_mca(struct xen_mc *mc_op)
  279. {
  280. mc_op->interface_version = XEN_MCA_INTERFACE_VERSION;
  281. return _hypercall1(int, mca, mc_op);
  282. }
  283. static inline int
  284. HYPERVISOR_platform_op(struct xen_platform_op *op)
  285. {
  286. op->interface_version = XENPF_INTERFACE_VERSION;
  287. return _hypercall1(int, platform_op, op);
  288. }
  289. static inline int
  290. HYPERVISOR_set_debugreg(int reg, unsigned long value)
  291. {
  292. return _hypercall2(int, set_debugreg, reg, value);
  293. }
  294. static inline unsigned long
  295. HYPERVISOR_get_debugreg(int reg)
  296. {
  297. return _hypercall1(unsigned long, get_debugreg, reg);
  298. }
  299. static inline int
  300. HYPERVISOR_update_descriptor(u64 ma, u64 desc)
  301. {
  302. if (sizeof(u64) == sizeof(long))
  303. return _hypercall2(int, update_descriptor, ma, desc);
  304. return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
  305. }
  306. static inline long
  307. HYPERVISOR_memory_op(unsigned int cmd, void *arg)
  308. {
  309. return _hypercall2(long, memory_op, cmd, arg);
  310. }
  311. static inline int
  312. HYPERVISOR_multicall(void *call_list, uint32_t nr_calls)
  313. {
  314. return _hypercall2(int, multicall, call_list, nr_calls);
  315. }
  316. static inline int
  317. HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
  318. unsigned long flags)
  319. {
  320. if (sizeof(new_val) == sizeof(long))
  321. return _hypercall3(int, update_va_mapping, va,
  322. new_val.pte, flags);
  323. else
  324. return _hypercall4(int, update_va_mapping, va,
  325. new_val.pte, new_val.pte >> 32, flags);
  326. }
  327. extern int __must_check xen_event_channel_op_compat(int, void *);
  328. static inline int
  329. HYPERVISOR_event_channel_op(int cmd, void *arg)
  330. {
  331. int rc = _hypercall2(int, event_channel_op, cmd, arg);
  332. if (unlikely(rc == -ENOSYS))
  333. rc = xen_event_channel_op_compat(cmd, arg);
  334. return rc;
  335. }
  336. static inline int
  337. HYPERVISOR_xen_version(int cmd, void *arg)
  338. {
  339. return _hypercall2(int, xen_version, cmd, arg);
  340. }
  341. static inline int
  342. HYPERVISOR_console_io(int cmd, int count, char *str)
  343. {
  344. return _hypercall3(int, console_io, cmd, count, str);
  345. }
  346. extern int __must_check xen_physdev_op_compat(int, void *);
  347. static inline int
  348. HYPERVISOR_physdev_op(int cmd, void *arg)
  349. {
  350. int rc = _hypercall2(int, physdev_op, cmd, arg);
  351. if (unlikely(rc == -ENOSYS))
  352. rc = xen_physdev_op_compat(cmd, arg);
  353. return rc;
  354. }
  355. static inline int
  356. HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
  357. {
  358. return _hypercall3(int, grant_table_op, cmd, uop, count);
  359. }
  360. static inline int
  361. HYPERVISOR_update_va_mapping_otherdomain(unsigned long va, pte_t new_val,
  362. unsigned long flags, domid_t domid)
  363. {
  364. if (sizeof(new_val) == sizeof(long))
  365. return _hypercall4(int, update_va_mapping_otherdomain, va,
  366. new_val.pte, flags, domid);
  367. else
  368. return _hypercall5(int, update_va_mapping_otherdomain, va,
  369. new_val.pte, new_val.pte >> 32,
  370. flags, domid);
  371. }
  372. static inline int
  373. HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
  374. {
  375. return _hypercall2(int, vm_assist, cmd, type);
  376. }
  377. static inline int
  378. HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
  379. {
  380. return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
  381. }
  382. #ifdef CONFIG_X86_64
  383. static inline int
  384. HYPERVISOR_set_segment_base(int reg, unsigned long value)
  385. {
  386. return _hypercall2(int, set_segment_base, reg, value);
  387. }
  388. #endif
  389. static inline int
  390. HYPERVISOR_suspend(unsigned long start_info_mfn)
  391. {
  392. struct sched_shutdown r = { .reason = SHUTDOWN_suspend };
  393. /*
  394. * For a PV guest the tools require that the start_info mfn be
  395. * present in rdx/edx when the hypercall is made. Per the
  396. * hypercall calling convention this is the third hypercall
  397. * argument, which is start_info_mfn here.
  398. */
  399. return _hypercall3(int, sched_op, SCHEDOP_shutdown, &r, start_info_mfn);
  400. }
  401. static inline int
  402. HYPERVISOR_nmi_op(unsigned long op, unsigned long arg)
  403. {
  404. return _hypercall2(int, nmi_op, op, arg);
  405. }
  406. static inline unsigned long __must_check
  407. HYPERVISOR_hvm_op(int op, void *arg)
  408. {
  409. return _hypercall2(unsigned long, hvm_op, op, arg);
  410. }
  411. static inline int
  412. HYPERVISOR_tmem_op(
  413. struct tmem_op *op)
  414. {
  415. return _hypercall1(int, tmem_op, op);
  416. }
  417. static inline int
  418. HYPERVISOR_xenpmu_op(unsigned int op, void *arg)
  419. {
  420. return _hypercall2(int, xenpmu_op, op, arg);
  421. }
  422. static inline int
  423. HYPERVISOR_dm_op(
  424. domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)
  425. {
  426. int ret;
  427. stac();
  428. ret = _hypercall3(int, dm_op, dom, nr_bufs, bufs);
  429. clac();
  430. return ret;
  431. }
  432. static inline void
  433. MULTI_fpu_taskswitch(struct multicall_entry *mcl, int set)
  434. {
  435. mcl->op = __HYPERVISOR_fpu_taskswitch;
  436. mcl->args[0] = set;
  437. trace_xen_mc_entry(mcl, 1);
  438. }
  439. static inline void
  440. MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
  441. pte_t new_val, unsigned long flags)
  442. {
  443. mcl->op = __HYPERVISOR_update_va_mapping;
  444. mcl->args[0] = va;
  445. if (sizeof(new_val) == sizeof(long)) {
  446. mcl->args[1] = new_val.pte;
  447. mcl->args[2] = flags;
  448. } else {
  449. mcl->args[1] = new_val.pte;
  450. mcl->args[2] = new_val.pte >> 32;
  451. mcl->args[3] = flags;
  452. }
  453. trace_xen_mc_entry(mcl, sizeof(new_val) == sizeof(long) ? 3 : 4);
  454. }
  455. static inline void
  456. MULTI_grant_table_op(struct multicall_entry *mcl, unsigned int cmd,
  457. void *uop, unsigned int count)
  458. {
  459. mcl->op = __HYPERVISOR_grant_table_op;
  460. mcl->args[0] = cmd;
  461. mcl->args[1] = (unsigned long)uop;
  462. mcl->args[2] = count;
  463. trace_xen_mc_entry(mcl, 3);
  464. }
  465. static inline void
  466. MULTI_update_va_mapping_otherdomain(struct multicall_entry *mcl, unsigned long va,
  467. pte_t new_val, unsigned long flags,
  468. domid_t domid)
  469. {
  470. mcl->op = __HYPERVISOR_update_va_mapping_otherdomain;
  471. mcl->args[0] = va;
  472. if (sizeof(new_val) == sizeof(long)) {
  473. mcl->args[1] = new_val.pte;
  474. mcl->args[2] = flags;
  475. mcl->args[3] = domid;
  476. } else {
  477. mcl->args[1] = new_val.pte;
  478. mcl->args[2] = new_val.pte >> 32;
  479. mcl->args[3] = flags;
  480. mcl->args[4] = domid;
  481. }
  482. trace_xen_mc_entry(mcl, sizeof(new_val) == sizeof(long) ? 4 : 5);
  483. }
  484. static inline void
  485. MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
  486. struct desc_struct desc)
  487. {
  488. mcl->op = __HYPERVISOR_update_descriptor;
  489. if (sizeof(maddr) == sizeof(long)) {
  490. mcl->args[0] = maddr;
  491. mcl->args[1] = *(unsigned long *)&desc;
  492. } else {
  493. u32 *p = (u32 *)&desc;
  494. mcl->args[0] = maddr;
  495. mcl->args[1] = maddr >> 32;
  496. mcl->args[2] = *p++;
  497. mcl->args[3] = *p;
  498. }
  499. trace_xen_mc_entry(mcl, sizeof(maddr) == sizeof(long) ? 2 : 4);
  500. }
  501. static inline void
  502. MULTI_memory_op(struct multicall_entry *mcl, unsigned int cmd, void *arg)
  503. {
  504. mcl->op = __HYPERVISOR_memory_op;
  505. mcl->args[0] = cmd;
  506. mcl->args[1] = (unsigned long)arg;
  507. trace_xen_mc_entry(mcl, 2);
  508. }
  509. static inline void
  510. MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
  511. int count, int *success_count, domid_t domid)
  512. {
  513. mcl->op = __HYPERVISOR_mmu_update;
  514. mcl->args[0] = (unsigned long)req;
  515. mcl->args[1] = count;
  516. mcl->args[2] = (unsigned long)success_count;
  517. mcl->args[3] = domid;
  518. trace_xen_mc_entry(mcl, 4);
  519. }
  520. static inline void
  521. MULTI_mmuext_op(struct multicall_entry *mcl, struct mmuext_op *op, int count,
  522. int *success_count, domid_t domid)
  523. {
  524. mcl->op = __HYPERVISOR_mmuext_op;
  525. mcl->args[0] = (unsigned long)op;
  526. mcl->args[1] = count;
  527. mcl->args[2] = (unsigned long)success_count;
  528. mcl->args[3] = domid;
  529. trace_xen_mc_entry(mcl, 4);
  530. }
  531. static inline void
  532. MULTI_set_gdt(struct multicall_entry *mcl, unsigned long *frames, int entries)
  533. {
  534. mcl->op = __HYPERVISOR_set_gdt;
  535. mcl->args[0] = (unsigned long)frames;
  536. mcl->args[1] = entries;
  537. trace_xen_mc_entry(mcl, 2);
  538. }
  539. static inline void
  540. MULTI_stack_switch(struct multicall_entry *mcl,
  541. unsigned long ss, unsigned long esp)
  542. {
  543. mcl->op = __HYPERVISOR_stack_switch;
  544. mcl->args[0] = ss;
  545. mcl->args[1] = esp;
  546. trace_xen_mc_entry(mcl, 2);
  547. }
  548. #endif /* _ASM_X86_XEN_HYPERCALL_H */