direct-io.hg

view linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h @ 11349:896fcdd49c7f

[IA64] Modify sparse headers for PV-on-HVM/IPF

Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com>
Signed-off-by: Tomonari Horikoshi <t.horikoshi@jp.fujitsu.com>
author awilliam@xenbuild.aw
date Mon Aug 28 16:16:07 2006 -0600 (2006-08-28)
parents d8338b28bcd6
children d4e85f8453ba
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 #if !defined(CONFIG_XEN) && !defined(CONFIG_VMX_GUEST)
37 #define is_running_on_xen() (0)
38 #define HYPERVISOR_ioremap(offset, size) (offset)
39 #else
40 extern int running_on_xen;
41 #define is_running_on_xen() (running_on_xen)
42 #endif
44 #if defined(CONFIG_XEN) || defined(CONFIG_VMX_GUEST)
45 #include <linux/config.h>
46 #include <linux/types.h>
47 #include <linux/kernel.h>
48 #include <linux/version.h>
49 #include <linux/errno.h>
50 #include <xen/interface/xen.h>
51 #include <xen/interface/dom0_ops.h>
52 #include <xen/interface/event_channel.h>
53 #include <xen/interface/physdev.h>
54 #include <xen/interface/sched.h>
55 #include <asm/hypercall.h>
56 #include <asm/ptrace.h>
57 #include <asm/page.h>
59 extern shared_info_t *HYPERVISOR_shared_info;
60 extern start_info_t *xen_start_info;
62 void force_evtchn_callback(void);
64 #ifndef CONFIG_VMX_GUEST
65 /* Turn jiffies into Xen system time. XXX Implement me. */
66 #define jiffies_to_st(j) 0
68 static inline int
69 HYPERVISOR_yield(
70 void)
71 {
72 int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
74 if (rc == -ENOSYS)
75 rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
77 return rc;
78 }
80 static inline int
81 HYPERVISOR_block(
82 void)
83 {
84 int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
86 if (rc == -ENOSYS)
87 rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
89 return rc;
90 }
92 static inline int
93 HYPERVISOR_shutdown(
94 unsigned int reason)
95 {
96 struct sched_shutdown sched_shutdown = {
97 .reason = reason
98 };
100 int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
102 if (rc == -ENOSYS)
103 rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
105 return rc;
106 }
108 static inline int
109 HYPERVISOR_poll(
110 evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
111 {
112 struct sched_poll sched_poll = {
113 .nr_ports = nr_ports,
114 .timeout = jiffies_to_st(timeout)
115 };
117 int rc;
119 set_xen_guest_handle(sched_poll.ports, ports);
120 rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
121 if (rc == -ENOSYS)
122 rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
124 return rc;
125 }
127 // for drivers/xen/privcmd/privcmd.c
128 #define machine_to_phys_mapping 0
129 struct vm_area_struct;
130 int direct_remap_pfn_range(struct vm_area_struct *vma,
131 unsigned long address,
132 unsigned long mfn,
133 unsigned long size,
134 pgprot_t prot,
135 domid_t domid);
136 struct file;
137 int privcmd_mmap(struct file * file, struct vm_area_struct * vma);
138 #define HAVE_ARCH_PRIVCMD_MMAP
140 // for drivers/xen/balloon/balloon.c
141 #ifdef CONFIG_XEN_SCRUB_PAGES
142 #define scrub_pages(_p,_n) memset((void *)(_p), 0, (_n) << PAGE_SHIFT)
143 #else
144 #define scrub_pages(_p,_n) ((void)0)
145 #endif
146 #define pte_mfn(_x) pte_pfn(_x)
147 #define phys_to_machine_mapping_valid(_x) (1)
149 #endif /* !CONFIG_VMX_GUEST */
151 #define __pte_ma(_x) ((pte_t) {(_x)}) /* unmodified use */
152 #define pfn_pte_ma(_x,_y) __pte_ma(0) /* unmodified use */
154 #ifndef CONFIG_VMX_GUEST
155 int __xen_create_contiguous_region(unsigned long vstart, unsigned int order, unsigned int address_bits);
156 static inline int
157 xen_create_contiguous_region(unsigned long vstart,
158 unsigned int order, unsigned int address_bits)
159 {
160 int ret = 0;
161 if (is_running_on_xen()) {
162 ret = __xen_create_contiguous_region(vstart, order,
163 address_bits);
164 }
165 return ret;
166 }
168 void __xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
169 static inline void
170 xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
171 {
172 if (is_running_on_xen())
173 __xen_destroy_contiguous_region(vstart, order);
174 }
176 #endif /* !CONFIG_VMX_GUEST */
178 // for netfront.c, netback.c
179 #define MULTI_UVMFLAGS_INDEX 0 //XXX any value
181 static inline void
182 MULTI_update_va_mapping(
183 multicall_entry_t *mcl, unsigned long va,
184 pte_t new_val, unsigned long flags)
185 {
186 mcl->op = __HYPERVISOR_update_va_mapping;
187 mcl->result = 0;
188 }
190 static inline void
191 MULTI_grant_table_op(multicall_entry_t *mcl, unsigned int cmd,
192 void *uop, unsigned int count)
193 {
194 mcl->op = __HYPERVISOR_grant_table_op;
195 mcl->args[0] = cmd;
196 mcl->args[1] = (unsigned long)uop;
197 mcl->args[2] = count;
198 }
200 // for debug
201 asmlinkage int xprintk(const char *fmt, ...);
202 #define xprintd(fmt, ...) xprintk("%s:%d " fmt, __func__, __LINE__, \
203 ##__VA_ARGS__)
205 #endif /* CONFIG_XEN || CONFIG_VMX_GUEST */
207 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
208 #define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
209 #else
210 #define is_initial_xendomain() 0
211 #endif
213 #endif /* __HYPERVISOR_H__ */