ia64/xen-unstable

view xen/include/public/arch-ia64.h @ 12794:9787cb7262e8

[IA64] changed foreign domain page mapping semantic.

x86 foreign HVM domain page mapping semantic was changed to use gmfn
instead mfn. It applies to domains with auto_translated_mode enabled,
and all ia64 domains enable auto_translated_mode. This patch changes
ia64 foreign domain page mapping to use gmfn and fixes ia64 domU buidler.
However this patch breaks domain save/restore/dump-core.
They should also be fixed-up

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author awilliam@xenbuild.aw
date Tue Dec 05 10:59:32 2006 -0700 (2006-12-05)
parents ba7fca36fbd0
children 2fc3392d0889
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 #endif
60 /* Arch specific VIRQs definition */
61 #define VIRQ_ITC VIRQ_ARCH_0 /* V. Virtual itc timer */
62 #define VIRQ_MCA_CMC VIRQ_ARCH_1 /* MCA cmc interrupt */
63 #define VIRQ_MCA_CPE VIRQ_ARCH_2 /* MCA cpe interrupt */
65 /* Maximum number of virtual CPUs in multi-processor guests. */
66 /* WARNING: before changing this, check that shared_info fits on a page */
67 #define MAX_VIRT_CPUS 64
69 /*
70 * HVM_PARAM_PAE_ENABLED is meaningless on ia64, so we overload this
71 * entry to store the number of vCPUs. XXX Need arch-specific extentions
72 * for xc_get/set_hvm_param().
73 */
74 #define HVM_PARAM_VCPUS HVM_PARAM_PAE_ENABLED
76 #ifndef __ASSEMBLY__
78 typedef unsigned long xen_ulong_t;
80 #define INVALID_MFN (~0UL)
82 #define MEM_G (1UL << 30)
83 #define MEM_M (1UL << 20)
85 #define MMIO_START (3 * MEM_G)
86 #define MMIO_SIZE (512 * MEM_M)
88 #define VGA_IO_START 0xA0000UL
89 #define VGA_IO_SIZE 0x20000
91 #define LEGACY_IO_START (MMIO_START + MMIO_SIZE)
92 #define LEGACY_IO_SIZE (64*MEM_M)
94 #define IO_PAGE_START (LEGACY_IO_START + LEGACY_IO_SIZE)
95 #define IO_PAGE_SIZE PAGE_SIZE
97 #define STORE_PAGE_START (IO_PAGE_START + IO_PAGE_SIZE)
98 #define STORE_PAGE_SIZE PAGE_SIZE
100 #define BUFFER_IO_PAGE_START (STORE_PAGE_START+PAGE_SIZE)
101 #define BUFFER_IO_PAGE_SIZE PAGE_SIZE
103 #define IO_SAPIC_START 0xfec00000UL
104 #define IO_SAPIC_SIZE 0x100000
106 #define PIB_START 0xfee00000UL
107 #define PIB_SIZE 0x200000
109 #define GFW_START (4*MEM_G -16*MEM_M)
110 #define GFW_SIZE (16*MEM_M)
112 struct pt_fpreg {
113 union {
114 unsigned long bits[2];
115 long double __dummy; /* force 16-byte alignment */
116 } u;
117 };
119 struct cpu_user_regs {
120 /* The following registers are saved by SAVE_MIN: */
121 unsigned long b6; /* scratch */
122 unsigned long b7; /* scratch */
124 unsigned long ar_csd; /* used by cmp8xchg16 (scratch) */
125 unsigned long ar_ssd; /* reserved for future use (scratch) */
127 unsigned long r8; /* scratch (return value register 0) */
128 unsigned long r9; /* scratch (return value register 1) */
129 unsigned long r10; /* scratch (return value register 2) */
130 unsigned long r11; /* scratch (return value register 3) */
132 unsigned long cr_ipsr; /* interrupted task's psr */
133 unsigned long cr_iip; /* interrupted task's instruction pointer */
134 unsigned long cr_ifs; /* interrupted task's function state */
136 unsigned long ar_unat; /* interrupted task's NaT register (preserved) */
137 unsigned long ar_pfs; /* prev function state */
138 unsigned long ar_rsc; /* RSE configuration */
139 /* The following two are valid only if cr_ipsr.cpl > 0: */
140 unsigned long ar_rnat; /* RSE NaT */
141 unsigned long ar_bspstore; /* RSE bspstore */
143 unsigned long pr; /* 64 predicate registers (1 bit each) */
144 unsigned long b0; /* return pointer (bp) */
145 unsigned long loadrs; /* size of dirty partition << 16 */
147 unsigned long r1; /* the gp pointer */
148 unsigned long r12; /* interrupted task's memory stack pointer */
149 unsigned long r13; /* thread pointer */
151 unsigned long ar_fpsr; /* floating point status (preserved) */
152 unsigned long r15; /* scratch */
154 /* The remaining registers are NOT saved for system calls. */
156 unsigned long r14; /* scratch */
157 unsigned long r2; /* scratch */
158 unsigned long r3; /* scratch */
159 unsigned long r16; /* scratch */
160 unsigned long r17; /* scratch */
161 unsigned long r18; /* scratch */
162 unsigned long r19; /* scratch */
163 unsigned long r20; /* scratch */
164 unsigned long r21; /* scratch */
165 unsigned long r22; /* scratch */
166 unsigned long r23; /* scratch */
167 unsigned long r24; /* scratch */
168 unsigned long r25; /* scratch */
169 unsigned long r26; /* scratch */
170 unsigned long r27; /* scratch */
171 unsigned long r28; /* scratch */
172 unsigned long r29; /* scratch */
173 unsigned long r30; /* scratch */
174 unsigned long r31; /* scratch */
175 unsigned long ar_ccv; /* compare/exchange value (scratch) */
177 /*
178 * Floating point registers that the kernel considers scratch:
179 */
180 struct pt_fpreg f6; /* scratch */
181 struct pt_fpreg f7; /* scratch */
182 struct pt_fpreg f8; /* scratch */
183 struct pt_fpreg f9; /* scratch */
184 struct pt_fpreg f10; /* scratch */
185 struct pt_fpreg f11; /* scratch */
186 unsigned long r4; /* preserved */
187 unsigned long r5; /* preserved */
188 unsigned long r6; /* preserved */
189 unsigned long r7; /* preserved */
190 unsigned long eml_unat; /* used for emulating instruction */
191 unsigned long pad0; /* alignment pad */
193 };
194 typedef struct cpu_user_regs cpu_user_regs_t;
196 union vac {
197 unsigned long value;
198 struct {
199 int a_int:1;
200 int a_from_int_cr:1;
201 int a_to_int_cr:1;
202 int a_from_psr:1;
203 int a_from_cpuid:1;
204 int a_cover:1;
205 int a_bsw:1;
206 long reserved:57;
207 };
208 };
209 typedef union vac vac_t;
211 union vdc {
212 unsigned long value;
213 struct {
214 int d_vmsw:1;
215 int d_extint:1;
216 int d_ibr_dbr:1;
217 int d_pmc:1;
218 int d_to_pmd:1;
219 int d_itm:1;
220 long reserved:58;
221 };
222 };
223 typedef union vdc vdc_t;
225 struct mapped_regs {
226 union vac vac;
227 union vdc vdc;
228 unsigned long virt_env_vaddr;
229 unsigned long reserved1[29];
230 unsigned long vhpi;
231 unsigned long reserved2[95];
232 union {
233 unsigned long vgr[16];
234 unsigned long bank1_regs[16]; // bank1 regs (r16-r31) when bank0 active
235 };
236 union {
237 unsigned long vbgr[16];
238 unsigned long bank0_regs[16]; // bank0 regs (r16-r31) when bank1 active
239 };
240 unsigned long vnat;
241 unsigned long vbnat;
242 unsigned long vcpuid[5];
243 unsigned long reserved3[11];
244 unsigned long vpsr;
245 unsigned long vpr;
246 unsigned long reserved4[76];
247 union {
248 unsigned long vcr[128];
249 struct {
250 unsigned long dcr; // CR0
251 unsigned long itm;
252 unsigned long iva;
253 unsigned long rsv1[5];
254 unsigned long pta; // CR8
255 unsigned long rsv2[7];
256 unsigned long ipsr; // CR16
257 unsigned long isr;
258 unsigned long rsv3;
259 unsigned long iip;
260 unsigned long ifa;
261 unsigned long itir;
262 unsigned long iipa;
263 unsigned long ifs;
264 unsigned long iim; // CR24
265 unsigned long iha;
266 unsigned long rsv4[38];
267 unsigned long lid; // CR64
268 unsigned long ivr;
269 unsigned long tpr;
270 unsigned long eoi;
271 unsigned long irr[4];
272 unsigned long itv; // CR72
273 unsigned long pmv;
274 unsigned long cmcv;
275 unsigned long rsv5[5];
276 unsigned long lrr0; // CR80
277 unsigned long lrr1;
278 unsigned long rsv6[46];
279 };
280 };
281 union {
282 unsigned long reserved5[128];
283 struct {
284 unsigned long precover_ifs;
285 unsigned long unat; // not sure if this is needed until NaT arch is done
286 int interrupt_collection_enabled; // virtual psr.ic
287 /* virtual interrupt deliverable flag is evtchn_upcall_mask in
288 * shared info area now. interrupt_mask_addr is the address
289 * of evtchn_upcall_mask for current vcpu
290 */
291 unsigned char *interrupt_mask_addr;
292 int pending_interruption;
293 int incomplete_regframe; // see SDM vol2 6.8
294 unsigned char vpsr_pp;
295 unsigned char reserved5_2[7];
296 unsigned long reserved5_1[3];
297 int metaphysical_mode; // 1 = use metaphys mapping, 0 = use virtual
298 int banknum; // 0 or 1, which virtual register bank is active
299 unsigned long rrs[8]; // region registers
300 unsigned long krs[8]; // kernel registers
301 unsigned long pkrs[8]; // protection key registers
302 unsigned long tmp[8]; // temp registers (e.g. for hyperprivops)
303 };
304 };
305 };
306 typedef struct mapped_regs mapped_regs_t;
308 struct vpd {
309 struct mapped_regs vpd_low;
310 unsigned long reserved6[3456];
311 unsigned long vmm_avail[128];
312 unsigned long reserved7[4096];
313 };
314 typedef struct vpd vpd_t;
316 struct arch_vcpu_info {
317 };
318 typedef struct arch_vcpu_info arch_vcpu_info_t;
320 struct arch_shared_info {
321 /* PFN of the start_info page. */
322 unsigned long start_info_pfn;
324 /* Interrupt vector for event channel. */
325 int evtchn_vector;
327 uint64_t pad[32];
328 };
329 typedef struct arch_shared_info arch_shared_info_t;
331 typedef unsigned long xen_callback_t;
333 struct ia64_tr_entry {
334 unsigned long pte;
335 unsigned long itir;
336 unsigned long vadr;
337 unsigned long rid;
338 };
340 struct vcpu_extra_regs {
341 struct ia64_tr_entry itrs[8];
342 struct ia64_tr_entry dtrs[8];
343 unsigned long iva;
344 unsigned long dcr;
345 unsigned long event_callback_ip;
346 };
348 struct vcpu_guest_context {
349 #define VGCF_EXTRA_REGS (1<<1) /* Get/Set extra regs. */
350 unsigned long flags; /* VGCF_* flags */
352 struct cpu_user_regs user_regs;
353 struct vcpu_extra_regs extra_regs;
354 unsigned long privregs_pfn;
355 };
356 typedef struct vcpu_guest_context vcpu_guest_context_t;
357 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
359 /* dom0 vp op */
360 #define __HYPERVISOR_ia64_dom0vp_op __HYPERVISOR_arch_0
361 /* Map io space in machine address to dom0 physical address space.
362 Currently physical assigned address equals to machine address. */
363 #define IA64_DOM0VP_ioremap 0
365 /* Convert a pseudo physical page frame number to the corresponding
366 machine page frame number. If no page is assigned, INVALID_MFN or
367 GPFN_INV_MASK is returned depending on domain's non-vti/vti mode. */
368 #define IA64_DOM0VP_phystomach 1
370 /* Convert a machine page frame number to the corresponding pseudo physical
371 page frame number of the caller domain. */
372 #define IA64_DOM0VP_machtophys 3
374 /* Reserved for future use. */
375 #define IA64_DOM0VP_iounmap 4
377 /* Unmap and free pages contained in the specified pseudo physical region. */
378 #define IA64_DOM0VP_zap_physmap 5
380 /* Assign machine page frame to dom0's pseudo physical address space. */
381 #define IA64_DOM0VP_add_physmap 6
383 /* expose the p2m table into domain */
384 #define IA64_DOM0VP_expose_p2m 7
386 /* xen perfmon */
387 #define IA64_DOM0VP_perfmon 8
389 /* gmfn version of IA64_DOM0VP_add_physmap */
390 #define IA64_DOM0VP_add_physmap_with_gmfn 9
392 // flags for page assignement to pseudo physical address space
393 #define _ASSIGN_readonly 0
394 #define ASSIGN_readonly (1UL << _ASSIGN_readonly)
395 #define ASSIGN_writable (0UL << _ASSIGN_readonly) // dummy flag
396 /* Internal only: memory attribute must be WC/UC/UCE. */
397 #define _ASSIGN_nocache 1
398 #define ASSIGN_nocache (1UL << _ASSIGN_nocache)
399 // tlb tracking
400 #define _ASSIGN_tlb_track 2
401 #define ASSIGN_tlb_track (1UL << _ASSIGN_tlb_track)
402 /* Internal only: associated with PGC_allocated bit */
403 #define _ASSIGN_pgc_allocated 3
404 #define ASSIGN_pgc_allocated (1UL << _ASSIGN_pgc_allocated)
406 /* This structure has the same layout of struct ia64_boot_param, defined in
407 <asm/system.h>. It is redefined here to ease use. */
408 struct xen_ia64_boot_param {
409 unsigned long command_line; /* physical address of cmd line args */
410 unsigned long efi_systab; /* physical address of EFI system table */
411 unsigned long efi_memmap; /* physical address of EFI memory map */
412 unsigned long efi_memmap_size; /* size of EFI memory map */
413 unsigned long efi_memdesc_size; /* size of an EFI memory map descriptor */
414 unsigned int efi_memdesc_version; /* memory descriptor version */
415 struct {
416 unsigned short num_cols; /* number of columns on console. */
417 unsigned short num_rows; /* number of rows on console. */
418 unsigned short orig_x; /* cursor's x position */
419 unsigned short orig_y; /* cursor's y position */
420 } console_info;
421 unsigned long fpswa; /* physical address of the fpswa interface */
422 unsigned long initrd_start;
423 unsigned long initrd_size;
424 unsigned long domain_start; /* va where the boot time domain begins */
425 unsigned long domain_size; /* how big is the boot domain */
426 };
428 #endif /* !__ASSEMBLY__ */
430 /* Size of the shared_info area (this is not related to page size). */
431 #define XSI_SHIFT 14
432 #define XSI_SIZE (1 << XSI_SHIFT)
433 /* Log size of mapped_regs area (64 KB - only 4KB is used). */
434 #define XMAPPEDREGS_SHIFT 12
435 #define XMAPPEDREGS_SIZE (1 << XMAPPEDREGS_SHIFT)
436 /* Offset of XASI (Xen arch shared info) wrt XSI_BASE. */
437 #define XMAPPEDREGS_OFS XSI_SIZE
439 /* Hyperprivops. */
440 #define HYPERPRIVOP_RFI 0x1
441 #define HYPERPRIVOP_RSM_DT 0x2
442 #define HYPERPRIVOP_SSM_DT 0x3
443 #define HYPERPRIVOP_COVER 0x4
444 #define HYPERPRIVOP_ITC_D 0x5
445 #define HYPERPRIVOP_ITC_I 0x6
446 #define HYPERPRIVOP_SSM_I 0x7
447 #define HYPERPRIVOP_GET_IVR 0x8
448 #define HYPERPRIVOP_GET_TPR 0x9
449 #define HYPERPRIVOP_SET_TPR 0xa
450 #define HYPERPRIVOP_EOI 0xb
451 #define HYPERPRIVOP_SET_ITM 0xc
452 #define HYPERPRIVOP_THASH 0xd
453 #define HYPERPRIVOP_PTC_GA 0xe
454 #define HYPERPRIVOP_ITR_D 0xf
455 #define HYPERPRIVOP_GET_RR 0x10
456 #define HYPERPRIVOP_SET_RR 0x11
457 #define HYPERPRIVOP_SET_KR 0x12
458 #define HYPERPRIVOP_FC 0x13
459 #define HYPERPRIVOP_GET_CPUID 0x14
460 #define HYPERPRIVOP_GET_PMD 0x15
461 #define HYPERPRIVOP_GET_EFLAG 0x16
462 #define HYPERPRIVOP_SET_EFLAG 0x17
463 #define HYPERPRIVOP_RSM_BE 0x18
464 #define HYPERPRIVOP_GET_PSR 0x19
465 #define HYPERPRIVOP_MAX 0x19
467 /* Fast and light hypercalls. */
468 #define __HYPERVISOR_ia64_fast_eoi 0x0200
470 /* Xencomm macros. */
471 #define XENCOMM_INLINE_MASK 0xf800000000000000UL
472 #define XENCOMM_INLINE_FLAG 0x8000000000000000UL
474 #define XENCOMM_IS_INLINE(addr) \
475 (((unsigned long)(addr) & XENCOMM_INLINE_MASK) == XENCOMM_INLINE_FLAG)
476 #define XENCOMM_INLINE_ADDR(addr) \
477 ((unsigned long)(addr) & ~XENCOMM_INLINE_MASK)
479 /* xen perfmon */
480 #ifdef XEN
481 #ifndef __ASSEMBLY__
482 #ifndef _ASM_IA64_PERFMON_H
484 #include <xen/list.h> // asm/perfmon.h requires struct list_head
485 #include <asm/perfmon.h>
486 // for PFM_xxx and pfarg_features_t, pfarg_context_t, pfarg_reg_t, pfarg_load_t
488 #endif /* _ASM_IA64_PERFMON_H */
490 DEFINE_XEN_GUEST_HANDLE(pfarg_features_t);
491 DEFINE_XEN_GUEST_HANDLE(pfarg_context_t);
492 DEFINE_XEN_GUEST_HANDLE(pfarg_reg_t);
493 DEFINE_XEN_GUEST_HANDLE(pfarg_load_t);
494 #endif /* __ASSEMBLY__ */
495 #endif /* XEN */
497 #endif /* __HYPERVISOR_IF_IA64_H__ */
499 /*
500 * Local variables:
501 * mode: C
502 * c-set-style: "BSD"
503 * c-basic-offset: 4
504 * tab-width: 4
505 * indent-tabs-mode: nil
506 * End:
507 */