ia64/xen-unstable

view linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h @ 13341:3040ba0f2d3d

When booting via xm, only run the bootloader if it's in non-interactive mode:
otherwise we lose the user's named kernel and try to bootload the temporary
file pygrub returned.

Signed-off-by: John Levon <john.levon@sun.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Tue Jan 09 13:24:45 2007 +0000 (2007-01-09)
parents 2ae4e4e89d6d
children 168030c8e0a9
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/event_channel.h>
44 #include <xen/interface/physdev.h>
45 #include <xen/interface/sched.h>
46 #include <xen/interface/nmi.h>
47 #include <asm/ptrace.h>
48 #include <asm/page.h>
49 #if defined(__i386__)
50 # ifdef CONFIG_X86_PAE
51 # include <asm-generic/pgtable-nopud.h>
52 # else
53 # include <asm-generic/pgtable-nopmd.h>
54 # endif
55 #endif
57 extern shared_info_t *HYPERVISOR_shared_info;
59 #ifdef CONFIG_X86_32
60 extern unsigned long hypervisor_virt_start;
61 #endif
63 /* arch/xen/i386/kernel/setup.c */
64 extern start_info_t *xen_start_info;
65 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
66 #define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
67 #else
68 #define is_initial_xendomain() 0
69 #endif
71 /* arch/xen/kernel/evtchn.c */
72 /* Force a proper event-channel callback from Xen. */
73 void force_evtchn_callback(void);
75 /* arch/xen/kernel/process.c */
76 void xen_cpu_idle (void);
78 /* arch/xen/i386/kernel/hypervisor.c */
79 void do_hypervisor_callback(struct pt_regs *regs);
81 /* arch/xen/i386/mm/hypervisor.c */
82 /*
83 * NB. ptr values should be PHYSICAL, not MACHINE. 'vals' should be already
84 * be MACHINE addresses.
85 */
87 void xen_pt_switch(unsigned long ptr);
88 void xen_new_user_pt(unsigned long ptr); /* x86_64 only */
89 void xen_load_gs(unsigned int selector); /* x86_64 only */
90 void xen_tlb_flush(void);
91 void xen_invlpg(unsigned long ptr);
93 void xen_l1_entry_update(pte_t *ptr, pte_t val);
94 void xen_l2_entry_update(pmd_t *ptr, pmd_t val);
95 void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */
96 void xen_l4_entry_update(pgd_t *ptr, pgd_t val); /* x86_64 only */
97 void xen_pgd_pin(unsigned long ptr);
98 void xen_pgd_unpin(unsigned long ptr);
100 void xen_set_ldt(unsigned long ptr, unsigned long bytes);
102 #ifdef CONFIG_SMP
103 #include <linux/cpumask.h>
104 void xen_tlb_flush_all(void);
105 void xen_invlpg_all(unsigned long ptr);
106 void xen_tlb_flush_mask(cpumask_t *mask);
107 void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr);
108 #endif
110 /* Returns zero on success else negative errno. */
111 int xen_create_contiguous_region(
112 unsigned long vstart, unsigned int order, unsigned int address_bits);
113 void xen_destroy_contiguous_region(
114 unsigned long vstart, unsigned int order);
116 /* Turn jiffies into Xen system time. */
117 u64 jiffies_to_st(unsigned long jiffies);
119 #include <asm/hypercall.h>
121 #if defined(CONFIG_X86_64)
122 #define MULTI_UVMFLAGS_INDEX 2
123 #define MULTI_UVMDOMID_INDEX 3
124 #else
125 #define MULTI_UVMFLAGS_INDEX 3
126 #define MULTI_UVMDOMID_INDEX 4
127 #endif
129 #define is_running_on_xen() 1
131 static inline int
132 HYPERVISOR_yield(
133 void)
134 {
135 int rc = HYPERVISOR_sched_op(SCHEDOP_yield, NULL);
137 #ifdef CONFIG_XEN_COMPAT_030002
138 if (rc == -ENOSYS)
139 rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
140 #endif
142 return rc;
143 }
145 static inline int
146 HYPERVISOR_block(
147 void)
148 {
149 int rc = HYPERVISOR_sched_op(SCHEDOP_block, NULL);
151 #ifdef CONFIG_XEN_COMPAT_030002
152 if (rc == -ENOSYS)
153 rc = HYPERVISOR_sched_op_compat(SCHEDOP_block, 0);
154 #endif
156 return rc;
157 }
159 static inline int
160 HYPERVISOR_shutdown(
161 unsigned int reason)
162 {
163 struct sched_shutdown sched_shutdown = {
164 .reason = reason
165 };
167 int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
169 #ifdef CONFIG_XEN_COMPAT_030002
170 if (rc == -ENOSYS)
171 rc = HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, reason);
172 #endif
174 return rc;
175 }
177 static inline int
178 HYPERVISOR_poll(
179 evtchn_port_t *ports, unsigned int nr_ports, u64 timeout)
180 {
181 int rc;
182 struct sched_poll sched_poll = {
183 .nr_ports = nr_ports,
184 .timeout = jiffies_to_st(timeout)
185 };
186 set_xen_guest_handle(sched_poll.ports, ports);
188 rc = HYPERVISOR_sched_op(SCHEDOP_poll, &sched_poll);
189 #ifdef CONFIG_XEN_COMPAT_030002
190 if (rc == -ENOSYS)
191 rc = HYPERVISOR_sched_op_compat(SCHEDOP_yield, 0);
192 #endif
194 return rc;
195 }
197 static inline void
198 MULTI_update_va_mapping(
199 multicall_entry_t *mcl, unsigned long va,
200 pte_t new_val, unsigned long flags)
201 {
202 mcl->op = __HYPERVISOR_update_va_mapping;
203 mcl->args[0] = va;
204 #if defined(CONFIG_X86_64)
205 mcl->args[1] = new_val.pte;
206 #elif defined(CONFIG_X86_PAE)
207 mcl->args[1] = new_val.pte_low;
208 mcl->args[2] = new_val.pte_high;
209 #else
210 mcl->args[1] = new_val.pte_low;
211 mcl->args[2] = 0;
212 #endif
213 mcl->args[MULTI_UVMFLAGS_INDEX] = flags;
214 }
216 static inline void
217 MULTI_grant_table_op(multicall_entry_t *mcl, unsigned int cmd,
218 void *uop, unsigned int count)
219 {
220 mcl->op = __HYPERVISOR_grant_table_op;
221 mcl->args[0] = cmd;
222 mcl->args[1] = (unsigned long)uop;
223 mcl->args[2] = count;
224 }
226 static inline void
227 MULTI_update_va_mapping_otherdomain(
228 multicall_entry_t *mcl, unsigned long va,
229 pte_t new_val, unsigned long flags, domid_t domid)
230 {
231 mcl->op = __HYPERVISOR_update_va_mapping_otherdomain;
232 mcl->args[0] = va;
233 #if defined(CONFIG_X86_64)
234 mcl->args[1] = new_val.pte;
235 #elif defined(CONFIG_X86_PAE)
236 mcl->args[1] = new_val.pte_low;
237 mcl->args[2] = new_val.pte_high;
238 #else
239 mcl->args[1] = new_val.pte_low;
240 mcl->args[2] = 0;
241 #endif
242 mcl->args[MULTI_UVMFLAGS_INDEX] = flags;
243 mcl->args[MULTI_UVMDOMID_INDEX] = domid;
244 }
246 #endif /* __HYPERVISOR_H__ */