ia64/xen-unstable

view xen/include/public/arch-ia64.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 63595abd80c5
children 8d501f39286c
line source
1 /******************************************************************************
2 * arch-ia64/hypervisor-if.h
3 *
4 * Guest OS interface to IA64 Xen.
5 */
7 #ifndef __HYPERVISOR_IF_IA64_H__
8 #define __HYPERVISOR_IF_IA64_H__
10 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
11 typedef struct { type *p; } __guest_handle_ ## name
13 #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
14 #define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
15 #define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0)
16 #ifdef __XEN_TOOLS__
17 #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
18 #endif
20 #ifndef __ASSEMBLY__
21 /* Guest handles for primitive C types. */
22 __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);
23 __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int);
24 __DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);
25 DEFINE_XEN_GUEST_HANDLE(char);
26 DEFINE_XEN_GUEST_HANDLE(int);
27 DEFINE_XEN_GUEST_HANDLE(long);
28 DEFINE_XEN_GUEST_HANDLE(void);
30 typedef unsigned long xen_pfn_t;
31 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
32 #endif
34 /* Arch specific VIRQs definition */
35 #define VIRQ_ITC VIRQ_ARCH_0 /* V. Virtual itc timer */
37 /* Maximum number of virtual CPUs in multi-processor guests. */
38 /* WARNING: before changing this, check that shared_info fits on a page */
39 #define MAX_VIRT_CPUS 64
41 #ifndef __ASSEMBLY__
43 typedef unsigned long xen_ulong_t;
45 #define GPFN_MEM (0UL << 56) /* Guest pfn is normal mem */
46 #define GPFN_FRAME_BUFFER (1UL << 56) /* VGA framebuffer */
47 #define GPFN_LOW_MMIO (2UL << 56) /* Low MMIO range */
48 #define GPFN_PIB (3UL << 56) /* PIB base */
49 #define GPFN_IOSAPIC (4UL << 56) /* IOSAPIC base */
50 #define GPFN_LEGACY_IO (5UL << 56) /* Legacy I/O base */
51 #define GPFN_GFW (6UL << 56) /* Guest Firmware */
52 #define GPFN_HIGH_MMIO (7UL << 56) /* High MMIO range */
54 #define GPFN_IO_MASK (7UL << 56) /* Guest pfn is I/O type */
55 #define GPFN_INV_MASK (31UL << 59) /* Guest pfn is invalid */
57 #define INVALID_MFN (~0UL)
59 #define MEM_G (1UL << 30)
60 #define MEM_M (1UL << 20)
62 #define MMIO_START (3 * MEM_G)
63 #define MMIO_SIZE (512 * MEM_M)
65 #define VGA_IO_START 0xA0000UL
66 #define VGA_IO_SIZE 0x20000
68 #define LEGACY_IO_START (MMIO_START + MMIO_SIZE)
69 #define LEGACY_IO_SIZE (64*MEM_M)
71 #define IO_PAGE_START (LEGACY_IO_START + LEGACY_IO_SIZE)
72 #define IO_PAGE_SIZE PAGE_SIZE
74 #define STORE_PAGE_START (IO_PAGE_START + IO_PAGE_SIZE)
75 #define STORE_PAGE_SIZE PAGE_SIZE
77 #define IO_SAPIC_START 0xfec00000UL
78 #define IO_SAPIC_SIZE 0x100000
80 #define PIB_START 0xfee00000UL
81 #define PIB_SIZE 0x200000
83 #define GFW_START (4*MEM_G -16*MEM_M)
84 #define GFW_SIZE (16*MEM_M)
86 struct pt_fpreg {
87 union {
88 unsigned long bits[2];
89 long double __dummy; /* force 16-byte alignment */
90 } u;
91 };
93 struct cpu_user_regs {
94 /* The following registers are saved by SAVE_MIN: */
95 unsigned long b6; /* scratch */
96 unsigned long b7; /* scratch */
98 unsigned long ar_csd; /* used by cmp8xchg16 (scratch) */
99 unsigned long ar_ssd; /* reserved for future use (scratch) */
101 unsigned long r8; /* scratch (return value register 0) */
102 unsigned long r9; /* scratch (return value register 1) */
103 unsigned long r10; /* scratch (return value register 2) */
104 unsigned long r11; /* scratch (return value register 3) */
106 unsigned long cr_ipsr; /* interrupted task's psr */
107 unsigned long cr_iip; /* interrupted task's instruction pointer */
108 unsigned long cr_ifs; /* interrupted task's function state */
110 unsigned long ar_unat; /* interrupted task's NaT register (preserved) */
111 unsigned long ar_pfs; /* prev function state */
112 unsigned long ar_rsc; /* RSE configuration */
113 /* The following two are valid only if cr_ipsr.cpl > 0: */
114 unsigned long ar_rnat; /* RSE NaT */
115 unsigned long ar_bspstore; /* RSE bspstore */
117 unsigned long pr; /* 64 predicate registers (1 bit each) */
118 unsigned long b0; /* return pointer (bp) */
119 unsigned long loadrs; /* size of dirty partition << 16 */
121 unsigned long r1; /* the gp pointer */
122 unsigned long r12; /* interrupted task's memory stack pointer */
123 unsigned long r13; /* thread pointer */
125 unsigned long ar_fpsr; /* floating point status (preserved) */
126 unsigned long r15; /* scratch */
128 /* The remaining registers are NOT saved for system calls. */
130 unsigned long r14; /* scratch */
131 unsigned long r2; /* scratch */
132 unsigned long r3; /* scratch */
133 unsigned long r16; /* scratch */
134 unsigned long r17; /* scratch */
135 unsigned long r18; /* scratch */
136 unsigned long r19; /* scratch */
137 unsigned long r20; /* scratch */
138 unsigned long r21; /* scratch */
139 unsigned long r22; /* scratch */
140 unsigned long r23; /* scratch */
141 unsigned long r24; /* scratch */
142 unsigned long r25; /* scratch */
143 unsigned long r26; /* scratch */
144 unsigned long r27; /* scratch */
145 unsigned long r28; /* scratch */
146 unsigned long r29; /* scratch */
147 unsigned long r30; /* scratch */
148 unsigned long r31; /* scratch */
149 unsigned long ar_ccv; /* compare/exchange value (scratch) */
151 /*
152 * Floating point registers that the kernel considers scratch:
153 */
154 struct pt_fpreg f6; /* scratch */
155 struct pt_fpreg f7; /* scratch */
156 struct pt_fpreg f8; /* scratch */
157 struct pt_fpreg f9; /* scratch */
158 struct pt_fpreg f10; /* scratch */
159 struct pt_fpreg f11; /* scratch */
160 unsigned long r4; /* preserved */
161 unsigned long r5; /* preserved */
162 unsigned long r6; /* preserved */
163 unsigned long r7; /* preserved */
164 unsigned long eml_unat; /* used for emulating instruction */
165 unsigned long pad0; /* alignment pad */
167 };
168 typedef struct cpu_user_regs cpu_user_regs_t;
170 union vac {
171 unsigned long value;
172 struct {
173 int a_int:1;
174 int a_from_int_cr:1;
175 int a_to_int_cr:1;
176 int a_from_psr:1;
177 int a_from_cpuid:1;
178 int a_cover:1;
179 int a_bsw:1;
180 long reserved:57;
181 };
182 };
183 typedef union vac vac_t;
185 union vdc {
186 unsigned long value;
187 struct {
188 int d_vmsw:1;
189 int d_extint:1;
190 int d_ibr_dbr:1;
191 int d_pmc:1;
192 int d_to_pmd:1;
193 int d_itm:1;
194 long reserved:58;
195 };
196 };
197 typedef union vdc vdc_t;
199 struct mapped_regs {
200 union vac vac;
201 union vdc vdc;
202 unsigned long virt_env_vaddr;
203 unsigned long reserved1[29];
204 unsigned long vhpi;
205 unsigned long reserved2[95];
206 union {
207 unsigned long vgr[16];
208 unsigned long bank1_regs[16]; // bank1 regs (r16-r31) when bank0 active
209 };
210 union {
211 unsigned long vbgr[16];
212 unsigned long bank0_regs[16]; // bank0 regs (r16-r31) when bank1 active
213 };
214 unsigned long vnat;
215 unsigned long vbnat;
216 unsigned long vcpuid[5];
217 unsigned long reserved3[11];
218 unsigned long vpsr;
219 unsigned long vpr;
220 unsigned long reserved4[76];
221 union {
222 unsigned long vcr[128];
223 struct {
224 unsigned long dcr; // CR0
225 unsigned long itm;
226 unsigned long iva;
227 unsigned long rsv1[5];
228 unsigned long pta; // CR8
229 unsigned long rsv2[7];
230 unsigned long ipsr; // CR16
231 unsigned long isr;
232 unsigned long rsv3;
233 unsigned long iip;
234 unsigned long ifa;
235 unsigned long itir;
236 unsigned long iipa;
237 unsigned long ifs;
238 unsigned long iim; // CR24
239 unsigned long iha;
240 unsigned long rsv4[38];
241 unsigned long lid; // CR64
242 unsigned long ivr;
243 unsigned long tpr;
244 unsigned long eoi;
245 unsigned long irr[4];
246 unsigned long itv; // CR72
247 unsigned long pmv;
248 unsigned long cmcv;
249 unsigned long rsv5[5];
250 unsigned long lrr0; // CR80
251 unsigned long lrr1;
252 unsigned long rsv6[46];
253 };
254 };
255 union {
256 unsigned long reserved5[128];
257 struct {
258 unsigned long precover_ifs;
259 unsigned long unat; // not sure if this is needed until NaT arch is done
260 int interrupt_collection_enabled; // virtual psr.ic
261 /* virtual interrupt deliverable flag is evtchn_upcall_mask in
262 * shared info area now. interrupt_mask_addr is the address
263 * of evtchn_upcall_mask for current vcpu
264 */
265 unsigned char *interrupt_mask_addr;
266 int pending_interruption;
267 int incomplete_regframe; // see SDM vol2 6.8
268 unsigned char vpsr_pp;
269 unsigned char reserved5_2[7];
270 unsigned long reserved5_1[3];
271 int metaphysical_mode; // 1 = use metaphys mapping, 0 = use virtual
272 int banknum; // 0 or 1, which virtual register bank is active
273 unsigned long rrs[8]; // region registers
274 unsigned long krs[8]; // kernel registers
275 unsigned long pkrs[8]; // protection key registers
276 unsigned long tmp[8]; // temp registers (e.g. for hyperprivops)
277 };
278 };
279 };
280 typedef struct mapped_regs mapped_regs_t;
282 struct vpd {
283 struct mapped_regs vpd_low;
284 unsigned long reserved6[3456];
285 unsigned long vmm_avail[128];
286 unsigned long reserved7[4096];
287 };
288 typedef struct vpd vpd_t;
290 struct arch_vcpu_info {
291 };
292 typedef struct arch_vcpu_info arch_vcpu_info_t;
294 struct arch_shared_info {
295 /* PFN of the start_info page. */
296 unsigned long start_info_pfn;
298 /* Interrupt vector for event channel. */
299 int evtchn_vector;
300 };
301 typedef struct arch_shared_info arch_shared_info_t;
303 typedef unsigned long xen_callback_t;
305 struct ia64_tr_entry {
306 unsigned long pte;
307 unsigned long itir;
308 unsigned long vadr;
309 unsigned long rid;
310 };
312 struct vcpu_extra_regs {
313 struct ia64_tr_entry itrs[8];
314 struct ia64_tr_entry dtrs[8];
315 unsigned long iva;
316 unsigned long dcr;
317 unsigned long event_callback_ip;
318 };
320 struct vcpu_guest_context {
321 #define VGCF_EXTRA_REGS (1<<1) /* Get/Set extra regs. */
322 unsigned long flags; /* VGCF_* flags */
324 struct cpu_user_regs user_regs;
325 struct vcpu_extra_regs extra_regs;
326 unsigned long privregs_pfn;
327 };
328 typedef struct vcpu_guest_context vcpu_guest_context_t;
329 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
331 // dom0 vp op
332 #define __HYPERVISOR_ia64_dom0vp_op __HYPERVISOR_arch_0
333 #define IA64_DOM0VP_ioremap 0 // map io space in machine
334 // address to dom0 physical
335 // address space.
336 // currently physical
337 // assignedg address equals to
338 // machine address
339 #define IA64_DOM0VP_phystomach 1 // convert a pseudo physical
340 // page frame number
341 // to the corresponding
342 // machine page frame number.
343 // if no page is assigned,
344 // INVALID_MFN or GPFN_INV_MASK
345 // is returned depending on
346 // domain's non-vti/vti mode.
347 #define IA64_DOM0VP_machtophys 3 // convert a machine page
348 // frame number
349 // to the corresponding
350 // pseudo physical page frame
351 // number of the caller domain
352 #define IA64_DOM0VP_zap_physmap 17 // unmap and free pages
353 // contained in the specified
354 // pseudo physical region
355 #define IA64_DOM0VP_add_physmap 18 // assigne machine page frane
356 // to dom0's pseudo physical
357 // address space.
358 // flags for page assignement to pseudo physical address space
359 #define _ASSIGN_readonly 0
360 #define ASSIGN_readonly (1UL << _ASSIGN_readonly)
361 #define ASSIGN_writable (0UL << _ASSIGN_readonly) // dummy flag
363 /* This structure has the same layout of struct ia64_boot_param, defined in
364 <asm/system.h>. It is redefined here to ease use. */
365 struct xen_ia64_boot_param {
366 unsigned long command_line; /* physical address of cmd line args */
367 unsigned long efi_systab; /* physical address of EFI system table */
368 unsigned long efi_memmap; /* physical address of EFI memory map */
369 unsigned long efi_memmap_size; /* size of EFI memory map */
370 unsigned long efi_memdesc_size; /* size of an EFI memory map descriptor */
371 unsigned int efi_memdesc_version; /* memory descriptor version */
372 struct {
373 unsigned short num_cols; /* number of columns on console. */
374 unsigned short num_rows; /* number of rows on console. */
375 unsigned short orig_x; /* cursor's x position */
376 unsigned short orig_y; /* cursor's y position */
377 } console_info;
378 unsigned long fpswa; /* physical address of the fpswa interface */
379 unsigned long initrd_start;
380 unsigned long initrd_size;
381 unsigned long domain_start; /* va where the boot time domain begins */
382 unsigned long domain_size; /* how big is the boot domain */
383 };
385 #endif /* !__ASSEMBLY__ */
387 /* Address of shared_info in domain virtual space.
388 This is the default address, for compatibility only. */
389 #define XSI_BASE 0xf100000000000000
391 /* Size of the shared_info area (this is not related to page size). */
392 #define XSI_SHIFT 14
393 #define XSI_SIZE (1 << XSI_SHIFT)
394 /* Log size of mapped_regs area (64 KB - only 4KB is used). */
395 #define XMAPPEDREGS_SHIFT 12
396 /* Offset of XASI (Xen arch shared info) wrt XSI_BASE. */
397 #define XMAPPEDREGS_OFS XSI_SIZE
399 /* Hyperprivops. */
400 #define HYPERPRIVOP_RFI 0x1
401 #define HYPERPRIVOP_RSM_DT 0x2
402 #define HYPERPRIVOP_SSM_DT 0x3
403 #define HYPERPRIVOP_COVER 0x4
404 #define HYPERPRIVOP_ITC_D 0x5
405 #define HYPERPRIVOP_ITC_I 0x6
406 #define HYPERPRIVOP_SSM_I 0x7
407 #define HYPERPRIVOP_GET_IVR 0x8
408 #define HYPERPRIVOP_GET_TPR 0x9
409 #define HYPERPRIVOP_SET_TPR 0xa
410 #define HYPERPRIVOP_EOI 0xb
411 #define HYPERPRIVOP_SET_ITM 0xc
412 #define HYPERPRIVOP_THASH 0xd
413 #define HYPERPRIVOP_PTC_GA 0xe
414 #define HYPERPRIVOP_ITR_D 0xf
415 #define HYPERPRIVOP_GET_RR 0x10
416 #define HYPERPRIVOP_SET_RR 0x11
417 #define HYPERPRIVOP_SET_KR 0x12
418 #define HYPERPRIVOP_FC 0x13
419 #define HYPERPRIVOP_GET_CPUID 0x14
420 #define HYPERPRIVOP_GET_PMD 0x15
421 #define HYPERPRIVOP_GET_EFLAG 0x16
422 #define HYPERPRIVOP_SET_EFLAG 0x17
423 #define HYPERPRIVOP_MAX 0x17
425 #endif /* __HYPERVISOR_IF_IA64_H__ */
427 /*
428 * Local variables:
429 * mode: C
430 * c-set-style: "BSD"
431 * c-basic-offset: 4
432 * tab-width: 4
433 * indent-tabs-mode: nil
434 * End:
435 */