ia64/xen-unstable

view linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h @ 9762:a3cc276f2e87

[IA64] dma paravirtualization

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@localhost
date Tue Apr 25 16:53:27 2006 -0600 (2006-04-25)
parents 5cc367720223
children a779d642c22a
line source
1 /******************************************************************************
2 * hypervisor.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 __HYPERVISOR_H__
34 #define __HYPERVISOR_H__
36 #include <linux/config.h>
37 #include <linux/types.h>
38 #include <linux/kernel.h>
39 #include <linux/version.h>
40 #include <linux/errno.h>
41 #include <xen/interface/xen.h>
42 #include <xen/interface/dom0_ops.h>
43 #include <xen/interface/sched.h>
44 #include <asm/hypercall.h>
45 #include <asm/ptrace.h>
46 #include <asm/page.h>
47 #include <asm/xen/privop.h> // for running_on_xen
49 extern shared_info_t *HYPERVISOR_shared_info;
50 extern start_info_t *xen_start_info;
52 void force_evtchn_callback(void);
54 int xen_init(void);
56 /* Turn jiffies into Xen system time. XXX Implement me. */
57 #define jiffies_to_st(j) 0
59 static inline int
60 HYPERVISOR_yield(
61 void)
62 {
63 int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
65 if (rc == -ENOSYS)
66 rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
68 return rc;
69 }
71 static inline int
72 HYPERVISOR_block(
73 void)
74 {
75 int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
77 if (rc == -ENOSYS)
78 rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
80 return rc;
81 }
83 static inline int
84 HYPERVISOR_shutdown(
85 unsigned int reason)
86 {
87 struct sched_shutdown sched_shutdown = {
88 .reason = reason
89 };
91 int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
93 if (rc == -ENOSYS)
94 rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
96 return rc;
97 }
99 static inline int
100 HYPERVISOR_poll(
101 evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
102 {
103 struct sched_poll sched_poll = {
104 .ports = ports,
105 .nr_ports = nr_ports,
106 .timeout = jiffies_to_st(timeout)
107 };
109 int rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
111 if (rc == -ENOSYS)
112 rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
114 return rc;
115 }
117 // for drivers/xen/privcmd/privcmd.c
118 #define direct_remap_pfn_range(a,b,c,d,e,f) remap_pfn_range(a,b,c,d,e)
119 #define machine_to_phys_mapping 0
120 #ifndef CONFIG_XEN_IA64_DOM0_VP
121 #define pfn_to_mfn(x) (x)
122 #define mfn_to_pfn(x) (x)
123 #endif
125 // for drivers/xen/balloon/balloon.c
126 #ifdef CONFIG_XEN_SCRUB_PAGES
127 #define scrub_pages(_p,_n) memset((void *)(_p), 0, (_n) << PAGE_SHIFT)
128 #else
129 #define scrub_pages(_p,_n) ((void)0)
130 #endif
131 #define pte_mfn(_x) pte_pfn(_x)
132 #define __pte_ma(_x) ((pte_t) {(_x)})
133 #define phys_to_machine_mapping_valid(_x) (1)
134 #define kmap_flush_unused() do {} while (0)
135 #define pfn_pte_ma(_x,_y) __pte_ma(0)
136 #ifndef CONFIG_XEN_IA64_DOM0_VP //XXX
137 #define set_phys_to_machine(_x,_y) do {} while (0)
138 #define xen_machphys_update(_x,_y) do {} while (0)
139 #endif
141 #ifdef CONFIG_XEN_IA64_DOM0_VP
142 int __xen_create_contiguous_region(unsigned long vstart, unsigned int order, unsigned int address_bits);
143 static inline int
144 xen_create_contiguous_region(unsigned long vstart,
145 unsigned int order, unsigned int address_bits)
146 {
147 int ret = 0;
148 if (running_on_xen) {
149 ret = __xen_create_contiguous_region(vstart, order,
150 address_bits);
151 }
152 return ret;
153 }
155 void __xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
156 static inline void
157 xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
158 {
159 if (running_on_xen)
160 __xen_destroy_contiguous_region(vstart, order);
161 }
162 #else
163 #define xen_create_contiguous_region(vstart, order, address_bits) ({0;})
164 #define xen_destroy_contiguous_region(vstart, order) do {} while (0)
165 #endif
167 // for debug
168 asmlinkage int xprintk(const char *fmt, ...);
169 #define xprintd(fmt, ...) xprintk("%s:%d " fmt, __func__, __LINE__, \
170 ##__VA_ARGS__)
172 #endif /* __HYPERVISOR_H__ */