ia64/xen-unstable

view xen/include/asm-ia64/vcpu.h @ 15328:883ede7d9c1c

[IA64] Fix xen build warning

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
author Alex Williamson <alex.williamson@hp.com>
date Tue Jun 12 16:54:19 2007 -0600 (2007-06-12)
parents 3e170567505a
children 88ab11d8fd1c
line source
1 #ifndef _XEN_IA64_VCPU_H
2 #define _XEN_IA64_VCPU_H
4 // TODO: Many (or perhaps most) of these should eventually be
5 // static inline functions
7 #include <asm/delay.h>
8 #include <asm/fpu.h>
9 #include <asm/tlb.h>
10 #include <asm/ia64_int.h>
11 #include <xen/types.h>
12 #include <public/xen.h>
13 #include <linux/acpi.h>
14 struct vcpu;
15 typedef struct vcpu VCPU;
16 typedef cpu_user_regs_t REGS;
17 extern u64 cycle_to_ns(u64 cycle);
19 /* Note: PSCB stands for Privilegied State Communication Block. */
20 #define VCPU(_v,_x) (_v->arch.privregs->_x)
21 #define PSCB(_v,_x) VCPU(_v,_x)
22 #define PSCBX(_v,_x) (_v->arch._x)
23 #define FP_PSR(_v) PSCBX(_v, fp_psr)
25 #define SPURIOUS_VECTOR 0xf
27 /* general registers */
28 extern u64 vcpu_get_gr(VCPU * vcpu, unsigned long reg);
29 extern IA64FAULT vcpu_get_gr_nat(VCPU * vcpu, unsigned long reg, u64 * val);
30 extern IA64FAULT vcpu_set_gr(VCPU * vcpu, unsigned long reg, u64 value,
31 int nat);
32 extern IA64FAULT vcpu_get_fpreg(VCPU * vcpu, unsigned long reg,
33 struct ia64_fpreg *val);
35 extern IA64FAULT vcpu_set_fpreg(VCPU * vcpu, unsigned long reg,
36 struct ia64_fpreg *val);
38 /* application registers */
39 extern void vcpu_load_kernel_regs(VCPU * vcpu);
40 extern IA64FAULT vcpu_set_ar(VCPU * vcpu, u64 reg, u64 val);
41 extern IA64FAULT vcpu_get_ar(VCPU * vcpu, u64 reg, u64 * val);
42 /* psr */
43 extern BOOLEAN vcpu_get_psr_ic(VCPU * vcpu);
44 extern u64 vcpu_get_psr(VCPU * vcpu);
45 extern IA64FAULT vcpu_set_psr(VCPU * vcpu, u64 val);
46 extern IA64FAULT vcpu_get_psr_masked(VCPU * vcpu, u64 * pval);
47 extern IA64FAULT vcpu_reset_psr_sm(VCPU * vcpu, u64 imm);
48 extern IA64FAULT vcpu_set_psr_sm(VCPU * vcpu, u64 imm);
49 extern IA64FAULT vcpu_set_psr_l(VCPU * vcpu, u64 val);
50 extern IA64FAULT vcpu_set_psr_i(VCPU * vcpu);
51 extern IA64FAULT vcpu_reset_psr_dt(VCPU * vcpu);
52 extern IA64FAULT vcpu_set_psr_dt(VCPU * vcpu);
53 /* control registers */
54 extern IA64FAULT vcpu_set_dcr(VCPU * vcpu, u64 val);
55 extern IA64FAULT vcpu_set_itm(VCPU * vcpu, u64 val);
56 extern IA64FAULT vcpu_set_iva(VCPU * vcpu, u64 val);
57 extern IA64FAULT vcpu_set_pta(VCPU * vcpu, u64 val);
58 extern IA64FAULT vcpu_set_ipsr(VCPU * vcpu, u64 val);
59 extern IA64FAULT vcpu_set_isr(VCPU * vcpu, u64 val);
60 extern IA64FAULT vcpu_set_iip(VCPU * vcpu, u64 val);
61 extern IA64FAULT vcpu_set_ifa(VCPU * vcpu, u64 val);
62 extern IA64FAULT vcpu_set_itir(VCPU * vcpu, u64 val);
63 extern IA64FAULT vcpu_set_iipa(VCPU * vcpu, u64 val);
64 extern IA64FAULT vcpu_set_ifs(VCPU * vcpu, u64 val);
65 extern IA64FAULT vcpu_set_iim(VCPU * vcpu, u64 val);
66 extern IA64FAULT vcpu_set_iha(VCPU * vcpu, u64 val);
67 extern IA64FAULT vcpu_set_lid(VCPU * vcpu, u64 val);
68 extern IA64FAULT vcpu_set_tpr(VCPU * vcpu, u64 val);
69 extern IA64FAULT vcpu_set_eoi(VCPU * vcpu, u64 val);
70 extern IA64FAULT vcpu_set_lrr0(VCPU * vcpu, u64 val);
71 extern IA64FAULT vcpu_set_lrr1(VCPU * vcpu, u64 val);
72 extern IA64FAULT vcpu_get_dcr(VCPU * vcpu, u64 * pval);
73 extern IA64FAULT vcpu_get_itm(VCPU * vcpu, u64 * pval);
74 extern IA64FAULT vcpu_get_iva(VCPU * vcpu, u64 * pval);
75 extern IA64FAULT vcpu_get_pta(VCPU * vcpu, u64 * pval);
76 extern IA64FAULT vcpu_get_ipsr(VCPU * vcpu, u64 * pval);
77 extern IA64FAULT vcpu_get_isr(VCPU * vcpu, u64 * pval);
78 extern IA64FAULT vcpu_get_iip(VCPU * vcpu, u64 * pval);
79 extern IA64FAULT vcpu_increment_iip(VCPU * vcpu);
80 extern IA64FAULT vcpu_decrement_iip(VCPU * vcpu);
81 extern IA64FAULT vcpu_get_ifa(VCPU * vcpu, u64 * pval);
82 extern IA64FAULT vcpu_get_itir(VCPU * vcpu, u64 * pval);
83 extern unsigned long vcpu_get_itir_on_fault(VCPU * vcpu, u64 ifa);
84 extern IA64FAULT vcpu_get_iipa(VCPU * vcpu, u64 * pval);
85 extern IA64FAULT vcpu_get_ifs(VCPU * vcpu, u64 * pval);
86 extern IA64FAULT vcpu_get_iim(VCPU * vcpu, u64 * pval);
87 extern IA64FAULT vcpu_get_iha(VCPU * vcpu, u64 * pval);
88 extern IA64FAULT vcpu_get_lid(VCPU * vcpu, u64 * pval);
89 extern IA64FAULT vcpu_get_tpr(VCPU * vcpu, u64 * pval);
90 extern IA64FAULT vcpu_get_irr0(VCPU * vcpu, u64 * pval);
91 extern IA64FAULT vcpu_get_irr1(VCPU * vcpu, u64 * pval);
92 extern IA64FAULT vcpu_get_irr2(VCPU * vcpu, u64 * pval);
93 extern IA64FAULT vcpu_get_irr3(VCPU * vcpu, u64 * pval);
94 extern IA64FAULT vcpu_get_lrr0(VCPU * vcpu, u64 * pval);
95 extern IA64FAULT vcpu_get_lrr1(VCPU * vcpu, u64 * pval);
96 /* interrupt registers */
97 extern void vcpu_pend_unspecified_interrupt(VCPU * vcpu);
98 extern u64 vcpu_check_pending_interrupts(VCPU * vcpu);
99 extern IA64FAULT vcpu_get_itv(VCPU * vcpu, u64 * pval);
100 extern IA64FAULT vcpu_get_pmv(VCPU * vcpu, u64 * pval);
101 extern IA64FAULT vcpu_get_cmcv(VCPU * vcpu, u64 * pval);
102 extern IA64FAULT vcpu_get_ivr(VCPU * vcpu, u64 * pval);
103 extern IA64FAULT vcpu_set_itv(VCPU * vcpu, u64 val);
104 extern IA64FAULT vcpu_set_pmv(VCPU * vcpu, u64 val);
105 extern IA64FAULT vcpu_set_cmcv(VCPU * vcpu, u64 val);
106 /* interval timer registers */
107 extern IA64FAULT vcpu_set_itc(VCPU * vcpu, u64 val);
108 extern u64 vcpu_timer_pending_early(VCPU * vcpu);
109 /* debug breakpoint registers */
110 extern IA64FAULT vcpu_set_ibr(VCPU * vcpu, u64 reg, u64 val);
111 extern IA64FAULT vcpu_set_dbr(VCPU * vcpu, u64 reg, u64 val);
112 extern IA64FAULT vcpu_get_ibr(VCPU * vcpu, u64 reg, u64 * pval);
113 extern IA64FAULT vcpu_get_dbr(VCPU * vcpu, u64 reg, u64 * pval);
114 /* performance monitor registers */
115 extern IA64FAULT vcpu_set_pmc(VCPU * vcpu, u64 reg, u64 val);
116 extern IA64FAULT vcpu_set_pmd(VCPU * vcpu, u64 reg, u64 val);
117 extern IA64FAULT vcpu_get_pmc(VCPU * vcpu, u64 reg, u64 * pval);
118 extern IA64FAULT vcpu_get_pmd(VCPU * vcpu, u64 reg, u64 * pval);
119 /* banked general registers */
120 extern IA64FAULT vcpu_bsw0(VCPU * vcpu);
121 extern IA64FAULT vcpu_bsw1(VCPU * vcpu);
122 /* region registers */
123 extern IA64FAULT vcpu_set_rr(VCPU * vcpu, u64 reg, u64 val);
124 extern IA64FAULT vcpu_get_rr(VCPU * vcpu, u64 reg, u64 * pval);
125 extern IA64FAULT vcpu_get_rr_ve(VCPU * vcpu, u64 vadr);
126 /* protection key registers */
127 extern IA64FAULT vcpu_get_pkr(VCPU * vcpu, u64 reg, u64 * pval);
128 extern IA64FAULT vcpu_set_pkr(VCPU * vcpu, u64 reg, u64 val);
129 extern IA64FAULT vcpu_tak(VCPU * vcpu, u64 vadr, u64 * key);
130 /* TLB */
131 static inline void vcpu_purge_tr_entry(TR_ENTRY * trp)
132 {
133 trp->pte.val = 0;
134 }
135 extern IA64FAULT vcpu_itr_d(VCPU * vcpu, u64 slot, u64 padr, u64 itir, u64 ifa);
136 extern IA64FAULT vcpu_itr_i(VCPU * vcpu, u64 slot, u64 padr, u64 itir, u64 ifa);
137 extern IA64FAULT vcpu_itc_d(VCPU * vcpu, u64 padr, u64 itir, u64 ifa);
138 extern IA64FAULT vcpu_itc_i(VCPU * vcpu, u64 padr, u64 itir, u64 ifa);
139 extern IA64FAULT vcpu_ptc_l(VCPU * vcpu, u64 vadr, u64 log_range);
140 extern IA64FAULT vcpu_ptc_e(VCPU * vcpu, u64 vadr);
141 extern IA64FAULT vcpu_ptc_g(VCPU * vcpu, u64 vadr, u64 addr_range);
142 extern IA64FAULT vcpu_ptc_ga(VCPU * vcpu, u64 vadr, u64 addr_range);
143 extern IA64FAULT vcpu_ptr_d(VCPU * vcpu, u64 vadr, u64 log_range);
144 extern IA64FAULT vcpu_ptr_i(VCPU * vcpu, u64 vadr, u64 log_range);
145 union U_IA64_BUNDLE;
146 extern int vcpu_get_domain_bundle(VCPU * vcpu, REGS * regs, u64 gip,
147 union U_IA64_BUNDLE *bundle);
148 extern IA64FAULT vcpu_translate(VCPU * vcpu, u64 address, BOOLEAN is_data,
149 u64 * pteval, u64 * itir, u64 * iha);
150 extern IA64FAULT vcpu_tpa(VCPU * vcpu, u64 vadr, u64 * padr);
151 extern IA64FAULT vcpu_force_inst_miss(VCPU * vcpu, u64 ifa);
152 extern IA64FAULT vcpu_force_data_miss(VCPU * vcpu, u64 ifa);
153 extern IA64FAULT vcpu_fc(VCPU * vcpu, u64 vadr);
154 /* misc */
155 extern IA64FAULT vcpu_rfi(VCPU * vcpu);
156 extern IA64FAULT vcpu_thash(VCPU * vcpu, u64 vadr, u64 * pval);
157 extern IA64FAULT vcpu_cover(VCPU * vcpu);
158 extern IA64FAULT vcpu_ttag(VCPU * vcpu, u64 vadr, u64 * padr);
159 extern IA64FAULT vcpu_get_cpuid(VCPU * vcpu, u64 reg, u64 * pval);
161 extern void vcpu_pend_interrupt(VCPU * vcpu, u64 vector);
162 extern void vcpu_pend_timer(VCPU * vcpu);
163 extern void vcpu_poke_timer(VCPU * vcpu);
164 extern void vcpu_set_next_timer(VCPU * vcpu);
165 extern BOOLEAN vcpu_timer_expired(VCPU * vcpu);
166 extern u64 vcpu_deliverable_interrupts(VCPU * vcpu);
167 struct p2m_entry;
168 extern void vcpu_itc_no_srlz(VCPU * vcpu, u64, u64, u64, u64, u64,
169 struct p2m_entry *);
170 extern u64 vcpu_get_tmp(VCPU *, u64);
171 extern void vcpu_set_tmp(VCPU *, u64, u64);
173 extern IA64FAULT vcpu_set_dtr(VCPU * vcpu, u64 slot,
174 u64 pte, u64 itir, u64 ifa, u64 rid);
175 extern IA64FAULT vcpu_set_itr(VCPU * vcpu, u64 slot,
176 u64 pte, u64 itir, u64 ifa, u64 rid);
178 /* Initialize vcpu regs. */
179 extern void vcpu_init_regs(struct vcpu *v);
181 static inline u64 itir_ps(u64 itir)
182 {
183 return ((itir >> 2) & 0x3f);
184 }
186 static inline u64 itir_mask(u64 itir)
187 {
188 return (~((1UL << itir_ps(itir)) - 1));
189 }
191 static inline s64 vcpu_get_next_timer_ns(VCPU * vcpu)
192 {
193 s64 vcpu_get_next_timer_ns;
194 u64 d = PSCBX(vcpu, domain_itm);
195 u64 now = ia64_get_itc();
197 if (d > now)
198 vcpu_get_next_timer_ns = cycle_to_ns(d - now) + NOW();
199 else
200 vcpu_get_next_timer_ns =
201 cycle_to_ns(local_cpu_data->itm_delta) + NOW();
203 return vcpu_get_next_timer_ns;
204 }
206 #define verbose(a...) do {if (vcpu_verbose) printk(a);} while(0)
208 //#define vcpu_quick_region_check(_tr_regions,_ifa) 1
209 #define vcpu_quick_region_check(_tr_regions,_ifa) \
210 (_tr_regions & (1 << ((unsigned long)_ifa >> 61)))
211 #define vcpu_quick_region_set(_tr_regions,_ifa) \
212 do {_tr_regions |= (1 << ((unsigned long)_ifa >> 61)); } while (0)
214 #endif