ia64/xen-unstable

view linux-2.6-xen-sparse/include/asm-xen/asm-ia64/hypercall.h @ 7189:b7d11c9b6be4

Merged.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Tue Oct 04 11:30:51 2005 +0100 (2005-10-04)
parents 109a27c1c004
children
line source
1 /******************************************************************************
2 * hypercall.h
3 *
4 * Linux-specific hypervisor handling.
5 *
6 * Copyright (c) 2002-2004, K A Fraser
7 *
8 * This file may be distributed separately from the Linux kernel, or
9 * incorporated into other software packages, subject to the following license:
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this source file (the "Software"), to deal in the Software without
13 * restriction, including without limitation the rights to use, copy, modify,
14 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
15 * and to permit persons to whom the Software is furnished to do so, subject to
16 * the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27 * IN THE SOFTWARE.
28 */
30 #ifndef __HYPERCALL_H__
31 #define __HYPERCALL_H__
32 #include <asm-xen/xen-public/xen.h>
34 /* FIXME: temp place to hold these page related macros */
35 #include <asm/page.h>
36 #define virt_to_machine(v) __pa(v)
37 #define machine_to_virt(m) __va(m)
38 //#define virt_to_mfn(v) (__pa(v) >> 14)
39 //#define mfn_to_virt(m) (__va(m << 14))
40 #define virt_to_mfn(v) ((__pa(v)) >> PAGE_SHIFT)
41 #define mfn_to_virt(m) (__va((m) << PAGE_SHIFT))
43 /*
44 * Assembler stubs for hyper-calls.
45 */
47 #if 0
48 static inline int
49 HYPERVISOR_set_trap_table(
50 trap_info_t *table)
51 {
52 #if 0
53 int ret;
54 unsigned long ignore;
56 __asm__ __volatile__ (
57 TRAP_INSTR
58 : "=a" (ret), "=b" (ignore)
59 : "0" (__HYPERVISOR_set_trap_table), "1" (table)
60 : "memory" );
62 return ret;
63 #endif
64 return 1;
65 }
67 static inline int
68 HYPERVISOR_mmu_update(
69 mmu_update_t *req, int count, int *success_count, domid_t domid)
70 {
71 #if 0
72 int ret;
73 unsigned long ign1, ign2, ign3, ign4;
75 __asm__ __volatile__ (
76 TRAP_INSTR
77 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
78 : "0" (__HYPERVISOR_mmu_update), "1" (req), "2" (count),
79 "3" (success_count), "4" (domid)
80 : "memory" );
82 return ret;
83 #endif
84 return 1;
85 }
87 static inline int
88 HYPERVISOR_mmuext_op(
89 struct mmuext_op *op, int count, int *success_count, domid_t domid)
90 {
91 #if 0
92 int ret;
93 unsigned long ign1, ign2, ign3, ign4;
95 __asm__ __volatile__ (
96 TRAP_INSTR
97 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
98 : "0" (__HYPERVISOR_mmuext_op), "1" (op), "2" (count),
99 "3" (success_count), "4" (domid)
100 : "memory" );
102 return ret;
103 #endif
104 return 1;
105 }
107 static inline int
108 HYPERVISOR_set_gdt(
109 unsigned long *frame_list, int entries)
110 {
111 #if 0
112 int ret;
113 unsigned long ign1, ign2;
115 __asm__ __volatile__ (
116 TRAP_INSTR
117 : "=a" (ret), "=b" (ign1), "=c" (ign2)
118 : "0" (__HYPERVISOR_set_gdt), "1" (frame_list), "2" (entries)
119 : "memory" );
122 return ret;
123 #endif
124 return 1;
125 }
127 static inline int
128 HYPERVISOR_stack_switch(
129 unsigned long ss, unsigned long esp)
130 {
131 #if 0
132 int ret;
133 unsigned long ign1, ign2;
135 __asm__ __volatile__ (
136 TRAP_INSTR
137 : "=a" (ret), "=b" (ign1), "=c" (ign2)
138 : "0" (__HYPERVISOR_stack_switch), "1" (ss), "2" (esp)
139 : "memory" );
141 return ret;
142 #endif
143 return 1;
144 }
146 static inline int
147 HYPERVISOR_set_callbacks(
148 unsigned long event_selector, unsigned long event_address,
149 unsigned long failsafe_selector, unsigned long failsafe_address)
150 {
151 #if 0
152 int ret;
153 unsigned long ign1, ign2, ign3, ign4;
155 __asm__ __volatile__ (
156 TRAP_INSTR
157 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
158 : "0" (__HYPERVISOR_set_callbacks), "1" (event_selector),
159 "2" (event_address), "3" (failsafe_selector), "4" (failsafe_address)
160 : "memory" );
162 return ret;
163 #endif
164 return 1;
165 }
167 static inline int
168 HYPERVISOR_fpu_taskswitch(
169 int set)
170 {
171 #if 0
172 int ret;
173 unsigned long ign;
175 __asm__ __volatile__ (
176 TRAP_INSTR
177 : "=a" (ret), "=b" (ign)
178 : "0" (__HYPERVISOR_fpu_taskswitch), "1" (set)
179 : "memory" );
181 return ret;
182 #endif
183 return 1;
184 }
186 static inline int
187 HYPERVISOR_yield(
188 void)
189 {
190 #if 0
191 int ret;
192 unsigned long ign;
194 __asm__ __volatile__ (
195 TRAP_INSTR
196 : "=a" (ret), "=b" (ign)
197 : "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_yield)
198 : "memory" );
200 return ret;
201 #endif
202 return 1;
203 }
205 static inline int
206 HYPERVISOR_block(
207 void)
208 {
209 #if 0
210 int ret;
211 unsigned long ign1;
212 __asm__ __volatile__ (
213 TRAP_INSTR
214 : "=a" (ret), "=b" (ign1)
215 : "0" (__HYPERVISOR_sched_op), "1" (SCHEDOP_block)
216 : "memory" );
218 return ret;
219 #endif
220 return 1;
221 }
223 static inline int
224 HYPERVISOR_shutdown(
225 void)
226 {
227 #if 0
228 int ret;
229 unsigned long ign1;
230 __asm__ __volatile__ (
231 TRAP_INSTR
232 : "=a" (ret), "=b" (ign1)
233 : "0" (__HYPERVISOR_sched_op),
234 "1" (SCHEDOP_shutdown | (SHUTDOWN_poweroff << SCHEDOP_reasonshift))
235 : "memory" );
237 return ret;
238 #endif
239 return 1;
240 }
242 static inline int
243 HYPERVISOR_reboot(
244 void)
245 {
246 #if 0
247 int ret;
248 unsigned long ign1;
249 __asm__ __volatile__ (
250 TRAP_INSTR
251 : "=a" (ret), "=b" (ign1)
252 : "0" (__HYPERVISOR_sched_op),
253 "1" (SCHEDOP_shutdown | (SHUTDOWN_reboot << SCHEDOP_reasonshift))
254 : "memory" );
256 return ret;
257 #endif
258 return 1;
259 }
261 static inline int
262 HYPERVISOR_suspend(
263 unsigned long srec)
264 {
265 #if 0
266 int ret;
267 unsigned long ign1, ign2;
269 /* NB. On suspend, control software expects a suspend record in %esi. */
270 __asm__ __volatile__ (
271 TRAP_INSTR
272 : "=a" (ret), "=b" (ign1), "=S" (ign2)
273 : "0" (__HYPERVISOR_sched_op),
274 "b" (SCHEDOP_shutdown | (SHUTDOWN_suspend << SCHEDOP_reasonshift)),
275 "S" (srec) : "memory");
277 return ret;
278 #endif
279 return 1;
280 }
282 static inline int
283 HYPERVISOR_crash(
284 void)
285 {
286 #if 0
287 int ret;
288 unsigned long ign1;
289 __asm__ __volatile__ (
290 TRAP_INSTR
291 : "=a" (ret), "=b" (ign1)
292 : "0" (__HYPERVISOR_sched_op),
293 "1" (SCHEDOP_shutdown | (SHUTDOWN_crash << SCHEDOP_reasonshift))
294 : "memory" );
296 return ret;
297 #endif
298 return 1;
299 }
301 static inline long
302 HYPERVISOR_set_timer_op(
303 u64 timeout)
304 {
305 #if 0
306 int ret;
307 unsigned long timeout_hi = (unsigned long)(timeout>>32);
308 unsigned long timeout_lo = (unsigned long)timeout;
309 unsigned long ign1, ign2;
311 __asm__ __volatile__ (
312 TRAP_INSTR
313 : "=a" (ret), "=b" (ign1), "=c" (ign2)
314 : "0" (__HYPERVISOR_set_timer_op), "b" (timeout_lo), "c" (timeout_hi)
315 : "memory");
317 return ret;
318 #endif
319 return 1;
320 }
322 static inline int
323 HYPERVISOR_dom0_op(
324 dom0_op_t *dom0_op)
325 {
326 #if 0
327 int ret;
328 unsigned long ign1;
330 dom0_op->interface_version = DOM0_INTERFACE_VERSION;
331 __asm__ __volatile__ (
332 TRAP_INSTR
333 : "=a" (ret), "=b" (ign1)
334 : "0" (__HYPERVISOR_dom0_op), "1" (dom0_op)
335 : "memory");
337 return ret;
338 #endif
339 return 1;
340 }
342 static inline int
343 HYPERVISOR_set_debugreg(
344 int reg, unsigned long value)
345 {
346 #if 0
347 int ret;
348 unsigned long ign1, ign2;
349 __asm__ __volatile__ (
350 TRAP_INSTR
351 : "=a" (ret), "=b" (ign1), "=c" (ign2)
352 : "0" (__HYPERVISOR_set_debugreg), "1" (reg), "2" (value)
353 : "memory" );
355 return ret;
356 #endif
357 return 1;
358 }
360 static inline unsigned long
361 HYPERVISOR_get_debugreg(
362 int reg)
363 {
364 #if 0
365 unsigned long ret;
366 unsigned long ign;
367 __asm__ __volatile__ (
368 TRAP_INSTR
369 : "=a" (ret), "=b" (ign)
370 : "0" (__HYPERVISOR_get_debugreg), "1" (reg)
371 : "memory" );
373 return ret;
374 #endif
375 return 1;
376 }
378 static inline int
379 HYPERVISOR_update_descriptor(
380 unsigned long ma, unsigned long word1, unsigned long word2)
381 {
382 #if 0
383 int ret;
384 unsigned long ign1, ign2, ign3;
386 __asm__ __volatile__ (
387 TRAP_INSTR
388 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
389 : "0" (__HYPERVISOR_update_descriptor), "1" (ma), "2" (word1),
390 "3" (word2)
391 : "memory" );
393 return ret;
394 #endif
395 return 1;
396 }
398 static inline int
399 HYPERVISOR_set_fast_trap(
400 int idx)
401 {
402 #if 0
403 int ret;
404 unsigned long ign;
406 __asm__ __volatile__ (
407 TRAP_INSTR
408 : "=a" (ret), "=b" (ign)
409 : "0" (__HYPERVISOR_set_fast_trap), "1" (idx)
410 : "memory" );
412 return ret;
413 #endif
414 return 1;
415 }
417 static inline int
418 HYPERVISOR_dom_mem_op(
419 unsigned int op, unsigned long *extent_list,
420 unsigned long nr_extents, unsigned int extent_order)
421 {
422 #if 0
423 int ret;
424 unsigned long ign1, ign2, ign3, ign4, ign5;
426 __asm__ __volatile__ (
427 TRAP_INSTR
428 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4),
429 "=D" (ign5)
430 : "0" (__HYPERVISOR_dom_mem_op), "1" (op), "2" (extent_list),
431 "3" (nr_extents), "4" (extent_order), "5" (DOMID_SELF)
432 : "memory" );
434 return ret;
435 #endif
436 return 1;
437 }
439 static inline int
440 HYPERVISOR_multicall(
441 void *call_list, int nr_calls)
442 {
443 #if 0
444 int ret;
445 unsigned long ign1, ign2;
447 __asm__ __volatile__ (
448 TRAP_INSTR
449 : "=a" (ret), "=b" (ign1), "=c" (ign2)
450 : "0" (__HYPERVISOR_multicall), "1" (call_list), "2" (nr_calls)
451 : "memory" );
453 return ret;
454 #endif
455 return 1;
456 }
458 static inline int
459 HYPERVISOR_update_va_mapping(
460 unsigned long va, pte_t new_val, unsigned long flags)
461 {
462 #if 0
463 int ret;
464 unsigned long ign1, ign2, ign3;
466 __asm__ __volatile__ (
467 TRAP_INSTR
468 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3)
469 : "0" (__HYPERVISOR_update_va_mapping),
470 "1" (va), "2" ((new_val).pte_low), "3" (flags)
471 : "memory" );
473 if ( unlikely(ret < 0) )
474 {
475 printk(KERN_ALERT "Failed update VA mapping: %08lx, %08lx, %08lx\n",
476 va, (new_val).pte_low, flags);
477 BUG();
478 }
480 return ret;
481 #endif
482 return 1;
483 }
484 #endif
486 static inline int
487 HYPERVISOR_event_channel_op(
488 void *op)
489 {
490 int ret;
491 __asm__ __volatile__ ( ";; mov r14=%2 ; mov r2=%1 ; break 0x1000 ;; mov %0=r8 ;;"
492 : "=r" (ret)
493 : "i" (__HYPERVISOR_event_channel_op), "r"(op)
494 : "r14","r2","r8","memory" );
495 return ret;
496 }
498 #if 0
499 static inline int
500 HYPERVISOR_xen_version(
501 int cmd)
502 {
503 #if 0
504 int ret;
505 unsigned long ignore;
507 __asm__ __volatile__ (
508 TRAP_INSTR
509 : "=a" (ret), "=b" (ignore)
510 : "0" (__HYPERVISOR_xen_version), "1" (cmd)
511 : "memory" );
513 return ret;
514 #endif
515 return 1;
516 }
517 #endif
519 static inline int
520 HYPERVISOR_console_io(
521 int cmd, int count, char *str)
522 {
523 int ret;
524 __asm__ __volatile__ ( ";; mov r14=%2 ; mov r15=%3 ; mov r16=%4 ; mov r2=%1 ; break 0x1000 ;; mov %0=r8 ;;"
525 : "=r" (ret)
526 : "i" (__HYPERVISOR_console_io), "r"(cmd), "r"(count), "r"(str)
527 : "r14","r15","r16","r2","r8","memory" );
528 return ret;
529 }
531 #if 0
532 static inline int
533 HYPERVISOR_physdev_op(
534 void *physdev_op)
535 {
536 #if 0
537 int ret;
538 unsigned long ign;
540 __asm__ __volatile__ (
541 TRAP_INSTR
542 : "=a" (ret), "=b" (ign)
543 : "0" (__HYPERVISOR_physdev_op), "1" (physdev_op)
544 : "memory" );
546 return ret;
547 #endif
548 return 1;
549 }
550 #endif
552 static inline int
553 HYPERVISOR_grant_table_op(
554 unsigned int cmd, void *uop, unsigned int count)
555 {
556 int ret;
557 __asm__ __volatile__ ( ";; mov r14=%2 ; mov r15=%3 ; mov r16=%4 ; mov r2=%1 ; break 0x1000 ;; mov %0=r8 ;;"
558 : "=r" (ret)
559 : "i" (__HYPERVISOR_grant_table_op), "r"(cmd), "r"(uop), "r"(count)
560 : "r14","r15","r16","r2","r8","memory" );
561 return ret;
562 }
564 #if 0
565 static inline int
566 HYPERVISOR_update_va_mapping_otherdomain(
567 unsigned long va, pte_t new_val, unsigned long flags, domid_t domid)
568 {
569 #if 0
570 int ret;
571 unsigned long ign1, ign2, ign3, ign4;
573 __asm__ __volatile__ (
574 TRAP_INSTR
575 : "=a" (ret), "=b" (ign1), "=c" (ign2), "=d" (ign3), "=S" (ign4)
576 : "0" (__HYPERVISOR_update_va_mapping_otherdomain),
577 "1" (va), "2" ((new_val).pte_low), "3" (flags), "4" (domid) :
578 "memory" );
580 return ret;
581 #endif
582 return 1;
583 }
585 static inline int
586 HYPERVISOR_vm_assist(
587 unsigned int cmd, unsigned int type)
588 {
589 #if 0
590 int ret;
591 unsigned long ign1, ign2;
593 __asm__ __volatile__ (
594 TRAP_INSTR
595 : "=a" (ret), "=b" (ign1), "=c" (ign2)
596 : "0" (__HYPERVISOR_vm_assist), "1" (cmd), "2" (type)
597 : "memory" );
599 return ret;
600 #endif
601 return 1;
602 }
604 static inline int
605 HYPERVISOR_boot_vcpu(
606 unsigned long vcpu, vcpu_guest_context_t *ctxt)
607 {
608 #if 0
609 int ret;
610 unsigned long ign1, ign2;
612 __asm__ __volatile__ (
613 TRAP_INSTR
614 : "=a" (ret), "=b" (ign1), "=c" (ign2)
615 : "0" (__HYPERVISOR_boot_vcpu), "1" (vcpu), "2" (ctxt)
616 : "memory");
618 return ret;
619 #endif
620 return 1;
621 }
622 #endif
624 #endif /* __HYPERCALL_H__ */