1 /******************************************************************************
2 * include/asm-ia64/paravirt_privops.h
4 * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp>
5 * VA Linux Systems Japan K.K.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef _ASM_IA64_PARAVIRT_PRIVOP_H
24 #define _ASM_IA64_PARAVIRT_PRIVOP_H
26 #ifdef CONFIG_PARAVIRT
30 #include <linux/types.h>
31 #include <asm/kregs.h> /* for IA64_PSR_I */
33 /******************************************************************************
34 * replacement of intrinsics operations.
38 void (*fc)(unsigned long addr);
39 unsigned long (*thash)(unsigned long addr);
40 unsigned long (*get_cpuid)(int index);
41 unsigned long (*get_pmd)(int index);
42 unsigned long (*getreg)(int reg);
43 void (*setreg)(int reg, unsigned long val);
44 void (*ptcga)(unsigned long addr, unsigned long size);
45 unsigned long (*get_rr)(unsigned long index);
46 void (*set_rr)(unsigned long index, unsigned long val);
47 void (*set_rr0_to_rr4)(unsigned long val0, unsigned long val1,
48 unsigned long val2, unsigned long val3,
52 unsigned long (*get_psr_i)(void);
53 void (*intrin_local_irq_restore)(unsigned long flags);
56 extern struct pv_cpu_ops pv_cpu_ops;
58 extern void ia64_native_setreg_func(int regnum, unsigned long val);
59 extern unsigned long ia64_native_getreg_func(int regnum);
61 /************************************************/
62 /* Instructions paravirtualized for performance */
63 /************************************************/
65 /* mask for ia64_native_ssm/rsm() must be constant.("i" constraing).
66 * static inline function doesn't satisfy it. */
67 #define paravirt_ssm(mask) \
69 if ((mask) == IA64_PSR_I) \
72 ia64_native_ssm(mask); \
75 #define paravirt_rsm(mask) \
77 if ((mask) == IA64_PSR_I) \
80 ia64_native_rsm(mask); \
83 /******************************************************************************
84 * replacement of hand written assembly codes.
86 struct pv_cpu_asm_switch {
87 unsigned long switch_to;
88 unsigned long leave_syscall;
89 unsigned long work_processed_syscall;
90 unsigned long leave_kernel;
92 void paravirt_cpu_asm_init(const struct pv_cpu_asm_switch *cpu_asm_switch);
94 #endif /* __ASSEMBLY__ */
96 #define IA64_PARAVIRT_ASM_FUNC(name) paravirt_ ## name
100 /* fallback for native case */
101 #define IA64_PARAVIRT_ASM_FUNC(name) ia64_native_ ## name
103 #endif /* CONFIG_PARAVIRT */
105 /* these routines utilize privilege-sensitive or performance-sensitive
106 * privileged instructions so the code must be replaced with
107 * paravirtualized versions */
108 #define ia64_switch_to IA64_PARAVIRT_ASM_FUNC(switch_to)
109 #define ia64_leave_syscall IA64_PARAVIRT_ASM_FUNC(leave_syscall)
110 #define ia64_work_processed_syscall \
111 IA64_PARAVIRT_ASM_FUNC(work_processed_syscall)
112 #define ia64_leave_kernel IA64_PARAVIRT_ASM_FUNC(leave_kernel)
114 #endif /* _ASM_IA64_PARAVIRT_PRIVOP_H */