ia64/xen-unstable

annotate linux-2.6-xen-sparse/include/asm-ia64/hypercall.h @ 10692:306d7857928c

[IA64] Save & restore.

xc_ia64_linux_save.c and xc_ia64_linux_restore.c added.
vcpu context has more registers and states (eg: tr registers).
Per cpu irqs are deallocated when cpu is switched off.
#if/#endif added in reboot.c for ia64.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Tue Jul 11 12:51:18 2006 -0600 (2006-07-11)
parents acabf4bdec4f
children c3e20511c745
rev   line source
djm@7031 1 /******************************************************************************
djm@7031 2 * hypercall.h
djm@7031 3 *
djm@7031 4 * Linux-specific hypervisor handling.
djm@7031 5 *
djm@7031 6 * Copyright (c) 2002-2004, K A Fraser
djm@7031 7 *
kaf24@9386 8 * This program is free software; you can redistribute it and/or
kaf24@9386 9 * modify it under the terms of the GNU General Public License version 2
kaf24@9386 10 * as published by the Free Software Foundation; or, when distributed
kaf24@9386 11 * separately from the Linux kernel or incorporated into other
kaf24@9386 12 * software packages, subject to the following license:
djm@7031 13 *
djm@7031 14 * Permission is hereby granted, free of charge, to any person obtaining a copy
djm@7031 15 * of this source file (the "Software"), to deal in the Software without
djm@7031 16 * restriction, including without limitation the rights to use, copy, modify,
djm@7031 17 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
djm@7031 18 * and to permit persons to whom the Software is furnished to do so, subject to
djm@7031 19 * the following conditions:
djm@7031 20 *
djm@7031 21 * The above copyright notice and this permission notice shall be included in
djm@7031 22 * all copies or substantial portions of the Software.
djm@7031 23 *
djm@7031 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
djm@7031 25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
djm@7031 26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
djm@7031 27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
djm@7031 28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
djm@7031 29 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
djm@7031 30 * IN THE SOFTWARE.
djm@7031 31 */
djm@7031 32
djm@7031 33 #ifndef __HYPERCALL_H__
djm@7031 34 #define __HYPERCALL_H__
kaf24@7205 35
kaf24@9908 36 #include <linux/string.h> /* memcpy() */
kaf24@9908 37
cl349@9540 38 #ifndef __HYPERVISOR_H__
cl349@9540 39 # error "please don't include this file directly"
cl349@9540 40 #endif
djm@7031 41
djm@7031 42 /*
djm@7031 43 * Assembler stubs for hyper-calls.
djm@7031 44 */
djm@7031 45
awilliam@8905 46 #define _hypercall0(type, name) \
awilliam@8905 47 ({ \
awilliam@8905 48 long __res; \
awilliam@8905 49 __asm__ __volatile__ (";;\n" \
awilliam@8905 50 "mov r2=%1\n" \
awilliam@8905 51 "break 0x1000 ;;\n" \
awilliam@8905 52 "mov %0=r8 ;;\n" \
awilliam@8905 53 : "=r" (__res) \
awilliam@8905 54 : "i" (__HYPERVISOR_##name) \
awilliam@9001 55 : "r2","r8", \
awilliam@9001 56 "memory" ); \
awilliam@8905 57 (type)__res; \
awilliam@8905 58 })
awilliam@8905 59
awilliam@8905 60 #define _hypercall1(type, name, a1) \
awilliam@8905 61 ({ \
awilliam@8905 62 long __res; \
awilliam@8905 63 __asm__ __volatile__ (";;\n" \
awilliam@8905 64 "mov r14=%2\n" \
awilliam@8905 65 "mov r2=%1\n" \
awilliam@8905 66 "break 0x1000 ;;\n" \
awilliam@8905 67 "mov %0=r8 ;;\n" \
awilliam@8905 68 : "=r" (__res) \
awilliam@8905 69 : "i" (__HYPERVISOR_##name), \
awilliam@8905 70 "r" ((unsigned long)(a1)) \
awilliam@8905 71 : "r14","r2","r8", \
awilliam@8905 72 "memory" ); \
awilliam@8905 73 (type)__res; \
awilliam@8905 74 })
awilliam@8905 75
awilliam@8905 76 #define _hypercall2(type, name, a1, a2) \
awilliam@8905 77 ({ \
awilliam@8905 78 long __res; \
awilliam@8905 79 __asm__ __volatile__ (";;\n" \
awilliam@8905 80 "mov r14=%2\n" \
awilliam@8905 81 "mov r15=%3\n" \
awilliam@8905 82 "mov r2=%1\n" \
awilliam@8905 83 "break 0x1000 ;;\n" \
awilliam@8905 84 "mov %0=r8 ;;\n" \
awilliam@8905 85 : "=r" (__res) \
awilliam@8905 86 : "i" (__HYPERVISOR_##name), \
awilliam@8905 87 "r" ((unsigned long)(a1)), \
awilliam@8905 88 "r" ((unsigned long)(a2)) \
awilliam@8905 89 : "r14","r15","r2","r8", \
awilliam@8905 90 "memory" ); \
awilliam@8905 91 (type)__res; \
awilliam@8905 92 })
awilliam@8905 93
awilliam@8905 94 #define _hypercall3(type, name, a1, a2, a3) \
awilliam@8905 95 ({ \
awilliam@8905 96 long __res; \
awilliam@8905 97 __asm__ __volatile__ (";;\n" \
awilliam@8905 98 "mov r14=%2\n" \
awilliam@8905 99 "mov r15=%3\n" \
awilliam@8905 100 "mov r16=%4\n" \
awilliam@8905 101 "mov r2=%1\n" \
awilliam@8905 102 "break 0x1000 ;;\n" \
awilliam@8905 103 "mov %0=r8 ;;\n" \
awilliam@8905 104 : "=r" (__res) \
awilliam@8905 105 : "i" (__HYPERVISOR_##name), \
awilliam@8905 106 "r" ((unsigned long)(a1)), \
awilliam@8905 107 "r" ((unsigned long)(a2)), \
awilliam@8905 108 "r" ((unsigned long)(a3)) \
awilliam@9001 109 : "r14","r15","r16","r2","r8", \
awilliam@9001 110 "memory" ); \
awilliam@8905 111 (type)__res; \
awilliam@8905 112 })
awilliam@8905 113
awilliam@9001 114 #define _hypercall4(type, name, a1, a2, a3, a4) \
awilliam@9001 115 ({ \
awilliam@9001 116 long __res; \
awilliam@9001 117 __asm__ __volatile__ (";;\n" \
awilliam@9001 118 "mov r14=%2\n" \
awilliam@9001 119 "mov r15=%3\n" \
awilliam@9001 120 "mov r16=%4\n" \
awilliam@9001 121 "mov r17=%5\n" \
awilliam@9001 122 "mov r2=%1\n" \
awilliam@9001 123 "break 0x1000 ;;\n" \
awilliam@9001 124 "mov %0=r8 ;;\n" \
awilliam@9001 125 : "=r" (__res) \
awilliam@9001 126 : "i" (__HYPERVISOR_##name), \
awilliam@9001 127 "r" ((unsigned long)(a1)), \
awilliam@9001 128 "r" ((unsigned long)(a2)), \
awilliam@9001 129 "r" ((unsigned long)(a3)), \
awilliam@9001 130 "r" ((unsigned long)(a4)) \
awilliam@9001 131 : "r14","r15","r16","r2","r8", \
awilliam@9001 132 "r17","memory" ); \
awilliam@9001 133 (type)__res; \
awilliam@9001 134 })
djm@7031 135
awilliam@9001 136 #define _hypercall5(type, name, a1, a2, a3, a4, a5) \
awilliam@9001 137 ({ \
awilliam@9001 138 long __res; \
awilliam@9001 139 __asm__ __volatile__ (";;\n" \
awilliam@9001 140 "mov r14=%2\n" \
awilliam@9001 141 "mov r15=%3\n" \
awilliam@9001 142 "mov r16=%4\n" \
awilliam@9001 143 "mov r17=%5\n" \
awilliam@9001 144 "mov r18=%6\n" \
awilliam@9001 145 "mov r2=%1\n" \
awilliam@9001 146 "break 0x1000 ;;\n" \
awilliam@9001 147 "mov %0=r8 ;;\n" \
awilliam@9001 148 : "=r" (__res) \
awilliam@9001 149 : "i" (__HYPERVISOR_##name), \
awilliam@9001 150 "r" ((unsigned long)(a1)), \
awilliam@9001 151 "r" ((unsigned long)(a2)), \
awilliam@9001 152 "r" ((unsigned long)(a3)), \
awilliam@9001 153 "r" ((unsigned long)(a4)), \
awilliam@9001 154 "r" ((unsigned long)(a5)) \
awilliam@9001 155 : "r14","r15","r16","r2","r8", \
awilliam@9001 156 "r17","r18","memory" ); \
awilliam@9001 157 (type)__res; \
awilliam@9001 158 })
djm@7031 159
djm@7031 160 static inline int
cl349@9540 161 HYPERVISOR_sched_op_compat(
kaf24@7205 162 int cmd, unsigned long arg)
djm@7031 163 {
cl349@9540 164 return _hypercall2(int, sched_op_compat, cmd, arg);
kaf24@9262 165 }
kaf24@9262 166
kaf24@9262 167 static inline int
cl349@9540 168 HYPERVISOR_sched_op(
cl349@9540 169 int cmd, void *arg)
kaf24@9262 170 {
cl349@9540 171 return _hypercall2(int, sched_op, cmd, arg);
kaf24@9262 172 }
kaf24@9262 173
djm@7031 174 static inline long
djm@7031 175 HYPERVISOR_set_timer_op(
djm@7031 176 u64 timeout)
djm@7031 177 {
djm@7031 178 unsigned long timeout_hi = (unsigned long)(timeout>>32);
djm@7031 179 unsigned long timeout_lo = (unsigned long)timeout;
awilliam@9001 180 return _hypercall2(long, set_timer_op, timeout_lo, timeout_hi);
djm@7031 181 }
djm@7031 182
djm@7031 183 static inline int
djm@7031 184 HYPERVISOR_dom0_op(
djm@7031 185 dom0_op_t *dom0_op)
djm@7031 186 {
djm@7031 187 dom0_op->interface_version = DOM0_INTERFACE_VERSION;
awilliam@9001 188 return _hypercall1(int, dom0_op, dom0_op);
djm@7031 189 }
djm@7031 190
djm@7031 191 static inline int
djm@7031 192 HYPERVISOR_multicall(
djm@7031 193 void *call_list, int nr_calls)
djm@7031 194 {
awilliam@9001 195 return _hypercall2(int, multicall, call_list, nr_calls);
djm@7031 196 }
kaf24@8286 197
awilliam@9979 198 #ifndef CONFIG_XEN_IA64_DOM0_VP
kaf24@8286 199 static inline int
kaf24@8286 200 HYPERVISOR_memory_op(
kaf24@8286 201 unsigned int cmd, void *arg)
kaf24@8286 202 {
awilliam@8905 203 return _hypercall2(int, memory_op, cmd, arg);
kaf24@8286 204 }
awilliam@9979 205 #else
awilliam@9979 206 //XXX xen/ia64 copy_from_guest() is broken.
awilliam@9979 207 // This is a temporal work around until it is fixed.
awilliam@9979 208 static inline int
awilliam@9979 209 ____HYPERVISOR_memory_op(
awilliam@9979 210 unsigned int cmd, void *arg)
awilliam@9979 211 {
awilliam@9979 212 return _hypercall2(int, memory_op, cmd, arg);
awilliam@9979 213 }
awilliam@9979 214
awilliam@9979 215 #include <xen/interface/memory.h>
awilliam@9979 216 int ia64_xenmem_reservation_op(unsigned long op,
awilliam@9979 217 struct xen_memory_reservation* reservation__);
awilliam@9979 218 static inline int
awilliam@9979 219 HYPERVISOR_memory_op(
awilliam@9979 220 unsigned int cmd, void *arg)
awilliam@9979 221 {
awilliam@9979 222 switch (cmd) {
awilliam@9979 223 case XENMEM_increase_reservation:
awilliam@9979 224 case XENMEM_decrease_reservation:
awilliam@9979 225 case XENMEM_populate_physmap:
awilliam@9979 226 return ia64_xenmem_reservation_op(cmd,
awilliam@9979 227 (struct xen_memory_reservation*)arg);
awilliam@9979 228 default:
awilliam@9979 229 return ____HYPERVISOR_memory_op(cmd, arg);
awilliam@9979 230 }
awilliam@9979 231 /* NOTREACHED */
awilliam@9979 232 }
awilliam@9979 233 #endif
djm@7031 234
djm@7031 235 static inline int
djm@7031 236 HYPERVISOR_event_channel_op(
kaf24@9896 237 int cmd, void *arg)
djm@7031 238 {
kaf24@9896 239 int rc = _hypercall2(int, event_channel_op, cmd, arg);
kaf24@9896 240 if (unlikely(rc == -ENOSYS)) {
kaf24@9896 241 struct evtchn_op op;
kaf24@9896 242 op.cmd = cmd;
kaf24@9896 243 memcpy(&op.u, arg, sizeof(op.u));
kaf24@9896 244 rc = _hypercall1(int, event_channel_op_compat, &op);
kaf24@9896 245 }
kaf24@9896 246 return rc;
djm@7031 247 }
djm@7031 248
djm@7031 249 static inline int
kaf24@10220 250 HYPERVISOR_acm_op(
kaf24@10220 251 unsigned int cmd, void *arg)
kaf24@10220 252 {
kfraser@10230 253 return _hypercall2(int, acm_op, cmd, arg);
kaf24@10220 254 }
kaf24@10220 255
kaf24@10220 256 static inline int
djm@7031 257 HYPERVISOR_xen_version(
awilliam@9001 258 int cmd, void *arg)
djm@7031 259 {
awilliam@9001 260 return _hypercall2(int, xen_version, cmd, arg);
djm@7031 261 }
djm@7031 262
djm@7031 263 static inline int
djm@7031 264 HYPERVISOR_console_io(
djm@7031 265 int cmd, int count, char *str)
djm@7031 266 {
awilliam@8905 267 return _hypercall3(int, console_io, cmd, count, str);
djm@7031 268 }
djm@7031 269
djm@7031 270 static inline int
djm@7031 271 HYPERVISOR_physdev_op(
kaf24@9896 272 int cmd, void *arg)
djm@7031 273 {
kaf24@9896 274 int rc = _hypercall2(int, physdev_op, cmd, arg);
kaf24@9896 275 if (unlikely(rc == -ENOSYS)) {
kaf24@9896 276 struct physdev_op op;
kaf24@9896 277 op.cmd = cmd;
kaf24@9896 278 memcpy(&op.u, arg, sizeof(op.u));
kaf24@9896 279 rc = _hypercall1(int, physdev_op_compat, &op);
kaf24@9896 280 }
kaf24@9896 281 return rc;
djm@7031 282 }
djm@7031 283
awilliam@9975 284 //XXX __HYPERVISOR_grant_table_op is used for this hypercall constant.
djm@7031 285 static inline int
awilliam@9975 286 ____HYPERVISOR_grant_table_op(
djm@7031 287 unsigned int cmd, void *uop, unsigned int count)
djm@7031 288 {
awilliam@8905 289 return _hypercall3(int, grant_table_op, cmd, uop, count);
djm@7031 290 }
awilliam@9975 291 #ifndef CONFIG_XEN_IA64_DOM0_VP
awilliam@9975 292 #define HYPERVISOR_grant_table_op(cmd, uop, count) \
awilliam@9975 293 ____HYPERVISOR_grant_table_op((cmd), (uop), (count))
awilliam@9975 294 #else
awilliam@9975 295 int HYPERVISOR_grant_table_op(unsigned int cmd, void *uop, unsigned int count);
awilliam@9975 296 #endif
djm@7031 297
djm@7031 298 static inline int
awilliam@9001 299 HYPERVISOR_vcpu_op(
awilliam@9001 300 int cmd, int vcpuid, void *extra_args)
djm@7031 301 {
awilliam@9001 302 return _hypercall3(int, vcpu_op, cmd, vcpuid, extra_args);
djm@7031 303 }
djm@7031 304
awilliam@10692 305 extern int HYPERVISOR_suspend(unsigned long srec);
djm@7031 306
awilliam@10140 307 static inline int
awilliam@10140 308 HYPERVISOR_callback_op(
awilliam@10140 309 int cmd, void *arg)
awilliam@10140 310 {
awilliam@10140 311 return _hypercall2(int, callback_op, cmd, arg);
awilliam@10140 312 }
awilliam@10140 313
awilliam@9001 314 extern fastcall unsigned int __do_IRQ(unsigned int irq, struct pt_regs *regs);
awilliam@9001 315 static inline void exit_idle(void) {}
awilliam@10140 316 #define do_IRQ(irq, regs) ({ \
awilliam@10140 317 irq_enter(); \
awilliam@10140 318 __do_IRQ((irq), (regs)); \
awilliam@10140 319 irq_exit(); \
awilliam@10140 320 })
djm@7031 321
awilliam@9761 322 #ifdef CONFIG_XEN_IA64_DOM0_VP
awilliam@10022 323 #include <linux/err.h>
awilliam@9761 324 #include <asm/xen/privop.h>
awilliam@9761 325
awilliam@9761 326 #define _hypercall_imm1(type, name, imm, a1) \
awilliam@9761 327 ({ \
awilliam@9761 328 long __res; \
awilliam@9761 329 __asm__ __volatile__ (";;\n" \
awilliam@9761 330 "mov r14=%2\n" \
awilliam@9761 331 "mov r15=%3\n" \
awilliam@9761 332 "mov r2=%1\n" \
awilliam@9761 333 "break 0x1000 ;;\n" \
awilliam@9761 334 "mov %0=r8 ;;\n" \
awilliam@9761 335 : "=r" (__res) \
awilliam@9761 336 : "i" (__HYPERVISOR_##name), \
awilliam@9761 337 "i" (imm), \
awilliam@9761 338 "r" ((unsigned long)(a1)) \
awilliam@9761 339 : "r14","r15","r2","r8", \
awilliam@9761 340 "memory" ); \
awilliam@9761 341 (type)__res; \
awilliam@9761 342 })
awilliam@9761 343
awilliam@9761 344 #define _hypercall_imm2(type, name, imm, a1, a2) \
awilliam@9761 345 ({ \
awilliam@9761 346 long __res; \
awilliam@9761 347 __asm__ __volatile__ (";;\n" \
awilliam@9761 348 "mov r14=%2\n" \
awilliam@9761 349 "mov r15=%3\n" \
awilliam@9761 350 "mov r16=%4\n" \
awilliam@9761 351 "mov r2=%1\n" \
awilliam@9761 352 "break 0x1000 ;;\n" \
awilliam@9761 353 "mov %0=r8 ;;\n" \
awilliam@9761 354 : "=r" (__res) \
awilliam@9761 355 : "i" (__HYPERVISOR_##name), \
awilliam@9761 356 "i" (imm), \
awilliam@9761 357 "r" ((unsigned long)(a1)), \
awilliam@9761 358 "r" ((unsigned long)(a2)) \
awilliam@9761 359 : "r14","r15","r16","r2","r8", \
awilliam@9761 360 "memory" ); \
awilliam@9761 361 (type)__res; \
awilliam@9761 362 })
awilliam@9761 363
awilliam@9761 364 #define _hypercall_imm3(type, name, imm, a1, a2, a3) \
awilliam@9761 365 ({ \
awilliam@9761 366 long __res; \
awilliam@9761 367 __asm__ __volatile__ (";;\n" \
awilliam@9761 368 "mov r14=%2\n" \
awilliam@9761 369 "mov r15=%3\n" \
awilliam@9761 370 "mov r16=%4\n" \
awilliam@9761 371 "mov r17=%5\n" \
awilliam@9761 372 "mov r2=%1\n" \
awilliam@9761 373 "break 0x1000 ;;\n" \
awilliam@9761 374 "mov %0=r8 ;;\n" \
awilliam@9761 375 : "=r" (__res) \
awilliam@9761 376 : "i" (__HYPERVISOR_##name), \
awilliam@9761 377 "i" (imm), \
awilliam@9761 378 "r" ((unsigned long)(a1)), \
awilliam@9761 379 "r" ((unsigned long)(a2)), \
awilliam@9761 380 "r" ((unsigned long)(a3)) \
awilliam@9761 381 : "r14","r15","r16","r17", \
awilliam@9761 382 "r2","r8", \
awilliam@9761 383 "memory" ); \
awilliam@9761 384 (type)__res; \
awilliam@9761 385 })
awilliam@9761 386
awilliam@9761 387 #define _hypercall_imm4(type, name, imm, a1, a2, a3, a4) \
awilliam@9761 388 ({ \
awilliam@9761 389 long __res; \
awilliam@9761 390 __asm__ __volatile__ (";;\n" \
awilliam@9761 391 "mov r14=%2\n" \
awilliam@9761 392 "mov r15=%3\n" \
awilliam@9761 393 "mov r16=%4\n" \
awilliam@9761 394 "mov r17=%5\n" \
awilliam@9761 395 "mov r18=%6\n" \
awilliam@9761 396 "mov r2=%1\n" \
awilliam@9761 397 "break 0x1000 ;;\n" \
awilliam@9761 398 "mov %0=r8 ;;\n" \
awilliam@9761 399 : "=r" (__res) \
awilliam@9761 400 : "i" (__HYPERVISOR_##name), \
awilliam@9761 401 "i" (imm), \
awilliam@9761 402 "r" ((unsigned long)(a1)), \
awilliam@9761 403 "r" ((unsigned long)(a2)), \
awilliam@9761 404 "r" ((unsigned long)(a3)), \
awilliam@9761 405 "r" ((unsigned long)(a4)) \
awilliam@9761 406 : "r14","r15","r16","r17","r18", \
awilliam@9761 407 "r2","r8", \
awilliam@9761 408 "memory" ); \
awilliam@9761 409 (type)__res; \
awilliam@9761 410 })
awilliam@9761 411
awilliam@9761 412 static inline unsigned long
awilliam@9761 413 __HYPERVISOR_ioremap(unsigned long ioaddr, unsigned long size)
awilliam@9761 414 {
awilliam@9761 415 return _hypercall_imm2(unsigned long, ia64_dom0vp_op,
awilliam@9761 416 IA64_DOM0VP_ioremap, ioaddr, size);
awilliam@9761 417 }
awilliam@9761 418
awilliam@9761 419 static inline unsigned long
awilliam@9761 420 HYPERVISOR_ioremap(unsigned long ioaddr, unsigned long size)
awilliam@9761 421 {
awilliam@9761 422 unsigned long ret = ioaddr;
awilliam@10198 423 if (is_running_on_xen()) {
awilliam@9761 424 ret = __HYPERVISOR_ioremap(ioaddr, size);
awilliam@10146 425 if (unlikely(ret == -ENOSYS))
awilliam@10022 426 panic("hypercall %s failed with %ld. "
awilliam@10022 427 "Please check Xen and Linux config mismatch\n",
awilliam@10022 428 __func__, -ret);
awilliam@10146 429 else if (unlikely(IS_ERR_VALUE(ret)))
awilliam@10146 430 ret = ioaddr;
awilliam@9761 431 }
awilliam@9761 432 return ret;
awilliam@9761 433 }
awilliam@9761 434
awilliam@9761 435 static inline unsigned long
awilliam@9761 436 __HYPERVISOR_phystomach(unsigned long gpfn)
awilliam@9761 437 {
awilliam@9761 438 return _hypercall_imm1(unsigned long, ia64_dom0vp_op,
awilliam@9761 439 IA64_DOM0VP_phystomach, gpfn);
awilliam@9761 440 }
awilliam@9761 441
awilliam@9761 442 static inline unsigned long
awilliam@9761 443 HYPERVISOR_phystomach(unsigned long gpfn)
awilliam@9761 444 {
awilliam@9761 445 unsigned long ret = gpfn;
awilliam@10198 446 if (is_running_on_xen()) {
awilliam@9761 447 ret = __HYPERVISOR_phystomach(gpfn);
awilliam@9761 448 }
awilliam@9761 449 return ret;
awilliam@9761 450 }
awilliam@9761 451
awilliam@9761 452 static inline unsigned long
awilliam@9761 453 __HYPERVISOR_machtophys(unsigned long mfn)
awilliam@9761 454 {
awilliam@9761 455 return _hypercall_imm1(unsigned long, ia64_dom0vp_op,
awilliam@9761 456 IA64_DOM0VP_machtophys, mfn);
awilliam@9761 457 }
awilliam@9761 458
awilliam@9761 459 static inline unsigned long
awilliam@9761 460 HYPERVISOR_machtophys(unsigned long mfn)
awilliam@9761 461 {
awilliam@9761 462 unsigned long ret = mfn;
awilliam@10198 463 if (is_running_on_xen()) {
awilliam@9761 464 ret = __HYPERVISOR_machtophys(mfn);
awilliam@9761 465 }
awilliam@9761 466 return ret;
awilliam@9761 467 }
awilliam@9761 468
awilliam@9761 469 static inline unsigned long
awilliam@9761 470 __HYPERVISOR_zap_physmap(unsigned long gpfn, unsigned int extent_order)
awilliam@9761 471 {
awilliam@9761 472 return _hypercall_imm2(unsigned long, ia64_dom0vp_op,
awilliam@9761 473 IA64_DOM0VP_zap_physmap, gpfn, extent_order);
awilliam@9761 474 }
awilliam@9761 475
awilliam@9761 476 static inline unsigned long
awilliam@9761 477 HYPERVISOR_zap_physmap(unsigned long gpfn, unsigned int extent_order)
awilliam@9761 478 {
awilliam@9761 479 unsigned long ret = 0;
awilliam@10198 480 if (is_running_on_xen()) {
awilliam@9761 481 ret = __HYPERVISOR_zap_physmap(gpfn, extent_order);
awilliam@9761 482 }
awilliam@9761 483 return ret;
awilliam@9761 484 }
awilliam@9761 485
awilliam@9761 486 static inline unsigned long
awilliam@9761 487 __HYPERVISOR_add_physmap(unsigned long gpfn, unsigned long mfn,
awilliam@10153 488 unsigned long flags, domid_t domid)
awilliam@9761 489 {
awilliam@9761 490 return _hypercall_imm4(unsigned long, ia64_dom0vp_op,
awilliam@9761 491 IA64_DOM0VP_add_physmap, gpfn, mfn, flags,
awilliam@9761 492 domid);
awilliam@9761 493 }
awilliam@10002 494
awilliam@9761 495 static inline unsigned long
awilliam@9761 496 HYPERVISOR_add_physmap(unsigned long gpfn, unsigned long mfn,
awilliam@10153 497 unsigned long flags, domid_t domid)
awilliam@9761 498 {
awilliam@9761 499 unsigned long ret = 0;
awilliam@10198 500 BUG_ON(!is_running_on_xen());//XXX
awilliam@10198 501 if (is_running_on_xen()) {
awilliam@9761 502 ret = __HYPERVISOR_add_physmap(gpfn, mfn, flags, domid);
awilliam@9761 503 }
awilliam@9761 504 return ret;
awilliam@9761 505 }
awilliam@9980 506
awilliam@9980 507 // for balloon driver
awilliam@9980 508 #define HYPERVISOR_update_va_mapping(va, new_val, flags) (0)
awilliam@9980 509
awilliam@9761 510 #else
awilliam@9970 511 #define HYPERVISOR_ioremap(ioaddr, size) (ioaddr)
awilliam@9970 512 #define HYPERVISOR_phystomach(gpfn) (gpfn)
awilliam@9970 513 #define HYPERVISOR_machtophys(mfn) (mfn)
awilliam@9970 514 #define HYPERVISOR_zap_physmap(gpfn, extent_order) (0)
awilliam@9970 515 #define HYPERVISOR_add_physmap(gpfn, mfn, flags) (0)
awilliam@9761 516 #endif
djm@7031 517 #endif /* __HYPERCALL_H__ */