ia64/linux-2.6.18-xen.hg

view include/asm-x86_64/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 75e5bfa7fbdc
line source
1 /******************************************************************************
2 * hypercall.h
3 *
4 * Linux-specific hypervisor handling.
5 *
6 * Copyright (c) 2002-2004, K A Fraser
7 *
8 * 64-bit updates:
9 * Benjamin Liu <benjamin.liu@intel.com>
10 * Jun Nakajima <jun.nakajima@intel.com>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License version 2
14 * as published by the Free Software Foundation; or, when distributed
15 * separately from the Linux kernel or incorporated into other
16 * software packages, subject to the following license:
17 *
18 * Permission is hereby granted, free of charge, to any person obtaining a copy
19 * of this source file (the "Software"), to deal in the Software without
20 * restriction, including without limitation the rights to use, copy, modify,
21 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
22 * and to permit persons to whom the Software is furnished to do so, subject to
23 * the following conditions:
24 *
25 * The above copyright notice and this permission notice shall be included in
26 * all copies or substantial portions of the Software.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
33 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
34 * IN THE SOFTWARE.
35 */
37 #ifndef __HYPERCALL_H__
38 #define __HYPERCALL_H__
40 #include <linux/string.h> /* memcpy() */
41 #include <linux/stringify.h>
43 #ifndef __HYPERVISOR_H__
44 # error "please don't include this file directly"
45 #endif
47 #ifdef CONFIG_XEN
48 #define HYPERCALL_STR(name) \
49 "call hypercall_page + ("__stringify(__HYPERVISOR_##name)" * 32)"
50 #else
51 #define HYPERCALL_STR(name) \
52 "mov $("__stringify(__HYPERVISOR_##name)" * 32),%%eax; "\
53 "add hypercall_stubs(%%rip),%%rax; " \
54 "call *%%rax"
55 #endif
57 #define _hypercall0(type, name) \
58 ({ \
59 type __res; \
60 asm volatile ( \
61 HYPERCALL_STR(name) \
62 : "=a" (__res) \
63 : \
64 : "memory" ); \
65 __res; \
66 })
68 #define _hypercall1(type, name, a1) \
69 ({ \
70 type __res; \
71 long __ign1; \
72 asm volatile ( \
73 HYPERCALL_STR(name) \
74 : "=a" (__res), "=D" (__ign1) \
75 : "1" ((long)(a1)) \
76 : "memory" ); \
77 __res; \
78 })
80 #define _hypercall2(type, name, a1, a2) \
81 ({ \
82 type __res; \
83 long __ign1, __ign2; \
84 asm volatile ( \
85 HYPERCALL_STR(name) \
86 : "=a" (__res), "=D" (__ign1), "=S" (__ign2) \
87 : "1" ((long)(a1)), "2" ((long)(a2)) \
88 : "memory" ); \
89 __res; \
90 })
92 #define _hypercall3(type, name, a1, a2, a3) \
93 ({ \
94 type __res; \
95 long __ign1, __ign2, __ign3; \
96 asm volatile ( \
97 HYPERCALL_STR(name) \
98 : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
99 "=d" (__ign3) \
100 : "1" ((long)(a1)), "2" ((long)(a2)), \
101 "3" ((long)(a3)) \
102 : "memory" ); \
103 __res; \
104 })
106 #define _hypercall4(type, name, a1, a2, a3, a4) \
107 ({ \
108 type __res; \
109 long __ign1, __ign2, __ign3; \
110 register long __arg4 asm("r10") = (long)(a4); \
111 asm volatile ( \
112 HYPERCALL_STR(name) \
113 : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
114 "=d" (__ign3), "+r" (__arg4) \
115 : "1" ((long)(a1)), "2" ((long)(a2)), \
116 "3" ((long)(a3)) \
117 : "memory" ); \
118 __res; \
119 })
121 #define _hypercall5(type, name, a1, a2, a3, a4, a5) \
122 ({ \
123 type __res; \
124 long __ign1, __ign2, __ign3; \
125 register long __arg4 asm("r10") = (long)(a4); \
126 register long __arg5 asm("r8") = (long)(a5); \
127 asm volatile ( \
128 HYPERCALL_STR(name) \
129 : "=a" (__res), "=D" (__ign1), "=S" (__ign2), \
130 "=d" (__ign3), "+r" (__arg4), "+r" (__arg5) \
131 : "1" ((long)(a1)), "2" ((long)(a2)), \
132 "3" ((long)(a3)) \
133 : "memory" ); \
134 __res; \
135 })
137 static inline int __must_check
138 HYPERVISOR_set_trap_table(
139 const trap_info_t *table)
140 {
141 return _hypercall1(int, set_trap_table, table);
142 }
144 static inline int __must_check
145 HYPERVISOR_mmu_update(
146 mmu_update_t *req, unsigned int count, unsigned int *success_count,
147 domid_t domid)
148 {
149 return _hypercall4(int, mmu_update, req, count, success_count, domid);
150 }
152 static inline int __must_check
153 HYPERVISOR_mmuext_op(
154 struct mmuext_op *op, unsigned int count, unsigned int *success_count,
155 domid_t domid)
156 {
157 return _hypercall4(int, mmuext_op, op, count, success_count, domid);
158 }
160 static inline int __must_check
161 HYPERVISOR_set_gdt(
162 unsigned long *frame_list, unsigned int entries)
163 {
164 return _hypercall2(int, set_gdt, frame_list, entries);
165 }
167 static inline int __must_check
168 HYPERVISOR_stack_switch(
169 unsigned long ss, unsigned long esp)
170 {
171 return _hypercall2(int, stack_switch, ss, esp);
172 }
174 static inline int __must_check
175 HYPERVISOR_set_callbacks(
176 unsigned long event_address, unsigned long failsafe_address,
177 unsigned long syscall_address)
178 {
179 return _hypercall3(int, set_callbacks,
180 event_address, failsafe_address, syscall_address);
181 }
183 static inline int
184 HYPERVISOR_fpu_taskswitch(
185 int set)
186 {
187 return _hypercall1(int, fpu_taskswitch, set);
188 }
190 static inline int __must_check
191 HYPERVISOR_sched_op_compat(
192 int cmd, unsigned long arg)
193 {
194 return _hypercall2(int, sched_op_compat, cmd, arg);
195 }
197 static inline int __must_check
198 HYPERVISOR_sched_op(
199 int cmd, void *arg)
200 {
201 return _hypercall2(int, sched_op, cmd, arg);
202 }
204 static inline long __must_check
205 HYPERVISOR_set_timer_op(
206 u64 timeout)
207 {
208 return _hypercall1(long, set_timer_op, timeout);
209 }
211 static inline int __must_check
212 HYPERVISOR_platform_op(
213 struct xen_platform_op *platform_op)
214 {
215 platform_op->interface_version = XENPF_INTERFACE_VERSION;
216 return _hypercall1(int, platform_op, platform_op);
217 }
219 static inline int __must_check
220 HYPERVISOR_set_debugreg(
221 unsigned int reg, unsigned long value)
222 {
223 return _hypercall2(int, set_debugreg, reg, value);
224 }
226 static inline unsigned long __must_check
227 HYPERVISOR_get_debugreg(
228 unsigned int reg)
229 {
230 return _hypercall1(unsigned long, get_debugreg, reg);
231 }
233 static inline int __must_check
234 HYPERVISOR_update_descriptor(
235 unsigned long ma, unsigned long word)
236 {
237 return _hypercall2(int, update_descriptor, ma, word);
238 }
240 static inline int __must_check
241 HYPERVISOR_memory_op(
242 unsigned int cmd, void *arg)
243 {
244 return _hypercall2(int, memory_op, cmd, arg);
245 }
247 static inline int __must_check
248 HYPERVISOR_multicall(
249 multicall_entry_t *call_list, unsigned int nr_calls)
250 {
251 return _hypercall2(int, multicall, call_list, nr_calls);
252 }
254 static inline int __must_check
255 HYPERVISOR_update_va_mapping(
256 unsigned long va, pte_t new_val, unsigned long flags)
257 {
258 return _hypercall3(int, update_va_mapping, va, new_val.pte, flags);
259 }
261 static inline int __must_check
262 HYPERVISOR_event_channel_op(
263 int cmd, void *arg)
264 {
265 int rc = _hypercall2(int, event_channel_op, cmd, arg);
267 #if CONFIG_XEN_COMPAT <= 0x030002
268 if (unlikely(rc == -ENOSYS)) {
269 struct evtchn_op op;
270 op.cmd = cmd;
271 memcpy(&op.u, arg, sizeof(op.u));
272 rc = _hypercall1(int, event_channel_op_compat, &op);
273 memcpy(arg, &op.u, sizeof(op.u));
274 }
275 #endif
277 return rc;
278 }
280 static inline int __must_check
281 HYPERVISOR_xen_version(
282 int cmd, void *arg)
283 {
284 return _hypercall2(int, xen_version, cmd, arg);
285 }
287 static inline int __must_check
288 HYPERVISOR_console_io(
289 int cmd, unsigned int count, char *str)
290 {
291 return _hypercall3(int, console_io, cmd, count, str);
292 }
294 static inline int __must_check
295 HYPERVISOR_physdev_op(
296 int cmd, void *arg)
297 {
298 int rc = _hypercall2(int, physdev_op, cmd, arg);
300 #if CONFIG_XEN_COMPAT <= 0x030002
301 if (unlikely(rc == -ENOSYS)) {
302 struct physdev_op op;
303 op.cmd = cmd;
304 memcpy(&op.u, arg, sizeof(op.u));
305 rc = _hypercall1(int, physdev_op_compat, &op);
306 memcpy(arg, &op.u, sizeof(op.u));
307 }
308 #endif
310 return rc;
311 }
313 static inline int __must_check
314 HYPERVISOR_grant_table_op(
315 unsigned int cmd, void *uop, unsigned int count)
316 {
317 return _hypercall3(int, grant_table_op, cmd, uop, count);
318 }
320 static inline int __must_check
321 HYPERVISOR_update_va_mapping_otherdomain(
322 unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
323 {
324 return _hypercall4(int, update_va_mapping_otherdomain, va,
325 new_val.pte, flags, domid);
326 }
328 static inline int __must_check
329 HYPERVISOR_vm_assist(
330 unsigned int cmd, unsigned int type)
331 {
332 return _hypercall2(int, vm_assist, cmd, type);
333 }
335 static inline int __must_check
336 HYPERVISOR_vcpu_op(
337 int cmd, unsigned int vcpuid, void *extra_args)
338 {
339 return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
340 }
342 static inline int __must_check
343 HYPERVISOR_set_segment_base(
344 int reg, unsigned long value)
345 {
346 return _hypercall2(int, set_segment_base, reg, value);
347 }
349 static inline int __must_check
350 HYPERVISOR_suspend(
351 unsigned long srec)
352 {
353 struct sched_shutdown sched_shutdown = {
354 .reason = SHUTDOWN_suspend
355 };
357 int rc = _hypercall3(int, sched_op, SCHEDOP_shutdown,
358 &sched_shutdown, srec);
360 #if CONFIG_XEN_COMPAT <= 0x030002
361 if (rc == -ENOSYS)
362 rc = _hypercall3(int, sched_op_compat, SCHEDOP_shutdown,
363 SHUTDOWN_suspend, srec);
364 #endif
366 return rc;
367 }
369 #if CONFIG_XEN_COMPAT <= 0x030002
370 static inline int
371 HYPERVISOR_nmi_op(
372 unsigned long op, void *arg)
373 {
374 return _hypercall2(int, nmi_op, op, arg);
375 }
376 #endif
378 #ifndef CONFIG_XEN
379 static inline unsigned long __must_check
380 HYPERVISOR_hvm_op(
381 int op, void *arg)
382 {
383 return _hypercall2(unsigned long, hvm_op, op, arg);
384 }
385 #endif
387 static inline int __must_check
388 HYPERVISOR_callback_op(
389 int cmd, const void *arg)
390 {
391 return _hypercall2(int, callback_op, cmd, arg);
392 }
394 static inline int __must_check
395 HYPERVISOR_xenoprof_op(
396 int op, void *arg)
397 {
398 return _hypercall2(int, xenoprof_op, op, arg);
399 }
401 static inline int __must_check
402 HYPERVISOR_kexec_op(
403 unsigned long op, void *args)
404 {
405 return _hypercall2(int, kexec_op, op, args);
406 }
408 #endif /* __HYPERCALL_H__ */