diff options
author | Isaku Yamahata <yamahata@valinux.co.jp> | 2008-10-16 22:17:52 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2008-10-17 12:58:58 -0400 |
commit | ed50bd6096dab96e4c501d600776b75687dd2cf0 (patch) | |
tree | b1fd38c695c2c5aa1f11c0d7cdd98e8b9de56659 /arch/ia64/include/asm/xen/privop.h | |
parent | 67fe8d27a8b0845d6a5237af340fe5039335bf99 (diff) |
ia64/xen: define helper functions for xen hypercalls.
introduce helper functions for xen hypercalls which
traps to hypervisor.
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'arch/ia64/include/asm/xen/privop.h')
-rw-r--r-- | arch/ia64/include/asm/xen/privop.h | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/arch/ia64/include/asm/xen/privop.h b/arch/ia64/include/asm/xen/privop.h new file mode 100644 index 000000000000..71ec7546e100 --- /dev/null +++ b/arch/ia64/include/asm/xen/privop.h | |||
@@ -0,0 +1,129 @@ | |||
1 | #ifndef _ASM_IA64_XEN_PRIVOP_H | ||
2 | #define _ASM_IA64_XEN_PRIVOP_H | ||
3 | |||
4 | /* | ||
5 | * Copyright (C) 2005 Hewlett-Packard Co | ||
6 | * Dan Magenheimer <dan.magenheimer@hp.com> | ||
7 | * | ||
8 | * Paravirtualizations of privileged operations for Xen/ia64 | ||
9 | * | ||
10 | * | ||
11 | * inline privop and paravirt_alt support | ||
12 | * Copyright (c) 2007 Isaku Yamahata <yamahata at valinux co jp> | ||
13 | * VA Linux Systems Japan K.K. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef __ASSEMBLY__ | ||
18 | #include <linux/types.h> /* arch-ia64.h requires uint64_t */ | ||
19 | #endif | ||
20 | #include <asm/xen/interface.h> | ||
21 | |||
22 | /* At 1 MB, before per-cpu space but still addressable using addl instead | ||
23 | of movl. */ | ||
24 | #define XSI_BASE 0xfffffffffff00000 | ||
25 | |||
26 | /* Address of mapped regs. */ | ||
27 | #define XMAPPEDREGS_BASE (XSI_BASE + XSI_SIZE) | ||
28 | |||
29 | #ifdef __ASSEMBLY__ | ||
30 | #define XEN_HYPER_RFI break HYPERPRIVOP_RFI | ||
31 | #define XEN_HYPER_RSM_PSR_DT break HYPERPRIVOP_RSM_DT | ||
32 | #define XEN_HYPER_SSM_PSR_DT break HYPERPRIVOP_SSM_DT | ||
33 | #define XEN_HYPER_COVER break HYPERPRIVOP_COVER | ||
34 | #define XEN_HYPER_ITC_D break HYPERPRIVOP_ITC_D | ||
35 | #define XEN_HYPER_ITC_I break HYPERPRIVOP_ITC_I | ||
36 | #define XEN_HYPER_SSM_I break HYPERPRIVOP_SSM_I | ||
37 | #define XEN_HYPER_GET_IVR break HYPERPRIVOP_GET_IVR | ||
38 | #define XEN_HYPER_THASH break HYPERPRIVOP_THASH | ||
39 | #define XEN_HYPER_ITR_D break HYPERPRIVOP_ITR_D | ||
40 | #define XEN_HYPER_SET_KR break HYPERPRIVOP_SET_KR | ||
41 | #define XEN_HYPER_GET_PSR break HYPERPRIVOP_GET_PSR | ||
42 | #define XEN_HYPER_SET_RR0_TO_RR4 break HYPERPRIVOP_SET_RR0_TO_RR4 | ||
43 | |||
44 | #define XSI_IFS (XSI_BASE + XSI_IFS_OFS) | ||
45 | #define XSI_PRECOVER_IFS (XSI_BASE + XSI_PRECOVER_IFS_OFS) | ||
46 | #define XSI_IFA (XSI_BASE + XSI_IFA_OFS) | ||
47 | #define XSI_ISR (XSI_BASE + XSI_ISR_OFS) | ||
48 | #define XSI_IIM (XSI_BASE + XSI_IIM_OFS) | ||
49 | #define XSI_ITIR (XSI_BASE + XSI_ITIR_OFS) | ||
50 | #define XSI_PSR_I_ADDR (XSI_BASE + XSI_PSR_I_ADDR_OFS) | ||
51 | #define XSI_PSR_IC (XSI_BASE + XSI_PSR_IC_OFS) | ||
52 | #define XSI_IPSR (XSI_BASE + XSI_IPSR_OFS) | ||
53 | #define XSI_IIP (XSI_BASE + XSI_IIP_OFS) | ||
54 | #define XSI_B1NAT (XSI_BASE + XSI_B1NATS_OFS) | ||
55 | #define XSI_BANK1_R16 (XSI_BASE + XSI_BANK1_R16_OFS) | ||
56 | #define XSI_BANKNUM (XSI_BASE + XSI_BANKNUM_OFS) | ||
57 | #define XSI_IHA (XSI_BASE + XSI_IHA_OFS) | ||
58 | #endif | ||
59 | |||
60 | #ifndef __ASSEMBLY__ | ||
61 | |||
62 | /************************************************/ | ||
63 | /* Instructions paravirtualized for correctness */ | ||
64 | /************************************************/ | ||
65 | |||
66 | /* "fc" and "thash" are privilege-sensitive instructions, meaning they | ||
67 | * may have different semantics depending on whether they are executed | ||
68 | * at PL0 vs PL!=0. When paravirtualized, these instructions mustn't | ||
69 | * be allowed to execute directly, lest incorrect semantics result. */ | ||
70 | extern void xen_fc(unsigned long addr); | ||
71 | extern unsigned long xen_thash(unsigned long addr); | ||
72 | |||
73 | /* Note that "ttag" and "cover" are also privilege-sensitive; "ttag" | ||
74 | * is not currently used (though it may be in a long-format VHPT system!) | ||
75 | * and the semantics of cover only change if psr.ic is off which is very | ||
76 | * rare (and currently non-existent outside of assembly code */ | ||
77 | |||
78 | /* There are also privilege-sensitive registers. These registers are | ||
79 | * readable at any privilege level but only writable at PL0. */ | ||
80 | extern unsigned long xen_get_cpuid(int index); | ||
81 | extern unsigned long xen_get_pmd(int index); | ||
82 | |||
83 | extern unsigned long xen_get_eflag(void); /* see xen_ia64_getreg */ | ||
84 | extern void xen_set_eflag(unsigned long); /* see xen_ia64_setreg */ | ||
85 | |||
86 | /************************************************/ | ||
87 | /* Instructions paravirtualized for performance */ | ||
88 | /************************************************/ | ||
89 | |||
90 | /* Xen uses memory-mapped virtual privileged registers for access to many | ||
91 | * performance-sensitive privileged registers. Some, like the processor | ||
92 | * status register (psr), are broken up into multiple memory locations. | ||
93 | * Others, like "pend", are abstractions based on privileged registers. | ||
94 | * "Pend" is guaranteed to be set if reading cr.ivr would return a | ||
95 | * (non-spurious) interrupt. */ | ||
96 | #define XEN_MAPPEDREGS ((struct mapped_regs *)XMAPPEDREGS_BASE) | ||
97 | |||
98 | #define XSI_PSR_I \ | ||
99 | (*XEN_MAPPEDREGS->interrupt_mask_addr) | ||
100 | #define xen_get_virtual_psr_i() \ | ||
101 | (!XSI_PSR_I) | ||
102 | #define xen_set_virtual_psr_i(_val) \ | ||
103 | ({ XSI_PSR_I = (uint8_t)(_val) ? 0 : 1; }) | ||
104 | #define xen_set_virtual_psr_ic(_val) \ | ||
105 | ({ XEN_MAPPEDREGS->interrupt_collection_enabled = _val ? 1 : 0; }) | ||
106 | #define xen_get_virtual_pend() \ | ||
107 | (*(((uint8_t *)XEN_MAPPEDREGS->interrupt_mask_addr) - 1)) | ||
108 | |||
109 | /* Although all privileged operations can be left to trap and will | ||
110 | * be properly handled by Xen, some are frequent enough that we use | ||
111 | * hyperprivops for performance. */ | ||
112 | extern unsigned long xen_get_psr(void); | ||
113 | extern unsigned long xen_get_ivr(void); | ||
114 | extern unsigned long xen_get_tpr(void); | ||
115 | extern void xen_hyper_ssm_i(void); | ||
116 | extern void xen_set_itm(unsigned long); | ||
117 | extern void xen_set_tpr(unsigned long); | ||
118 | extern void xen_eoi(unsigned long); | ||
119 | extern unsigned long xen_get_rr(unsigned long index); | ||
120 | extern void xen_set_rr(unsigned long index, unsigned long val); | ||
121 | extern void xen_set_rr0_to_rr4(unsigned long val0, unsigned long val1, | ||
122 | unsigned long val2, unsigned long val3, | ||
123 | unsigned long val4); | ||
124 | extern void xen_set_kr(unsigned long index, unsigned long val); | ||
125 | extern void xen_ptcga(unsigned long addr, unsigned long size); | ||
126 | |||
127 | #endif /* !__ASSEMBLY__ */ | ||
128 | |||
129 | #endif /* _ASM_IA64_XEN_PRIVOP_H */ | ||