ia64/linux-2.6.18-xen.hg

view include/asm-i386/mach-xen/asm/hypercall.h @ 730:832aac894efd

linux/x86: remove broken HYPERVISOR_acm_op()

That hypercall apparently never really worked (it's being passed two
arguments, but the hypercall entry point code only loaded one, while
do_acm_op() again consumed two), appears to be pointless in the kernel
anyway, and there's been no __HYPERVISOR_acm_op for quite a while.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Nov 19 13:15:46 2008 +0000 (2008-11-19)
parents e32fe4703ab6
children cad6f60f0506
line source
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 */
33 #ifndef __HYPERCALL_H__
34 #define __HYPERCALL_H__
36 #include <linux/string.h> /* memcpy() */
37 #include <linux/stringify.h>
39 #ifndef __HYPERVISOR_H__
40 # error "please don't include this file directly"
41 #endif
43 #ifdef CONFIG_XEN
44 #define HYPERCALL_STR(name) \
45 "call hypercall_page + ("__stringify(__HYPERVISOR_##name)" * 32)"
46 #else
47 #define HYPERCALL_STR(name) \
48 "mov hypercall_stubs,%%eax; " \
49 "add $("__stringify(__HYPERVISOR_##name)" * 32),%%eax; "\
50 "call *%%eax"
51 #endif
53 #define _hypercall0(type, name) \
54 ({ \
55 type __res; \
56 asm volatile ( \
57 HYPERCALL_STR(name) \
58 : "=a" (__res) \
59 : \
60 : "memory" ); \
61 __res; \
62 })
64 #define _hypercall1(type, name, a1) \
65 ({ \
66 type __res; \
67 long __ign1; \
68 asm volatile ( \
69 HYPERCALL_STR(name) \
70 : "=a" (__res), "=b" (__ign1) \
71 : "1" ((long)(a1)) \
72 : "memory" ); \
73 __res; \
74 })
76 #define _hypercall2(type, name, a1, a2) \
77 ({ \
78 type __res; \
79 long __ign1, __ign2; \
80 asm volatile ( \
81 HYPERCALL_STR(name) \
82 : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \
83 : "1" ((long)(a1)), "2" ((long)(a2)) \
84 : "memory" ); \
85 __res; \
86 })
88 #define _hypercall3(type, name, a1, a2, a3) \
89 ({ \
90 type __res; \
91 long __ign1, __ign2, __ign3; \
92 asm volatile ( \
93 HYPERCALL_STR(name) \
94 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
95 "=d" (__ign3) \
96 : "1" ((long)(a1)), "2" ((long)(a2)), \
97 "3" ((long)(a3)) \
98 : "memory" ); \
99 __res; \
100 })
102 #define _hypercall4(type, name, a1, a2, a3, a4) \
103 ({ \
104 type __res; \
105 long __ign1, __ign2, __ign3, __ign4; \
106 asm volatile ( \
107 HYPERCALL_STR(name) \
108 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
109 "=d" (__ign3), "=S" (__ign4) \
110 : "1" ((long)(a1)), "2" ((long)(a2)), \
111 "3" ((long)(a3)), "4" ((long)(a4)) \
112 : "memory" ); \
113 __res; \
114 })
116 #define _hypercall5(type, name, a1, a2, a3, a4, a5) \
117 ({ \
118 type __res; \
119 long __ign1, __ign2, __ign3, __ign4, __ign5; \
120 asm volatile ( \
121 HYPERCALL_STR(name) \
122 : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \
123 "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \
124 : "1" ((long)(a1)), "2" ((long)(a2)), \
125 "3" ((long)(a3)), "4" ((long)(a4)), \
126 "5" ((long)(a5)) \
127 : "memory" ); \
128 __res; \
129 })
131 static inline int __must_check
132 HYPERVISOR_set_trap_table(
133 const trap_info_t *table)
134 {
135 return _hypercall1(int, set_trap_table, table);
136 }
138 static inline int __must_check
139 HYPERVISOR_mmu_update(
140 mmu_update_t *req, unsigned int count, unsigned int *success_count,
141 domid_t domid)
142 {
143 return _hypercall4(int, mmu_update, req, count, success_count, domid);
144 }
146 static inline int __must_check
147 HYPERVISOR_mmuext_op(
148 struct mmuext_op *op, unsigned int count, unsigned int *success_count,
149 domid_t domid)
150 {
151 return _hypercall4(int, mmuext_op, op, count, success_count, domid);
152 }
154 static inline int __must_check
155 HYPERVISOR_set_gdt(
156 unsigned long *frame_list, unsigned int entries)
157 {
158 return _hypercall2(int, set_gdt, frame_list, entries);
159 }
161 static inline int __must_check
162 HYPERVISOR_stack_switch(
163 unsigned long ss, unsigned long esp)
164 {
165 return _hypercall2(int, stack_switch, ss, esp);
166 }
168 static inline int __must_check
169 HYPERVISOR_set_callbacks(
170 unsigned long event_selector, unsigned long event_address,
171 unsigned long failsafe_selector, unsigned long failsafe_address)
172 {
173 return _hypercall4(int, set_callbacks,
174 event_selector, event_address,
175 failsafe_selector, failsafe_address);
176 }
178 static inline int
179 HYPERVISOR_fpu_taskswitch(
180 int set)
181 {
182 return _hypercall1(int, fpu_taskswitch, set);
183 }
185 static inline int __must_check
186 HYPERVISOR_sched_op_compat(
187 int cmd, unsigned long arg)
188 {
189 return _hypercall2(int, sched_op_compat, cmd, arg);
190 }
192 static inline int __must_check
193 HYPERVISOR_sched_op(
194 int cmd, void *arg)
195 {
196 return _hypercall2(int, sched_op, cmd, arg);
197 }
199 static inline long __must_check
200 HYPERVISOR_set_timer_op(
201 u64 timeout)
202 {
203 unsigned long timeout_hi = (unsigned long)(timeout>>32);
204 unsigned long timeout_lo = (unsigned long)timeout;
205 return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
206 }
208 static inline int __must_check
209 HYPERVISOR_platform_op(
210 struct xen_platform_op *platform_op)
211 {
212 platform_op->interface_version = XENPF_INTERFACE_VERSION;
213 return _hypercall1(int, platform_op, platform_op);
214 }
216 static inline int __must_check
217 HYPERVISOR_set_debugreg(
218 unsigned int reg, unsigned long value)
219 {
220 return _hypercall2(int, set_debugreg, reg, value);
221 }
223 static inline unsigned long __must_check
224 HYPERVISOR_get_debugreg(
225 unsigned int reg)
226 {
227 return _hypercall1(unsigned long, get_debugreg, reg);
228 }
230 static inline int __must_check
231 HYPERVISOR_update_descriptor(
232 u64 ma, u64 desc)
233 {
234 return _hypercall4(int, update_descriptor, ma, ma>>32, desc, desc>>32);
235 }
237 static inline int __must_check
238 HYPERVISOR_memory_op(
239 unsigned int cmd, void *arg)
240 {
241 return _hypercall2(int, memory_op, cmd, arg);
242 }
244 static inline int __must_check
245 HYPERVISOR_multicall(
246 multicall_entry_t *call_list, unsigned int nr_calls)
247 {
248 return _hypercall2(int, multicall, call_list, nr_calls);
249 }
251 static inline int __must_check
252 HYPERVISOR_update_va_mapping(
253 unsigned long va, pte_t new_val, unsigned long flags)
254 {
255 unsigned long pte_hi = 0;
256 #ifdef CONFIG_X86_PAE
257 pte_hi = new_val.pte_high;
258 #endif
259 return _hypercall4(int, update_va_mapping, va,
260 new_val.pte_low, pte_hi, flags);
261 }
263 static inline int __must_check
264 HYPERVISOR_event_channel_op(
265 int cmd, void *arg)
266 {
267 int rc = _hypercall2(int, event_channel_op, cmd, arg);
269 #if CONFIG_XEN_COMPAT <= 0x030002
270 if (unlikely(rc == -ENOSYS)) {
271 struct evtchn_op op;
272 op.cmd = cmd;
273 memcpy(&op.u, arg, sizeof(op.u));
274 rc = _hypercall1(int, event_channel_op_compat, &op);
275 memcpy(arg, &op.u, sizeof(op.u));
276 }
277 #endif
279 return rc;
280 }
282 static inline int __must_check
283 HYPERVISOR_xen_version(
284 int cmd, void *arg)
285 {
286 return _hypercall2(int, xen_version, cmd, arg);
287 }
289 static inline int __must_check
290 HYPERVISOR_console_io(
291 int cmd, unsigned int count, char *str)
292 {
293 return _hypercall3(int, console_io, cmd, count, str);
294 }
296 static inline int __must_check
297 HYPERVISOR_physdev_op(
298 int cmd, void *arg)
299 {
300 int rc = _hypercall2(int, physdev_op, cmd, arg);
302 #if CONFIG_XEN_COMPAT <= 0x030002
303 if (unlikely(rc == -ENOSYS)) {
304 struct physdev_op op;
305 op.cmd = cmd;
306 memcpy(&op.u, arg, sizeof(op.u));
307 rc = _hypercall1(int, physdev_op_compat, &op);
308 memcpy(arg, &op.u, sizeof(op.u));
309 }
310 #endif
312 return rc;
313 }
315 static inline int __must_check
316 HYPERVISOR_grant_table_op(
317 unsigned int cmd, void *uop, unsigned int count)
318 {
319 return _hypercall3(int, grant_table_op, cmd, uop, count);
320 }
322 static inline int __must_check
323 HYPERVISOR_update_va_mapping_otherdomain(
324 unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
325 {
326 unsigned long pte_hi = 0;
327 #ifdef CONFIG_X86_PAE
328 pte_hi = new_val.pte_high;
329 #endif
330 return _hypercall5(int, update_va_mapping_otherdomain, va,
331 new_val.pte_low, pte_hi, flags, domid);
332 }
334 static inline int __must_check
335 HYPERVISOR_vm_assist(
336 unsigned int cmd, unsigned int type)
337 {
338 return _hypercall2(int, vm_assist, cmd, type);
339 }
341 static inline int __must_check
342 HYPERVISOR_vcpu_op(
343 int cmd, unsigned int vcpuid, void *extra_args)
344 {
345 return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
346 }
348 static inline int __must_check
349 HYPERVISOR_suspend(
350 unsigned long srec)
351 {
352 struct sched_shutdown sched_shutdown = {
353 .reason = SHUTDOWN_suspend
354 };
356 int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
357 &sched_shutdown, srec);
359 #if CONFIG_XEN_COMPAT <= 0x030002
360 if (rc == -ENOSYS)
361 rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
362 SHUTDOWN_suspend, srec);
363 #endif
365 return rc;
366 }
368 #if CONFIG_XEN_COMPAT <= 0x030002
369 static inline int
370 HYPERVISOR_nmi_op(
371 unsigned long op, void *arg)
372 {
373 return _hypercall2(int, nmi_op, op, arg);
374 }
375 #endif
377 #ifndef CONFIG_XEN
378 static inline unsigned long __must_check
379 HYPERVISOR_hvm_op(
380 int op, void *arg)
381 {
382 return _hypercall2(unsigned long, hvm_op, op, arg);
383 }
384 #endif
386 static inline int __must_check
387 HYPERVISOR_callback_op(
388 int cmd, const void *arg)
389 {
390 return _hypercall2(int, callback_op, cmd, arg);
391 }
393 static inline int __must_check
394 HYPERVISOR_xenoprof_op(
395 int op, void *arg)
396 {
397 return _hypercall2(int, xenoprof_op, op, arg);
398 }
400 static inline int __must_check
401 HYPERVISOR_kexec_op(
402 unsigned long op, void *args)
403 {
404 return _hypercall2(int, kexec_op, op, args);
405 }
409 #endif /* __HYPERCALL_H__ */