hypercall.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  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. #define __HYPERCALL_0PARAM "=r" (__res), ASM_CALL_CONSTRAINT
  107. #define __HYPERCALL_1PARAM __HYPERCALL_0PARAM, "+r" (__arg1)
  108. #define __HYPERCALL_2PARAM __HYPERCALL_1PARAM, "+r" (__arg2)
  109. #define __HYPERCALL_3PARAM __HYPERCALL_2PARAM, "+r" (__arg3)
  110. #define __HYPERCALL_4PARAM __HYPERCALL_3PARAM, "+r" (__arg4)
  111. #define __HYPERCALL_5PARAM __HYPERCALL_4PARAM, "+r" (__arg5)
  112. #define __HYPERCALL_0ARG()
  113. #define __HYPERCALL_1ARG(a1) \
  114. __HYPERCALL_0ARG() __arg1 = (unsigned long)(a1);
  115. #define __HYPERCALL_2ARG(a1,a2) \
  116. __HYPERCALL_1ARG(a1) __arg2 = (unsigned long)(a2);
  117. #define __HYPERCALL_3ARG(a1,a2,a3) \
  118. __HYPERCALL_2ARG(a1,a2) __arg3 = (unsigned long)(a3);
  119. #define __HYPERCALL_4ARG(a1,a2,a3,a4) \
  120. __HYPERCALL_3ARG(a1,a2,a3) __arg4 = (unsigned long)(a4);
  121. #define __HYPERCALL_5ARG(a1,a2,a3,a4,a5) \
  122. __HYPERCALL_4ARG(a1,a2,a3,a4) __arg5 = (unsigned long)(a5);
  123. #define __HYPERCALL_CLOBBER5 "memory"
  124. #define __HYPERCALL_CLOBBER4 __HYPERCALL_CLOBBER5, __HYPERCALL_ARG5REG
  125. #define __HYPERCALL_CLOBBER3 __HYPERCALL_CLOBBER4, __HYPERCALL_ARG4REG
  126. #define __HYPERCALL_CLOBBER2 __HYPERCALL_CLOBBER3, __HYPERCALL_ARG3REG
  127. #define __HYPERCALL_CLOBBER1 __HYPERCALL_CLOBBER2, __HYPERCALL_ARG2REG
  128. #define __HYPERCALL_CLOBBER0 __HYPERCALL_CLOBBER1, __HYPERCALL_ARG1REG
  129. #define _hypercall0(type, name) \
  130. ({ \
  131. __HYPERCALL_DECLS; \
  132. __HYPERCALL_0ARG(); \
  133. asm volatile (__HYPERCALL \
  134. : __HYPERCALL_0PARAM \
  135. : __HYPERCALL_ENTRY(name) \
  136. : __HYPERCALL_CLOBBER0); \
  137. (type)__res; \
  138. })
  139. #define _hypercall1(type, name, a1) \
  140. ({ \
  141. __HYPERCALL_DECLS; \
  142. __HYPERCALL_1ARG(a1); \
  143. asm volatile (__HYPERCALL \
  144. : __HYPERCALL_1PARAM \
  145. : __HYPERCALL_ENTRY(name) \
  146. : __HYPERCALL_CLOBBER1); \
  147. (type)__res; \
  148. })
  149. #define _hypercall2(type, name, a1, a2) \
  150. ({ \
  151. __HYPERCALL_DECLS; \
  152. __HYPERCALL_2ARG(a1, a2); \
  153. asm volatile (__HYPERCALL \
  154. : __HYPERCALL_2PARAM \
  155. : __HYPERCALL_ENTRY(name) \
  156. : __HYPERCALL_CLOBBER2); \
  157. (type)__res; \
  158. })
  159. #define _hypercall3(type, name, a1, a2, a3) \
  160. ({ \
  161. __HYPERCALL_DECLS; \
  162. __HYPERCALL_3ARG(a1, a2, a3); \
  163. asm volatile (__HYPERCALL \
  164. : __HYPERCALL_3PARAM \
  165. : __HYPERCALL_ENTRY(name) \
  166. : __HYPERCALL_CLOBBER3); \
  167. (type)__res; \
  168. })
  169. #define _hypercall4(type, name, a1, a2, a3, a4) \
  170. ({ \
  171. __HYPERCALL_DECLS; \
  172. __HYPERCALL_4ARG(a1, a2, a3, a4); \
  173. asm volatile (__HYPERCALL \
  174. : __HYPERCALL_4PARAM \
  175. : __HYPERCALL_ENTRY(name) \
  176. : __HYPERCALL_CLOBBER4); \
  177. (type)__res; \
  178. })
  179. #define _hypercall5(type, name, a1, a2, a3, a4, a5) \
  180. ({ \
  181. __HYPERCALL_DECLS; \
  182. __HYPERCALL_5ARG(a1, a2, a3, a4, a5); \
  183. asm volatile (__HYPERCALL \
  184. : __HYPERCALL_5PARAM \
  185. : __HYPERCALL_ENTRY(name) \
  186. : __HYPERCALL_CLOBBER5); \
  187. (type)__res; \
  188. })
  189. static inline long
  190. privcmd_call(unsigned call,
  191. unsigned long a1, unsigned long a2,
  192. unsigned long a3, unsigned long a4,
  193. unsigned long a5)
  194. {
  195. __HYPERCALL_DECLS;
  196. __HYPERCALL_5ARG(a1, a2, a3, a4, a5);
  197. stac();
  198. asm volatile("call *%[call]"
  199. : __HYPERCALL_5PARAM
  200. : [call] "a" (&hypercall_page[call])
  201. : __HYPERCALL_CLOBBER5);
  202. clac();
  203. return (long)__res;
  204. }
  205. static inline int
  206. HYPERVISOR_set_trap_table(struct trap_info *table)
  207. {
  208. return _hypercall1(int, set_trap_table, table);
  209. }
  210. static inline int
  211. HYPERVISOR_mmu_update(struct mmu_update *req, int count,
  212. int *success_count, domid_t domid)
  213. {
  214. return _hypercall4(int, mmu_update, req, count, success_count, domid);
  215. }
  216. static inline int
  217. HYPERVISOR_mmuext_op(struct mmuext_op *op, int count,
  218. int *success_count, domid_t domid)
  219. {
  220. return _hypercall4(int, mmuext_op, op, count, success_count, domid);
  221. }
  222. static inline int
  223. HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
  224. {
  225. return _hypercall2(int, set_gdt, frame_list, entries);
  226. }
  227. static inline int
  228. HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
  229. {
  230. return _hypercall2(int, stack_switch, ss, esp);
  231. }
  232. #ifdef CONFIG_X86_32
  233. static inline int
  234. HYPERVISOR_set_callbacks(unsigned long event_selector,
  235. unsigned long event_address,
  236. unsigned long failsafe_selector,
  237. unsigned long failsafe_address)
  238. {
  239. return _hypercall4(int, set_callbacks,
  240. event_selector, event_address,
  241. failsafe_selector, failsafe_address);
  242. }
  243. #else /* CONFIG_X86_64 */
  244. static inline int
  245. HYPERVISOR_set_callbacks(unsigned long event_address,
  246. unsigned long failsafe_address,
  247. unsigned long syscall_address)
  248. {
  249. return _hypercall3(int, set_callbacks,
  250. event_address, failsafe_address,
  251. syscall_address);
  252. }
  253. #endif /* CONFIG_X86_{32,64} */
  254. static inline int
  255. HYPERVISOR_callback_op(int cmd, void *arg)
  256. {
  257. return _hypercall2(int, callback_op, cmd, arg);
  258. }
  259. static inline int
  260. HYPERVISOR_fpu_taskswitch(int set)
  261. {
  262. return _hypercall1(int, fpu_taskswitch, set);
  263. }
  264. static inline int
  265. HYPERVISOR_sched_op(int cmd, void *arg)
  266. {
  267. return _hypercall2(int, sched_op, cmd, arg);
  268. }
  269. static inline long
  270. HYPERVISOR_set_timer_op(u64 timeout)
  271. {
  272. unsigned long timeout_hi = (unsigned long)(timeout>>32);
  273. unsigned long timeout_lo = (unsigned long)timeout;
  274. return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
  275. }
  276. static inline int
  277. HYPERVISOR_mca(struct xen_mc *mc_op)
  278. {
  279. mc_op->interface_version = XEN_MCA_INTERFACE_VERSION;
  280. return _hypercall1(int, mca, mc_op);
  281. }
  282. static inline int
  283. HYPERVISOR_platform_op(struct xen_platform_op *op)
  284. {
  285. op->interface_version = XENPF_INTERFACE_VERSION;
  286. return _hypercall1(int, platform_op, op);
  287. }
  288. static inline int
  289. HYPERVISOR_set_debugreg(int reg, unsigned long value)
  290. {
  291. return _hypercall2(int, set_debugreg, reg, value);
  292. }
  293. static inline unsigned long
  294. HYPERVISOR_get_debugreg(int reg)
  295. {
  296. return _hypercall1(unsigned long, get_debugreg, reg);
  297. }
  298. static inline int
  299. HYPERVISOR_update_descriptor(u64 ma, u64 desc)
  300. {
  301. if (sizeof(u64) == sizeof(long))
  302. return _hypercall2(int, update_descriptor, ma, desc);
  303. return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
  304. }
  305. static inline long
  306. HYPERVISOR_memory_op(unsigned int cmd, void *arg)
  307. {
  308. return _hypercall2(long, memory_op, cmd, arg);
  309. }
  310. static inline int
  311. HYPERVISOR_multicall(void *call_list, uint32_t nr_calls)
  312. {
  313. return _hypercall2(int, multicall, call_list, nr_calls);
  314. }
  315. static inline int
  316. HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val,
  317. unsigned long flags)
  318. {
  319. if (sizeof(new_val) == sizeof(long))
  320. return _hypercall3(int, update_va_mapping, va,
  321. new_val.pte, flags);
  322. else
  323. return _hypercall4(int, update_va_mapping, va,
  324. new_val.pte, new_val.pte >> 32, flags);
  325. }
  326. extern int __must_check xen_event_channel_op_compat(int, void *);
  327. static inline int
  328. HYPERVISOR_event_channel_op(int cmd, void *arg)
  329. {
  330. int rc = _hypercall2(int, event_channel_op, cmd, arg);
  331. if (unlikely(rc == -ENOSYS))
  332. rc = xen_event_channel_op_compat(cmd, arg);
  333. return rc;
  334. }
  335. static inline int
  336. HYPERVISOR_xen_version(int cmd, void *arg)
  337. {
  338. return _hypercall2(int, xen_version, cmd, arg);
  339. }
  340. static inline int
  341. HYPERVISOR_console_io(int cmd, int count, char *str)
  342. {
  343. return _hypercall3(int, console_io, cmd, count, str);
  344. }
  345. extern int __must_check xen_physdev_op_compat(int, void *);
  346. static inline int
  347. HYPERVISOR_physdev_op(int cmd, void *arg)
  348. {
  349. int rc = _hypercall2(int, physdev_op, cmd, arg);
  350. if (unlikely(rc == -ENOSYS))
  351. rc = xen_physdev_op_compat(cmd, arg);
  352. return rc;
  353. }
  354. static inline int
  355. HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count)
  356. {
  357. return _hypercall3(int, grant_table_op, cmd, uop, count);
  358. }
  359. static inline int
  360. HYPERVISOR_update_va_mapping_otherdomain(unsigned long va, pte_t new_val,
  361. unsigned long flags, domid_t domid)
  362. {
  363. if (sizeof(new_val) == sizeof(long))
  364. return _hypercall4(int, update_va_mapping_otherdomain, va,
  365. new_val.pte, flags, domid);
  366. else
  367. return _hypercall5(int, update_va_mapping_otherdomain, va,
  368. new_val.pte, new_val.pte >> 32,
  369. flags, domid);
  370. }
  371. static inline int
  372. HYPERVISOR_vm_assist(unsigned int cmd, unsigned int type)
  373. {
  374. return _hypercall2(int, vm_assist, cmd, type);
  375. }
  376. static inline int
  377. HYPERVISOR_vcpu_op(int cmd, int vcpuid, void *extra_args)
  378. {
  379. return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
  380. }
  381. #ifdef CONFIG_X86_64
  382. static inline int
  383. HYPERVISOR_set_segment_base(int reg, unsigned long value)
  384. {
  385. return _hypercall2(int, set_segment_base, reg, value);
  386. }
  387. #endif
  388. static inline int
  389. HYPERVISOR_suspend(unsigned long start_info_mfn)
  390. {
  391. struct sched_shutdown r = { .reason = SHUTDOWN_suspend };
  392. /*
  393. * For a PV guest the tools require that the start_info mfn be
  394. * present in rdx/edx when the hypercall is made. Per the
  395. * hypercall calling convention this is the third hypercall
  396. * argument, which is start_info_mfn here.
  397. */
  398. return _hypercall3(int, sched_op, SCHEDOP_shutdown, &r, start_info_mfn);
  399. }
  400. static inline int
  401. HYPERVISOR_nmi_op(unsigned long op, unsigned long arg)
  402. {
  403. return _hypercall2(int, nmi_op, op, arg);
  404. }
  405. static inline unsigned long __must_check
  406. HYPERVISOR_hvm_op(int op, void *arg)
  407. {
  408. return _hypercall2(unsigned long, hvm_op, op, arg);
  409. }
  410. static inline int
  411. HYPERVISOR_tmem_op(
  412. struct tmem_op *op)
  413. {
  414. return _hypercall1(int, tmem_op, op);
  415. }
  416. static inline int
  417. HYPERVISOR_xenpmu_op(unsigned int op, void *arg)
  418. {
  419. return _hypercall2(int, xenpmu_op, op, arg);
  420. }
  421. static inline int
  422. HYPERVISOR_dm_op(
  423. domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)
  424. {
  425. int ret;
  426. stac();
  427. ret = _hypercall3(int, dm_op, dom, nr_bufs, bufs);
  428. clac();
  429. return ret;
  430. }
  431. static inline void
  432. MULTI_fpu_taskswitch(struct multicall_entry *mcl, int set)
  433. {
  434. mcl->op = __HYPERVISOR_fpu_taskswitch;
  435. mcl->args[0] = set;
  436. trace_xen_mc_entry(mcl, 1);
  437. }
  438. static inline void
  439. MULTI_update_va_mapping(struct multicall_entry *mcl, unsigned long va,
  440. pte_t new_val, unsigned long flags)
  441. {
  442. mcl->op = __HYPERVISOR_update_va_mapping;
  443. mcl->args[0] = va;
  444. if (sizeof(new_val) == sizeof(long)) {
  445. mcl->args[1] = new_val.pte;
  446. mcl->args[2] = flags;
  447. } else {
  448. mcl->args[1] = new_val.pte;
  449. mcl->args[2] = new_val.pte >> 32;
  450. mcl->args[3] = flags;
  451. }
  452. trace_xen_mc_entry(mcl, sizeof(new_val) == sizeof(long) ? 3 : 4);
  453. }
  454. static inline void
  455. MULTI_grant_table_op(struct multicall_entry *mcl, unsigned int cmd,
  456. void *uop, unsigned int count)
  457. {
  458. mcl->op = __HYPERVISOR_grant_table_op;
  459. mcl->args[0] = cmd;
  460. mcl->args[1] = (unsigned long)uop;
  461. mcl->args[2] = count;
  462. trace_xen_mc_entry(mcl, 3);
  463. }
  464. static inline void
  465. MULTI_update_va_mapping_otherdomain(struct multicall_entry *mcl, unsigned long va,
  466. pte_t new_val, unsigned long flags,
  467. domid_t domid)
  468. {
  469. mcl->op = __HYPERVISOR_update_va_mapping_otherdomain;
  470. mcl->args[0] = va;
  471. if (sizeof(new_val) == sizeof(long)) {
  472. mcl->args[1] = new_val.pte;
  473. mcl->args[2] = flags;
  474. mcl->args[3] = domid;
  475. } else {
  476. mcl->args[1] = new_val.pte;
  477. mcl->args[2] = new_val.pte >> 32;
  478. mcl->args[3] = flags;
  479. mcl->args[4] = domid;
  480. }
  481. trace_xen_mc_entry(mcl, sizeof(new_val) == sizeof(long) ? 4 : 5);
  482. }
  483. static inline void
  484. MULTI_update_descriptor(struct multicall_entry *mcl, u64 maddr,
  485. struct desc_struct desc)
  486. {
  487. mcl->op = __HYPERVISOR_update_descriptor;
  488. if (sizeof(maddr) == sizeof(long)) {
  489. mcl->args[0] = maddr;
  490. mcl->args[1] = *(unsigned long *)&desc;
  491. } else {
  492. u32 *p = (u32 *)&desc;
  493. mcl->args[0] = maddr;
  494. mcl->args[1] = maddr >> 32;
  495. mcl->args[2] = *p++;
  496. mcl->args[3] = *p;
  497. }
  498. trace_xen_mc_entry(mcl, sizeof(maddr) == sizeof(long) ? 2 : 4);
  499. }
  500. static inline void
  501. MULTI_memory_op(struct multicall_entry *mcl, unsigned int cmd, void *arg)
  502. {
  503. mcl->op = __HYPERVISOR_memory_op;
  504. mcl->args[0] = cmd;
  505. mcl->args[1] = (unsigned long)arg;
  506. trace_xen_mc_entry(mcl, 2);
  507. }
  508. static inline void
  509. MULTI_mmu_update(struct multicall_entry *mcl, struct mmu_update *req,
  510. int count, int *success_count, domid_t domid)
  511. {
  512. mcl->op = __HYPERVISOR_mmu_update;
  513. mcl->args[0] = (unsigned long)req;
  514. mcl->args[1] = count;
  515. mcl->args[2] = (unsigned long)success_count;
  516. mcl->args[3] = domid;
  517. trace_xen_mc_entry(mcl, 4);
  518. }
  519. static inline void
  520. MULTI_mmuext_op(struct multicall_entry *mcl, struct mmuext_op *op, int count,
  521. int *success_count, domid_t domid)
  522. {
  523. mcl->op = __HYPERVISOR_mmuext_op;
  524. mcl->args[0] = (unsigned long)op;
  525. mcl->args[1] = count;
  526. mcl->args[2] = (unsigned long)success_count;
  527. mcl->args[3] = domid;
  528. trace_xen_mc_entry(mcl, 4);
  529. }
  530. static inline void
  531. MULTI_set_gdt(struct multicall_entry *mcl, unsigned long *frames, int entries)
  532. {
  533. mcl->op = __HYPERVISOR_set_gdt;
  534. mcl->args[0] = (unsigned long)frames;
  535. mcl->args[1] = entries;
  536. trace_xen_mc_entry(mcl, 2);
  537. }
  538. static inline void
  539. MULTI_stack_switch(struct multicall_entry *mcl,
  540. unsigned long ss, unsigned long esp)
  541. {
  542. mcl->op = __HYPERVISOR_stack_switch;
  543. mcl->args[0] = ss;
  544. mcl->args[1] = esp;
  545. trace_xen_mc_entry(mcl, 2);
  546. }
  547. #endif /* _ASM_X86_XEN_HYPERCALL_H */