ia64/xen-unstable

view xen/include/public/arch-ia64.h @ 13954:632d8e576900

[LIBELF] Define PRIpfn next to xen_pfn_t.
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Hollis Blanchard <hollisb@us.ibm.com>
date Fri Feb 09 14:43:22 2007 -0600 (2007-02-09)
parents cd6598396086
children 9af0c7e4ff51
line source
1 /******************************************************************************
2 * arch-ia64/hypervisor-if.h
3 *
4 * Guest OS interface to IA64 Xen.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 */
26 #ifndef __HYPERVISOR_IF_IA64_H__
27 #define __HYPERVISOR_IF_IA64_H__
29 /* Structural guest handles introduced in 0x00030201. */
30 #if __XEN_INTERFACE_VERSION__ >= 0x00030201
31 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
32 typedef struct { type *p; } __guest_handle_ ## name
33 #else
34 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
35 typedef type * __guest_handle_ ## name
36 #endif
38 #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
39 #define XEN_GUEST_HANDLE(name) __guest_handle_ ## name
40 #define set_xen_guest_handle(hnd, val) do { (hnd).p = val; } while (0)
41 #ifdef __XEN_TOOLS__
42 #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
43 #endif
45 #ifndef __ASSEMBLY__
46 /* Guest handles for primitive C types. */
47 __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);
48 __DEFINE_XEN_GUEST_HANDLE(uint, unsigned int);
49 __DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);
50 __DEFINE_XEN_GUEST_HANDLE(u64, unsigned long);
51 DEFINE_XEN_GUEST_HANDLE(char);
52 DEFINE_XEN_GUEST_HANDLE(int);
53 DEFINE_XEN_GUEST_HANDLE(long);
54 DEFINE_XEN_GUEST_HANDLE(void);
56 typedef unsigned long xen_pfn_t;
57 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
58 #define PRIpfn "lx"
59 #endif
61 /* Arch specific VIRQs definition */
62 #define VIRQ_ITC VIRQ_ARCH_0 /* V. Virtual itc timer */
63 #define VIRQ_MCA_CMC VIRQ_ARCH_1 /* MCA cmc interrupt */
64 #define VIRQ_MCA_CPE VIRQ_ARCH_2 /* MCA cpe interrupt */
66 /* Arch specific callback irq definition */
67 /* using Requester-ID(RID) as callback irq */
68 #define IA64_CALLBACK_IRQ_RID (1 << 31)
70 /* Maximum number of virtual CPUs in multi-processor guests. */
71 /* WARNING: before changing this, check that shared_info fits on a page */
72 #define MAX_VIRT_CPUS 64
74 #ifndef __ASSEMBLY__
76 typedef unsigned long xen_ulong_t;
78 #define INVALID_MFN (~0UL)
80 #define MEM_G (1UL << 30)
81 #define MEM_M (1UL << 20)
83 #define MMIO_START (3 * MEM_G)
84 #define MMIO_SIZE (512 * MEM_M)
86 #define VGA_IO_START 0xA0000UL
87 #define VGA_IO_SIZE 0x20000
89 #define LEGACY_IO_START (MMIO_START + MMIO_SIZE)
90 #define LEGACY_IO_SIZE (64*MEM_M)
92 #define IO_PAGE_START (LEGACY_IO_START + LEGACY_IO_SIZE)
93 #define IO_PAGE_SIZE PAGE_SIZE
95 #define STORE_PAGE_START (IO_PAGE_START + IO_PAGE_SIZE)
96 #define STORE_PAGE_SIZE PAGE_SIZE
98 #define BUFFER_IO_PAGE_START (STORE_PAGE_START+PAGE_SIZE)
99 #define BUFFER_IO_PAGE_SIZE PAGE_SIZE
101 #define IO_SAPIC_START 0xfec00000UL
102 #define IO_SAPIC_SIZE 0x100000
104 #define PIB_START 0xfee00000UL
105 #define PIB_SIZE 0x200000
107 #define GFW_START (4*MEM_G -16*MEM_M)
108 #define GFW_SIZE (16*MEM_M)
110 struct pt_fpreg {
111 union {
112 unsigned long bits[2];
113 long double __dummy; /* force 16-byte alignment */
114 } u;
115 };
117 struct cpu_user_regs {
118 /* The following registers are saved by SAVE_MIN: */
119 unsigned long b6; /* scratch */
120 unsigned long b7; /* scratch */
122 unsigned long ar_csd; /* used by cmp8xchg16 (scratch) */
123 unsigned long ar_ssd; /* reserved for future use (scratch) */
125 unsigned long r8; /* scratch (return value register 0) */
126 unsigned long r9; /* scratch (return value register 1) */
127 unsigned long r10; /* scratch (return value register 2) */
128 unsigned long r11; /* scratch (return value register 3) */
130 unsigned long cr_ipsr; /* interrupted task's psr */
131 unsigned long cr_iip; /* interrupted task's instruction pointer */
132 unsigned long cr_ifs; /* interrupted task's function state */
134 unsigned long ar_unat; /* interrupted task's NaT register (preserved) */
135 unsigned long ar_pfs; /* prev function state */
136 unsigned long ar_rsc; /* RSE configuration */
137 /* The following two are valid only if cr_ipsr.cpl > 0: */
138 unsigned long ar_rnat; /* RSE NaT */
139 unsigned long ar_bspstore; /* RSE bspstore */
141 unsigned long pr; /* 64 predicate registers (1 bit each) */
142 unsigned long b0; /* return pointer (bp) */
143 unsigned long loadrs; /* size of dirty partition << 16 */
145 unsigned long r1; /* the gp pointer */
146 unsigned long r12; /* interrupted task's memory stack pointer */
147 unsigned long r13; /* thread pointer */
149 unsigned long ar_fpsr; /* floating point status (preserved) */
150 unsigned long r15; /* scratch */
152 /* The remaining registers are NOT saved for system calls. */
154 unsigned long r14; /* scratch */
155 unsigned long r2; /* scratch */
156 unsigned long r3; /* scratch */
157 unsigned long r16; /* scratch */
158 unsigned long r17; /* scratch */
159 unsigned long r18; /* scratch */
160 unsigned long r19; /* scratch */
161 unsigned long r20; /* scratch */
162 unsigned long r21; /* scratch */
163 unsigned long r22; /* scratch */
164 unsigned long r23; /* scratch */
165 unsigned long r24; /* scratch */
166 unsigned long r25; /* scratch */
167 unsigned long r26; /* scratch */
168 unsigned long r27; /* scratch */
169 unsigned long r28; /* scratch */
170 unsigned long r29; /* scratch */
171 unsigned long r30; /* scratch */
172 unsigned long r31; /* scratch */
173 unsigned long ar_ccv; /* compare/exchange value (scratch) */
175 /*
176 * Floating point registers that the kernel considers scratch:
177 */
178 struct pt_fpreg f6; /* scratch */
179 struct pt_fpreg f7; /* scratch */
180 struct pt_fpreg f8; /* scratch */
181 struct pt_fpreg f9; /* scratch */
182 struct pt_fpreg f10; /* scratch */
183 struct pt_fpreg f11; /* scratch */
184 unsigned long r4; /* preserved */
185 unsigned long r5; /* preserved */
186 unsigned long r6; /* preserved */
187 unsigned long r7; /* preserved */
188 unsigned long eml_unat; /* used for emulating instruction */
189 unsigned long pad0; /* alignment pad */
191 };
192 typedef struct cpu_user_regs cpu_user_regs_t;
194 union vac {
195 unsigned long value;
196 struct {
197 int a_int:1;
198 int a_from_int_cr:1;
199 int a_to_int_cr:1;
200 int a_from_psr:1;
201 int a_from_cpuid:1;
202 int a_cover:1;
203 int a_bsw:1;
204 long reserved:57;
205 };
206 };
207 typedef union vac vac_t;
209 union vdc {
210 unsigned long value;
211 struct {
212 int d_vmsw:1;
213 int d_extint:1;
214 int d_ibr_dbr:1;
215 int d_pmc:1;
216 int d_to_pmd:1;
217 int d_itm:1;
218 long reserved:58;
219 };
220 };
221 typedef union vdc vdc_t;
223 struct mapped_regs {
224 union vac vac;
225 union vdc vdc;
226 unsigned long virt_env_vaddr;
227 unsigned long reserved1[29];
228 unsigned long vhpi;
229 unsigned long reserved2[95];
230 union {
231 unsigned long vgr[16];
232 unsigned long bank1_regs[16]; // bank1 regs (r16-r31) when bank0 active
233 };
234 union {
235 unsigned long vbgr[16];
236 unsigned long bank0_regs[16]; // bank0 regs (r16-r31) when bank1 active
237 };
238 unsigned long vnat;
239 unsigned long vbnat;
240 unsigned long vcpuid[5];
241 unsigned long reserved3[11];
242 unsigned long vpsr;
243 unsigned long vpr;
244 unsigned long reserved4[76];
245 union {
246 unsigned long vcr[128];
247 struct {
248 unsigned long dcr; // CR0
249 unsigned long itm;
250 unsigned long iva;
251 unsigned long rsv1[5];
252 unsigned long pta; // CR8
253 unsigned long rsv2[7];
254 unsigned long ipsr; // CR16
255 unsigned long isr;
256 unsigned long rsv3;
257 unsigned long iip;
258 unsigned long ifa;
259 unsigned long itir;
260 unsigned long iipa;
261 unsigned long ifs;
262 unsigned long iim; // CR24
263 unsigned long iha;
264 unsigned long rsv4[38];
265 unsigned long lid; // CR64
266 unsigned long ivr;
267 unsigned long tpr;
268 unsigned long eoi;
269 unsigned long irr[4];
270 unsigned long itv; // CR72
271 unsigned long pmv;
272 unsigned long cmcv;
273 unsigned long rsv5[5];
274 unsigned long lrr0; // CR80
275 unsigned long lrr1;
276 unsigned long rsv6[46];
277 };
278 };
279 union {
280 unsigned long reserved5[128];
281 struct {
282 unsigned long precover_ifs;
283 unsigned long unat; // not sure if this is needed until NaT arch is done
284 int interrupt_collection_enabled; // virtual psr.ic
285 /* virtual interrupt deliverable flag is evtchn_upcall_mask in
286 * shared info area now. interrupt_mask_addr is the address
287 * of evtchn_upcall_mask for current vcpu
288 */
289 unsigned char *interrupt_mask_addr;
290 int pending_interruption;
291 unsigned char vpsr_pp;
292 unsigned char reserved5_2[3];
293 unsigned long reserved5_1[4];
294 int metaphysical_mode; // 1 = use metaphys mapping, 0 = use virtual
295 int banknum; // 0 or 1, which virtual register bank is active
296 unsigned long rrs[8]; // region registers
297 unsigned long krs[8]; // kernel registers
298 unsigned long pkrs[8]; // protection key registers
299 unsigned long tmp[8]; // temp registers (e.g. for hyperprivops)
300 };
301 };
302 };
303 typedef struct mapped_regs mapped_regs_t;
305 struct vpd {
306 struct mapped_regs vpd_low;
307 unsigned long reserved6[3456];
308 unsigned long vmm_avail[128];
309 unsigned long reserved7[4096];
310 };
311 typedef struct vpd vpd_t;
313 struct arch_vcpu_info {
314 };
315 typedef struct arch_vcpu_info arch_vcpu_info_t;
317 struct arch_shared_info {
318 /* PFN of the start_info page. */
319 unsigned long start_info_pfn;
321 /* Interrupt vector for event channel. */
322 int evtchn_vector;
324 uint64_t pad[32];
325 };
326 typedef struct arch_shared_info arch_shared_info_t;
328 typedef unsigned long xen_callback_t;
330 struct ia64_tr_entry {
331 unsigned long pte;
332 unsigned long itir;
333 unsigned long vadr;
334 unsigned long rid;
335 };
337 struct vcpu_extra_regs {
338 struct ia64_tr_entry itrs[8];
339 struct ia64_tr_entry dtrs[8];
340 unsigned long iva;
341 unsigned long dcr;
342 unsigned long event_callback_ip;
343 };
345 struct vcpu_guest_context {
346 #define VGCF_EXTRA_REGS (1<<1) /* Get/Set extra regs. */
347 unsigned long flags; /* VGCF_* flags */
349 struct cpu_user_regs user_regs;
350 struct vcpu_extra_regs extra_regs;
351 unsigned long privregs_pfn;
352 };
353 typedef struct vcpu_guest_context vcpu_guest_context_t;
354 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
356 /* dom0 vp op */
357 #define __HYPERVISOR_ia64_dom0vp_op __HYPERVISOR_arch_0
358 /* Map io space in machine address to dom0 physical address space.
359 Currently physical assigned address equals to machine address. */
360 #define IA64_DOM0VP_ioremap 0
362 /* Convert a pseudo physical page frame number to the corresponding
363 machine page frame number. If no page is assigned, INVALID_MFN or
364 GPFN_INV_MASK is returned depending on domain's non-vti/vti mode. */
365 #define IA64_DOM0VP_phystomach 1
367 /* Convert a machine page frame number to the corresponding pseudo physical
368 page frame number of the caller domain. */
369 #define IA64_DOM0VP_machtophys 3
371 /* Reserved for future use. */
372 #define IA64_DOM0VP_iounmap 4
374 /* Unmap and free pages contained in the specified pseudo physical region. */
375 #define IA64_DOM0VP_zap_physmap 5
377 /* Assign machine page frame to dom0's pseudo physical address space. */
378 #define IA64_DOM0VP_add_physmap 6
380 /* expose the p2m table into domain */
381 #define IA64_DOM0VP_expose_p2m 7
383 /* xen perfmon */
384 #define IA64_DOM0VP_perfmon 8
386 /* gmfn version of IA64_DOM0VP_add_physmap */
387 #define IA64_DOM0VP_add_physmap_with_gmfn 9
389 // flags for page assignement to pseudo physical address space
390 #define _ASSIGN_readonly 0
391 #define ASSIGN_readonly (1UL << _ASSIGN_readonly)
392 #define ASSIGN_writable (0UL << _ASSIGN_readonly) // dummy flag
393 /* Internal only: memory attribute must be WC/UC/UCE. */
394 #define _ASSIGN_nocache 1
395 #define ASSIGN_nocache (1UL << _ASSIGN_nocache)
396 // tlb tracking
397 #define _ASSIGN_tlb_track 2
398 #define ASSIGN_tlb_track (1UL << _ASSIGN_tlb_track)
399 /* Internal only: associated with PGC_allocated bit */
400 #define _ASSIGN_pgc_allocated 3
401 #define ASSIGN_pgc_allocated (1UL << _ASSIGN_pgc_allocated)
403 /* This structure has the same layout of struct ia64_boot_param, defined in
404 <asm/system.h>. It is redefined here to ease use. */
405 struct xen_ia64_boot_param {
406 unsigned long command_line; /* physical address of cmd line args */
407 unsigned long efi_systab; /* physical address of EFI system table */
408 unsigned long efi_memmap; /* physical address of EFI memory map */
409 unsigned long efi_memmap_size; /* size of EFI memory map */
410 unsigned long efi_memdesc_size; /* size of an EFI memory map descriptor */
411 unsigned int efi_memdesc_version; /* memory descriptor version */
412 struct {
413 unsigned short num_cols; /* number of columns on console. */
414 unsigned short num_rows; /* number of rows on console. */
415 unsigned short orig_x; /* cursor's x position */
416 unsigned short orig_y; /* cursor's y position */
417 } console_info;
418 unsigned long fpswa; /* physical address of the fpswa interface */
419 unsigned long initrd_start;
420 unsigned long initrd_size;
421 unsigned long domain_start; /* va where the boot time domain begins */
422 unsigned long domain_size; /* how big is the boot domain */
423 };
425 #endif /* !__ASSEMBLY__ */
427 /* Size of the shared_info area (this is not related to page size). */
428 #define XSI_SHIFT 14
429 #define XSI_SIZE (1 << XSI_SHIFT)
430 /* Log size of mapped_regs area (64 KB - only 4KB is used). */
431 #define XMAPPEDREGS_SHIFT 12
432 #define XMAPPEDREGS_SIZE (1 << XMAPPEDREGS_SHIFT)
433 /* Offset of XASI (Xen arch shared info) wrt XSI_BASE. */
434 #define XMAPPEDREGS_OFS XSI_SIZE
436 /* Hyperprivops. */
437 #define HYPERPRIVOP_START 0x1
438 #define HYPERPRIVOP_RFI (HYPERPRIVOP_START + 0x0)
439 #define HYPERPRIVOP_RSM_DT (HYPERPRIVOP_START + 0x1)
440 #define HYPERPRIVOP_SSM_DT (HYPERPRIVOP_START + 0x2)
441 #define HYPERPRIVOP_COVER (HYPERPRIVOP_START + 0x3)
442 #define HYPERPRIVOP_ITC_D (HYPERPRIVOP_START + 0x4)
443 #define HYPERPRIVOP_ITC_I (HYPERPRIVOP_START + 0x5)
444 #define HYPERPRIVOP_SSM_I (HYPERPRIVOP_START + 0x6)
445 #define HYPERPRIVOP_GET_IVR (HYPERPRIVOP_START + 0x7)
446 #define HYPERPRIVOP_GET_TPR (HYPERPRIVOP_START + 0x8)
447 #define HYPERPRIVOP_SET_TPR (HYPERPRIVOP_START + 0x9)
448 #define HYPERPRIVOP_EOI (HYPERPRIVOP_START + 0xa)
449 #define HYPERPRIVOP_SET_ITM (HYPERPRIVOP_START + 0xb)
450 #define HYPERPRIVOP_THASH (HYPERPRIVOP_START + 0xc)
451 #define HYPERPRIVOP_PTC_GA (HYPERPRIVOP_START + 0xd)
452 #define HYPERPRIVOP_ITR_D (HYPERPRIVOP_START + 0xe)
453 #define HYPERPRIVOP_GET_RR (HYPERPRIVOP_START + 0xf)
454 #define HYPERPRIVOP_SET_RR (HYPERPRIVOP_START + 0x10)
455 #define HYPERPRIVOP_SET_KR (HYPERPRIVOP_START + 0x11)
456 #define HYPERPRIVOP_FC (HYPERPRIVOP_START + 0x12)
457 #define HYPERPRIVOP_GET_CPUID (HYPERPRIVOP_START + 0x13)
458 #define HYPERPRIVOP_GET_PMD (HYPERPRIVOP_START + 0x14)
459 #define HYPERPRIVOP_GET_EFLAG (HYPERPRIVOP_START + 0x15)
460 #define HYPERPRIVOP_SET_EFLAG (HYPERPRIVOP_START + 0x16)
461 #define HYPERPRIVOP_RSM_BE (HYPERPRIVOP_START + 0x17)
462 #define HYPERPRIVOP_GET_PSR (HYPERPRIVOP_START + 0x18)
463 #define HYPERPRIVOP_MAX (0x19)
465 /* Fast and light hypercalls. */
466 #define __HYPERVISOR_ia64_fast_eoi __HYPERVISOR_arch_1
468 /* Xencomm macros. */
469 #define XENCOMM_INLINE_MASK 0xf800000000000000UL
470 #define XENCOMM_INLINE_FLAG 0x8000000000000000UL
472 #define XENCOMM_IS_INLINE(addr) \
473 (((unsigned long)(addr) & XENCOMM_INLINE_MASK) == XENCOMM_INLINE_FLAG)
474 #define XENCOMM_INLINE_ADDR(addr) \
475 ((unsigned long)(addr) & ~XENCOMM_INLINE_MASK)
477 /* xen perfmon */
478 #ifdef XEN
479 #ifndef __ASSEMBLY__
480 #ifndef _ASM_IA64_PERFMON_H
482 #include <xen/list.h> // asm/perfmon.h requires struct list_head
483 #include <asm/perfmon.h>
484 // for PFM_xxx and pfarg_features_t, pfarg_context_t, pfarg_reg_t, pfarg_load_t
486 #endif /* _ASM_IA64_PERFMON_H */
488 DEFINE_XEN_GUEST_HANDLE(pfarg_features_t);
489 DEFINE_XEN_GUEST_HANDLE(pfarg_context_t);
490 DEFINE_XEN_GUEST_HANDLE(pfarg_reg_t);
491 DEFINE_XEN_GUEST_HANDLE(pfarg_load_t);
492 #endif /* __ASSEMBLY__ */
493 #endif /* XEN */
495 #endif /* __HYPERVISOR_IF_IA64_H__ */
497 /*
498 * Local variables:
499 * mode: C
500 * c-set-style: "BSD"
501 * c-basic-offset: 4
502 * tab-width: 4
503 * indent-tabs-mode: nil
504 * End:
505 */