Commit | Line | Data |
---|---|---|
1ff730b5 IY |
1 | /****************************************************************************** |
2 | * include/asm-ia64/paravirt_privops.h | |
3 | * | |
4 | * Copyright (c) 2008 Isaku Yamahata <yamahata at valinux co jp> | |
5 | * VA Linux Systems Japan K.K. | |
6 | * | |
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. | |
11 | * | |
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. | |
16 | * | |
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 | |
20 | * | |
21 | */ | |
22 | ||
23 | #ifndef _ASM_IA64_PARAVIRT_PRIVOP_H | |
24 | #define _ASM_IA64_PARAVIRT_PRIVOP_H | |
25 | ||
26 | #ifdef CONFIG_PARAVIRT | |
27 | ||
28 | #ifndef __ASSEMBLY__ | |
29 | ||
30 | #include <linux/types.h> | |
31 | #include <asm/kregs.h> /* for IA64_PSR_I */ | |
32 | ||
33 | /****************************************************************************** | |
34 | * replacement of intrinsics operations. | |
35 | */ | |
36 | ||
37 | struct pv_cpu_ops { | |
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, | |
49 | unsigned long val4); | |
50 | void (*ssm_i)(void); | |
51 | void (*rsm_i)(void); | |
52 | unsigned long (*get_psr_i)(void); | |
53 | void (*intrin_local_irq_restore)(unsigned long flags); | |
54 | }; | |
55 | ||
56 | extern struct pv_cpu_ops pv_cpu_ops; | |
57 | ||
58 | extern void ia64_native_setreg_func(int regnum, unsigned long val); | |
59 | extern unsigned long ia64_native_getreg_func(int regnum); | |
60 | ||
61 | /************************************************/ | |
62 | /* Instructions paravirtualized for performance */ | |
63 | /************************************************/ | |
64 | ||
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) \ | |
68 | do { \ | |
69 | if ((mask) == IA64_PSR_I) \ | |
70 | pv_cpu_ops.ssm_i(); \ | |
71 | else \ | |
72 | ia64_native_ssm(mask); \ | |
73 | } while (0) | |
74 | ||
75 | #define paravirt_rsm(mask) \ | |
76 | do { \ | |
77 | if ((mask) == IA64_PSR_I) \ | |
78 | pv_cpu_ops.rsm_i(); \ | |
79 | else \ | |
80 | ia64_native_rsm(mask); \ | |
81 | } while (0) | |
82 | ||
4df8d22b IY |
83 | /****************************************************************************** |
84 | * replacement of hand written assembly codes. | |
85 | */ | |
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; | |
91 | }; | |
92 | void paravirt_cpu_asm_init(const struct pv_cpu_asm_switch *cpu_asm_switch); | |
93 | ||
1ff730b5 IY |
94 | #endif /* __ASSEMBLY__ */ |
95 | ||
4df8d22b IY |
96 | #define IA64_PARAVIRT_ASM_FUNC(name) paravirt_ ## name |
97 | ||
1ff730b5 IY |
98 | #else |
99 | ||
100 | /* fallback for native case */ | |
4df8d22b | 101 | #define IA64_PARAVIRT_ASM_FUNC(name) ia64_native_ ## name |
1ff730b5 IY |
102 | |
103 | #endif /* CONFIG_PARAVIRT */ | |
104 | ||
4df8d22b IY |
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) | |
113 | ||
1ff730b5 | 114 | #endif /* _ASM_IA64_PARAVIRT_PRIVOP_H */ |