ia64/linux-2.6.18-xen.hg

view include/asm-ia64/hypervisor.h @ 708:e410857fd83c

Remove contiguous_bitmap[] as it's no longer needed.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Oct 22 14:55:29 2008 +0100 (2008-10-22)
parents 71a415f9179b
children
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 #ifdef CONFIG_XEN
37 /* running_on_xen is set before executing any C code by early_xen_setup */
38 extern const int running_on_xen;
39 #define is_running_on_xen() (running_on_xen)
40 #else /* CONFIG_XEN */
41 # ifdef CONFIG_VMX_GUEST
42 # define is_running_on_xen() (1)
43 # else /* CONFIG_VMX_GUEST */
44 # define is_running_on_xen() (0)
45 # define HYPERVISOR_ioremap(offset, size) (offset)
46 # endif /* CONFIG_VMX_GUEST */
47 #endif /* CONFIG_XEN */
49 #if defined(CONFIG_XEN) || defined(CONFIG_VMX_GUEST)
50 #include <linux/types.h>
51 #include <linux/kernel.h>
52 #include <linux/version.h>
53 #include <linux/errno.h>
54 #include <xen/interface/xen.h>
55 #include <xen/interface/platform.h>
56 #include <xen/interface/event_channel.h>
57 #include <xen/interface/physdev.h>
58 #include <xen/interface/sched.h>
59 #include <xen/hypercall.h>
60 #include <asm/ptrace.h>
61 #include <asm/page.h>
63 extern shared_info_t *HYPERVISOR_shared_info;
64 extern start_info_t *xen_start_info;
66 void force_evtchn_callback(void);
68 /* Turn jiffies into Xen system time. XXX Implement me. */
69 #define jiffies_to_st(j) 0
71 static inline int
72 HYPERVISOR_yield(
73 void)
74 {
75 int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
77 return rc;
78 }
80 static inline int
81 HYPERVISOR_block(
82 void)
83 {
84 int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
86 return rc;
87 }
89 static inline int
90 HYPERVISOR_shutdown(
91 unsigned int reason)
92 {
93 struct sched_shutdown sched_shutdown = {
94 .reason = reason
95 };
97 int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
99 return rc;
100 }
102 static inline int
103 HYPERVISOR_poll(
104 evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
105 {
106 struct sched_poll sched_poll = {
107 .nr_ports = nr_ports,
108 .timeout = jiffies_to_st(timeout)
109 };
111 int rc;
113 set_xen_guest_handle(sched_poll.ports, ports);
114 rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
116 return rc;
117 }
119 #ifndef CONFIG_VMX_GUEST
120 /* for drivers/xen/privcmd/privcmd.c */
121 #define machine_to_phys_mapping 0
122 struct vm_area_struct;
123 int direct_remap_pfn_range(struct vm_area_struct *vma,
124 unsigned long address,
125 unsigned long mfn,
126 unsigned long size,
127 pgprot_t prot,
128 domid_t domid);
129 struct file;
130 int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma);
131 int privcmd_mmap(struct file * file, struct vm_area_struct * vma);
132 #define HAVE_ARCH_PRIVCMD_MMAP
134 /* for drivers/xen/balloon/balloon.c */
135 #ifdef CONFIG_XEN_SCRUB_PAGES
136 #define scrub_pages(_p,_n) memset((void *)(_p), 0, (_n) << PAGE_SHIFT)
137 #else
138 #define scrub_pages(_p,_n) ((void)0)
139 #endif
140 #define pte_mfn(_x) pte_pfn(_x)
141 #define phys_to_machine_mapping_valid(_x) (1)
143 int __xen_create_contiguous_region(unsigned long vstart, unsigned int order, unsigned int address_bits);
144 static inline int
145 xen_create_contiguous_region(unsigned long vstart,
146 unsigned int order, unsigned int address_bits)
147 {
148 int ret = 0;
149 if (is_running_on_xen()) {
150 ret = __xen_create_contiguous_region(vstart, order,
151 address_bits);
152 }
153 return ret;
154 }
156 void __xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
157 static inline void
158 xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
159 {
160 if (is_running_on_xen())
161 __xen_destroy_contiguous_region(vstart, order);
162 }
164 struct page;
166 int xen_limit_pages_to_max_mfn(struct page *pages, unsigned int order,
167 unsigned int address_bits);
169 /* For drivers/xen/core/machine_reboot.c */
170 #define HAVE_XEN_POST_SUSPEND
171 void xen_post_suspend(int suspend_cancelled);
173 /* For setup_arch() in arch/ia64/kernel/setup.c */
174 void xen_ia64_enable_opt_feature(void);
175 #endif /* !CONFIG_VMX_GUEST */
177 #define __pte_ma(_x) ((pte_t) {(_x)}) /* unmodified use */
178 #define pfn_pte_ma(_x,_y) __pte_ma(0) /* unmodified use */
180 /* for netfront.c, netback.c */
181 #define MULTI_UVMFLAGS_INDEX 0 /* XXX any value */
183 static inline void
184 MULTI_update_va_mapping(
185 multicall_entry_t *mcl, unsigned long va,
186 pte_t new_val, unsigned long flags)
187 {
188 mcl->op = __HYPERVISOR_update_va_mapping;
189 mcl->result = 0;
190 }
192 static inline void
193 MULTI_grant_table_op(multicall_entry_t *mcl, unsigned int cmd,
194 void *uop, unsigned int count)
195 {
196 mcl->op = __HYPERVISOR_grant_table_op;
197 mcl->args[0] = cmd;
198 mcl->args[1] = (unsigned long)uop;
199 mcl->args[2] = count;
200 }
202 /*
203 * for blktap.c
204 * int create_lookup_pte_addr(struct mm_struct *mm,
205 * unsigned long address,
206 * uint64_t *ptep);
207 */
208 #define create_lookup_pte_addr(mm, address, ptep) \
209 ({ \
210 printk(KERN_EMERG \
211 "%s:%d " \
212 "create_lookup_pte_addr() isn't supported.\n", \
213 __func__, __LINE__); \
214 BUG(); \
215 (-ENOSYS); \
216 })
218 /* for debug */
219 asmlinkage int xprintk(const char *fmt, ...);
220 #define xprintd(fmt, ...) xprintk("%s:%d " fmt, __func__, __LINE__, \
221 ##__VA_ARGS__)
223 #endif /* CONFIG_XEN || CONFIG_VMX_GUEST */
225 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
226 #define is_initial_xendomain() \
227 (is_running_on_xen() ? xen_start_info->flags & SIF_INITDOMAIN : 0)
228 #else
229 #define is_initial_xendomain() 0
230 #endif
232 #endif /* __HYPERVISOR_H__ */