diff options
author | Xiantao Zhang <xiantao.zhang@intel.com> | 2008-04-01 02:45:06 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-04-27 05:01:02 -0400 |
commit | 1a9c1ac46990194f6b6ddc591c24e385e611fa25 (patch) | |
tree | 0ad75083d4f8a992238a18e2816d2b16affff35b /include | |
parent | e235f3450f5bf94b989746163b7791784a78ee05 (diff) |
KVM: ia64: Add header files for kvm/ia64
Three header files are added:
asm-ia64/kvm.h
asm-ia64/kvm_host.h
asm-ia64/kvm_para.h
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-ia64/kvm.h | 205 | ||||
-rw-r--r-- | include/asm-ia64/kvm_host.h | 524 | ||||
-rw-r--r-- | include/asm-ia64/kvm_para.h | 29 |
3 files changed, 755 insertions, 3 deletions
diff --git a/include/asm-ia64/kvm.h b/include/asm-ia64/kvm.h index 030d29b4b26b..eb2d3559d089 100644 --- a/include/asm-ia64/kvm.h +++ b/include/asm-ia64/kvm.h | |||
@@ -1,6 +1,205 @@ | |||
1 | #ifndef __LINUX_KVM_IA64_H | 1 | #ifndef __ASM_IA64_KVM_H |
2 | #define __LINUX_KVM_IA64_H | 2 | #define __ASM_IA64_KVM_H |
3 | 3 | ||
4 | /* ia64 does not support KVM */ | 4 | /* |
5 | * asm-ia64/kvm.h: kvm structure definitions for ia64 | ||
6 | * | ||
7 | * Copyright (C) 2007 Xiantao Zhang <xiantao.zhang@intel.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms and conditions of the GNU General Public License, | ||
11 | * version 2, as published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along with | ||
19 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
20 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | #include <asm/types.h> | ||
25 | #include <asm/fpu.h> | ||
26 | |||
27 | #include <linux/ioctl.h> | ||
28 | |||
29 | /* Architectural interrupt line count. */ | ||
30 | #define KVM_NR_INTERRUPTS 256 | ||
31 | |||
32 | #define KVM_IOAPIC_NUM_PINS 24 | ||
33 | |||
34 | struct kvm_ioapic_state { | ||
35 | __u64 base_address; | ||
36 | __u32 ioregsel; | ||
37 | __u32 id; | ||
38 | __u32 irr; | ||
39 | __u32 pad; | ||
40 | union { | ||
41 | __u64 bits; | ||
42 | struct { | ||
43 | __u8 vector; | ||
44 | __u8 delivery_mode:3; | ||
45 | __u8 dest_mode:1; | ||
46 | __u8 delivery_status:1; | ||
47 | __u8 polarity:1; | ||
48 | __u8 remote_irr:1; | ||
49 | __u8 trig_mode:1; | ||
50 | __u8 mask:1; | ||
51 | __u8 reserve:7; | ||
52 | __u8 reserved[4]; | ||
53 | __u8 dest_id; | ||
54 | } fields; | ||
55 | } redirtbl[KVM_IOAPIC_NUM_PINS]; | ||
56 | }; | ||
57 | |||
58 | #define KVM_IRQCHIP_PIC_MASTER 0 | ||
59 | #define KVM_IRQCHIP_PIC_SLAVE 1 | ||
60 | #define KVM_IRQCHIP_IOAPIC 2 | ||
61 | |||
62 | #define KVM_CONTEXT_SIZE 8*1024 | ||
63 | |||
64 | union context { | ||
65 | /* 8K size */ | ||
66 | char dummy[KVM_CONTEXT_SIZE]; | ||
67 | struct { | ||
68 | unsigned long psr; | ||
69 | unsigned long pr; | ||
70 | unsigned long caller_unat; | ||
71 | unsigned long pad; | ||
72 | unsigned long gr[32]; | ||
73 | unsigned long ar[128]; | ||
74 | unsigned long br[8]; | ||
75 | unsigned long cr[128]; | ||
76 | unsigned long rr[8]; | ||
77 | unsigned long ibr[8]; | ||
78 | unsigned long dbr[8]; | ||
79 | unsigned long pkr[8]; | ||
80 | struct ia64_fpreg fr[128]; | ||
81 | }; | ||
82 | }; | ||
83 | |||
84 | struct thash_data { | ||
85 | union { | ||
86 | struct { | ||
87 | unsigned long p : 1; /* 0 */ | ||
88 | unsigned long rv1 : 1; /* 1 */ | ||
89 | unsigned long ma : 3; /* 2-4 */ | ||
90 | unsigned long a : 1; /* 5 */ | ||
91 | unsigned long d : 1; /* 6 */ | ||
92 | unsigned long pl : 2; /* 7-8 */ | ||
93 | unsigned long ar : 3; /* 9-11 */ | ||
94 | unsigned long ppn : 38; /* 12-49 */ | ||
95 | unsigned long rv2 : 2; /* 50-51 */ | ||
96 | unsigned long ed : 1; /* 52 */ | ||
97 | unsigned long ig1 : 11; /* 53-63 */ | ||
98 | }; | ||
99 | struct { | ||
100 | unsigned long __rv1 : 53; /* 0-52 */ | ||
101 | unsigned long contiguous : 1; /*53 */ | ||
102 | unsigned long tc : 1; /* 54 TR or TC */ | ||
103 | unsigned long cl : 1; | ||
104 | /* 55 I side or D side cache line */ | ||
105 | unsigned long len : 4; /* 56-59 */ | ||
106 | unsigned long io : 1; /* 60 entry is for io or not */ | ||
107 | unsigned long nomap : 1; | ||
108 | /* 61 entry cann't be inserted into machine TLB.*/ | ||
109 | unsigned long checked : 1; | ||
110 | /* 62 for VTLB/VHPT sanity check */ | ||
111 | unsigned long invalid : 1; | ||
112 | /* 63 invalid entry */ | ||
113 | }; | ||
114 | unsigned long page_flags; | ||
115 | }; /* same for VHPT and TLB */ | ||
116 | |||
117 | union { | ||
118 | struct { | ||
119 | unsigned long rv3 : 2; | ||
120 | unsigned long ps : 6; | ||
121 | unsigned long key : 24; | ||
122 | unsigned long rv4 : 32; | ||
123 | }; | ||
124 | unsigned long itir; | ||
125 | }; | ||
126 | union { | ||
127 | struct { | ||
128 | unsigned long ig2 : 12; | ||
129 | unsigned long vpn : 49; | ||
130 | unsigned long vrn : 3; | ||
131 | }; | ||
132 | unsigned long ifa; | ||
133 | unsigned long vadr; | ||
134 | struct { | ||
135 | unsigned long tag : 63; | ||
136 | unsigned long ti : 1; | ||
137 | }; | ||
138 | unsigned long etag; | ||
139 | }; | ||
140 | union { | ||
141 | struct thash_data *next; | ||
142 | unsigned long rid; | ||
143 | unsigned long gpaddr; | ||
144 | }; | ||
145 | }; | ||
146 | |||
147 | #define NITRS 8 | ||
148 | #define NDTRS 8 | ||
149 | |||
150 | struct saved_vpd { | ||
151 | unsigned long vhpi; | ||
152 | unsigned long vgr[16]; | ||
153 | unsigned long vbgr[16]; | ||
154 | unsigned long vnat; | ||
155 | unsigned long vbnat; | ||
156 | unsigned long vcpuid[5]; | ||
157 | unsigned long vpsr; | ||
158 | unsigned long vpr; | ||
159 | unsigned long vcr[128]; | ||
160 | }; | ||
161 | |||
162 | struct kvm_regs { | ||
163 | char *saved_guest; | ||
164 | char *saved_stack; | ||
165 | struct saved_vpd vpd; | ||
166 | /*Arch-regs*/ | ||
167 | int mp_state; | ||
168 | unsigned long vmm_rr; | ||
169 | /* TR and TC. */ | ||
170 | struct thash_data itrs[NITRS]; | ||
171 | struct thash_data dtrs[NDTRS]; | ||
172 | /* Bit is set if there is a tr/tc for the region. */ | ||
173 | unsigned char itr_regions; | ||
174 | unsigned char dtr_regions; | ||
175 | unsigned char tc_regions; | ||
176 | |||
177 | char irq_check; | ||
178 | unsigned long saved_itc; | ||
179 | unsigned long itc_check; | ||
180 | unsigned long timer_check; | ||
181 | unsigned long timer_pending; | ||
182 | unsigned long last_itc; | ||
183 | |||
184 | unsigned long vrr[8]; | ||
185 | unsigned long ibr[8]; | ||
186 | unsigned long dbr[8]; | ||
187 | unsigned long insvc[4]; /* Interrupt in service. */ | ||
188 | unsigned long xtp; | ||
189 | |||
190 | unsigned long metaphysical_rr0; /* from kvm_arch (so is pinned) */ | ||
191 | unsigned long metaphysical_rr4; /* from kvm_arch (so is pinned) */ | ||
192 | unsigned long metaphysical_saved_rr0; /* from kvm_arch */ | ||
193 | unsigned long metaphysical_saved_rr4; /* from kvm_arch */ | ||
194 | unsigned long fp_psr; /*used for lazy float register */ | ||
195 | unsigned long saved_gp; | ||
196 | /*for phycial emulation */ | ||
197 | }; | ||
198 | |||
199 | struct kvm_sregs { | ||
200 | }; | ||
201 | |||
202 | struct kvm_fpu { | ||
203 | }; | ||
5 | 204 | ||
6 | #endif | 205 | #endif |
diff --git a/include/asm-ia64/kvm_host.h b/include/asm-ia64/kvm_host.h new file mode 100644 index 000000000000..d6d6e15c1924 --- /dev/null +++ b/include/asm-ia64/kvm_host.h | |||
@@ -0,0 +1,524 @@ | |||
1 | /* | ||
2 | * kvm_host.h: used for kvm module, and hold ia64-specific sections. | ||
3 | * | ||
4 | * Copyright (C) 2007, Intel Corporation. | ||
5 | * | ||
6 | * Xiantao Zhang <xiantao.zhang@intel.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms and conditions of the GNU General Public License, | ||
10 | * version 2, as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
14 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
15 | * more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License along with | ||
18 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
19 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __ASM_KVM_HOST_H | ||
24 | #define __ASM_KVM_HOST_H | ||
25 | |||
26 | |||
27 | #include <linux/types.h> | ||
28 | #include <linux/mm.h> | ||
29 | #include <linux/kvm.h> | ||
30 | #include <linux/kvm_para.h> | ||
31 | #include <linux/kvm_types.h> | ||
32 | |||
33 | #include <asm/pal.h> | ||
34 | #include <asm/sal.h> | ||
35 | |||
36 | #define KVM_MAX_VCPUS 4 | ||
37 | #define KVM_MEMORY_SLOTS 32 | ||
38 | /* memory slots that does not exposed to userspace */ | ||
39 | #define KVM_PRIVATE_MEM_SLOTS 4 | ||
40 | |||
41 | |||
42 | /* define exit reasons from vmm to kvm*/ | ||
43 | #define EXIT_REASON_VM_PANIC 0 | ||
44 | #define EXIT_REASON_MMIO_INSTRUCTION 1 | ||
45 | #define EXIT_REASON_PAL_CALL 2 | ||
46 | #define EXIT_REASON_SAL_CALL 3 | ||
47 | #define EXIT_REASON_SWITCH_RR6 4 | ||
48 | #define EXIT_REASON_VM_DESTROY 5 | ||
49 | #define EXIT_REASON_EXTERNAL_INTERRUPT 6 | ||
50 | #define EXIT_REASON_IPI 7 | ||
51 | #define EXIT_REASON_PTC_G 8 | ||
52 | |||
53 | /*Define vmm address space and vm data space.*/ | ||
54 | #define KVM_VMM_SIZE (16UL<<20) | ||
55 | #define KVM_VMM_SHIFT 24 | ||
56 | #define KVM_VMM_BASE 0xD000000000000000UL | ||
57 | #define VMM_SIZE (8UL<<20) | ||
58 | |||
59 | /* | ||
60 | * Define vm_buffer, used by PAL Services, base address. | ||
61 | * Note: vmbuffer is in the VMM-BLOCK, the size must be < 8M | ||
62 | */ | ||
63 | #define KVM_VM_BUFFER_BASE (KVM_VMM_BASE + VMM_SIZE) | ||
64 | #define KVM_VM_BUFFER_SIZE (8UL<<20) | ||
65 | |||
66 | /*Define Virtual machine data layout.*/ | ||
67 | #define KVM_VM_DATA_SHIFT 24 | ||
68 | #define KVM_VM_DATA_SIZE (1UL << KVM_VM_DATA_SHIFT) | ||
69 | #define KVM_VM_DATA_BASE (KVM_VMM_BASE + KVM_VMM_SIZE) | ||
70 | |||
71 | |||
72 | #define KVM_P2M_BASE KVM_VM_DATA_BASE | ||
73 | #define KVM_P2M_OFS 0 | ||
74 | #define KVM_P2M_SIZE (8UL << 20) | ||
75 | |||
76 | #define KVM_VHPT_BASE (KVM_P2M_BASE + KVM_P2M_SIZE) | ||
77 | #define KVM_VHPT_OFS KVM_P2M_SIZE | ||
78 | #define KVM_VHPT_BLOCK_SIZE (2UL << 20) | ||
79 | #define VHPT_SHIFT 18 | ||
80 | #define VHPT_SIZE (1UL << VHPT_SHIFT) | ||
81 | #define VHPT_NUM_ENTRIES (1<<(VHPT_SHIFT-5)) | ||
82 | |||
83 | #define KVM_VTLB_BASE (KVM_VHPT_BASE+KVM_VHPT_BLOCK_SIZE) | ||
84 | #define KVM_VTLB_OFS (KVM_VHPT_OFS+KVM_VHPT_BLOCK_SIZE) | ||
85 | #define KVM_VTLB_BLOCK_SIZE (1UL<<20) | ||
86 | #define VTLB_SHIFT 17 | ||
87 | #define VTLB_SIZE (1UL<<VTLB_SHIFT) | ||
88 | #define VTLB_NUM_ENTRIES (1<<(VTLB_SHIFT-5)) | ||
89 | |||
90 | #define KVM_VPD_BASE (KVM_VTLB_BASE+KVM_VTLB_BLOCK_SIZE) | ||
91 | #define KVM_VPD_OFS (KVM_VTLB_OFS+KVM_VTLB_BLOCK_SIZE) | ||
92 | #define KVM_VPD_BLOCK_SIZE (2UL<<20) | ||
93 | #define VPD_SHIFT 16 | ||
94 | #define VPD_SIZE (1UL<<VPD_SHIFT) | ||
95 | |||
96 | #define KVM_VCPU_BASE (KVM_VPD_BASE+KVM_VPD_BLOCK_SIZE) | ||
97 | #define KVM_VCPU_OFS (KVM_VPD_OFS+KVM_VPD_BLOCK_SIZE) | ||
98 | #define KVM_VCPU_BLOCK_SIZE (2UL<<20) | ||
99 | #define VCPU_SHIFT 18 | ||
100 | #define VCPU_SIZE (1UL<<VCPU_SHIFT) | ||
101 | #define MAX_VCPU_NUM KVM_VCPU_BLOCK_SIZE/VCPU_SIZE | ||
102 | |||
103 | #define KVM_VM_BASE (KVM_VCPU_BASE+KVM_VCPU_BLOCK_SIZE) | ||
104 | #define KVM_VM_OFS (KVM_VCPU_OFS+KVM_VCPU_BLOCK_SIZE) | ||
105 | #define KVM_VM_BLOCK_SIZE (1UL<<19) | ||
106 | |||
107 | #define KVM_MEM_DIRTY_LOG_BASE (KVM_VM_BASE+KVM_VM_BLOCK_SIZE) | ||
108 | #define KVM_MEM_DIRTY_LOG_OFS (KVM_VM_OFS+KVM_VM_BLOCK_SIZE) | ||
109 | #define KVM_MEM_DIRTY_LOG_SIZE (1UL<<19) | ||
110 | |||
111 | /* Get vpd, vhpt, tlb, vcpu, base*/ | ||
112 | #define VPD_ADDR(n) (KVM_VPD_BASE+n*VPD_SIZE) | ||
113 | #define VHPT_ADDR(n) (KVM_VHPT_BASE+n*VHPT_SIZE) | ||
114 | #define VTLB_ADDR(n) (KVM_VTLB_BASE+n*VTLB_SIZE) | ||
115 | #define VCPU_ADDR(n) (KVM_VCPU_BASE+n*VCPU_SIZE) | ||
116 | |||
117 | /*IO section definitions*/ | ||
118 | #define IOREQ_READ 1 | ||
119 | #define IOREQ_WRITE 0 | ||
120 | |||
121 | #define STATE_IOREQ_NONE 0 | ||
122 | #define STATE_IOREQ_READY 1 | ||
123 | #define STATE_IOREQ_INPROCESS 2 | ||
124 | #define STATE_IORESP_READY 3 | ||
125 | |||
126 | /*Guest Physical address layout.*/ | ||
127 | #define GPFN_MEM (0UL << 60) /* Guest pfn is normal mem */ | ||
128 | #define GPFN_FRAME_BUFFER (1UL << 60) /* VGA framebuffer */ | ||
129 | #define GPFN_LOW_MMIO (2UL << 60) /* Low MMIO range */ | ||
130 | #define GPFN_PIB (3UL << 60) /* PIB base */ | ||
131 | #define GPFN_IOSAPIC (4UL << 60) /* IOSAPIC base */ | ||
132 | #define GPFN_LEGACY_IO (5UL << 60) /* Legacy I/O base */ | ||
133 | #define GPFN_GFW (6UL << 60) /* Guest Firmware */ | ||
134 | #define GPFN_HIGH_MMIO (7UL << 60) /* High MMIO range */ | ||
135 | |||
136 | #define GPFN_IO_MASK (7UL << 60) /* Guest pfn is I/O type */ | ||
137 | #define GPFN_INV_MASK (1UL << 63) /* Guest pfn is invalid */ | ||
138 | #define INVALID_MFN (~0UL) | ||
139 | #define MEM_G (1UL << 30) | ||
140 | #define MEM_M (1UL << 20) | ||
141 | #define MMIO_START (3 * MEM_G) | ||
142 | #define MMIO_SIZE (512 * MEM_M) | ||
143 | #define VGA_IO_START 0xA0000UL | ||
144 | #define VGA_IO_SIZE 0x20000 | ||
145 | #define LEGACY_IO_START (MMIO_START + MMIO_SIZE) | ||
146 | #define LEGACY_IO_SIZE (64 * MEM_M) | ||
147 | #define IO_SAPIC_START 0xfec00000UL | ||
148 | #define IO_SAPIC_SIZE 0x100000 | ||
149 | #define PIB_START 0xfee00000UL | ||
150 | #define PIB_SIZE 0x200000 | ||
151 | #define GFW_START (4 * MEM_G - 16 * MEM_M) | ||
152 | #define GFW_SIZE (16 * MEM_M) | ||
153 | |||
154 | /*Deliver mode, defined for ioapic.c*/ | ||
155 | #define dest_Fixed IOSAPIC_FIXED | ||
156 | #define dest_LowestPrio IOSAPIC_LOWEST_PRIORITY | ||
157 | |||
158 | #define NMI_VECTOR 2 | ||
159 | #define ExtINT_VECTOR 0 | ||
160 | #define NULL_VECTOR (-1) | ||
161 | #define IA64_SPURIOUS_INT_VECTOR 0x0f | ||
162 | |||
163 | #define VCPU_LID(v) (((u64)(v)->vcpu_id) << 24) | ||
164 | |||
165 | /* | ||
166 | *Delivery mode | ||
167 | */ | ||
168 | #define SAPIC_DELIV_SHIFT 8 | ||
169 | #define SAPIC_FIXED 0x0 | ||
170 | #define SAPIC_LOWEST_PRIORITY 0x1 | ||
171 | #define SAPIC_PMI 0x2 | ||
172 | #define SAPIC_NMI 0x4 | ||
173 | #define SAPIC_INIT 0x5 | ||
174 | #define SAPIC_EXTINT 0x7 | ||
175 | |||
176 | /* | ||
177 | * vcpu->requests bit members for arch | ||
178 | */ | ||
179 | #define KVM_REQ_PTC_G 32 | ||
180 | #define KVM_REQ_RESUME 33 | ||
181 | |||
182 | #define KVM_PAGES_PER_HPAGE 1 | ||
183 | |||
184 | struct kvm; | ||
185 | struct kvm_vcpu; | ||
186 | struct kvm_guest_debug{ | ||
187 | }; | ||
188 | |||
189 | struct kvm_mmio_req { | ||
190 | uint64_t addr; /* physical address */ | ||
191 | uint64_t size; /* size in bytes */ | ||
192 | uint64_t data; /* data (or paddr of data) */ | ||
193 | uint8_t state:4; | ||
194 | uint8_t dir:1; /* 1=read, 0=write */ | ||
195 | }; | ||
196 | |||
197 | /*Pal data struct */ | ||
198 | struct kvm_pal_call{ | ||
199 | /*In area*/ | ||
200 | uint64_t gr28; | ||
201 | uint64_t gr29; | ||
202 | uint64_t gr30; | ||
203 | uint64_t gr31; | ||
204 | /*Out area*/ | ||
205 | struct ia64_pal_retval ret; | ||
206 | }; | ||
207 | |||
208 | /* Sal data structure */ | ||
209 | struct kvm_sal_call{ | ||
210 | /*In area*/ | ||
211 | uint64_t in0; | ||
212 | uint64_t in1; | ||
213 | uint64_t in2; | ||
214 | uint64_t in3; | ||
215 | uint64_t in4; | ||
216 | uint64_t in5; | ||
217 | uint64_t in6; | ||
218 | uint64_t in7; | ||
219 | struct sal_ret_values ret; | ||
220 | }; | ||
221 | |||
222 | /*Guest change rr6*/ | ||
223 | struct kvm_switch_rr6 { | ||
224 | uint64_t old_rr; | ||
225 | uint64_t new_rr; | ||
226 | }; | ||
227 | |||
228 | union ia64_ipi_a{ | ||
229 | unsigned long val; | ||
230 | struct { | ||
231 | unsigned long rv : 3; | ||
232 | unsigned long ir : 1; | ||
233 | unsigned long eid : 8; | ||
234 | unsigned long id : 8; | ||
235 | unsigned long ib_base : 44; | ||
236 | }; | ||
237 | }; | ||
238 | |||
239 | union ia64_ipi_d { | ||
240 | unsigned long val; | ||
241 | struct { | ||
242 | unsigned long vector : 8; | ||
243 | unsigned long dm : 3; | ||
244 | unsigned long ig : 53; | ||
245 | }; | ||
246 | }; | ||
247 | |||
248 | /*ipi check exit data*/ | ||
249 | struct kvm_ipi_data{ | ||
250 | union ia64_ipi_a addr; | ||
251 | union ia64_ipi_d data; | ||
252 | }; | ||
253 | |||
254 | /*global purge data*/ | ||
255 | struct kvm_ptc_g { | ||
256 | unsigned long vaddr; | ||
257 | unsigned long rr; | ||
258 | unsigned long ps; | ||
259 | struct kvm_vcpu *vcpu; | ||
260 | }; | ||
261 | |||
262 | /*Exit control data */ | ||
263 | struct exit_ctl_data{ | ||
264 | uint32_t exit_reason; | ||
265 | uint32_t vm_status; | ||
266 | union { | ||
267 | struct kvm_mmio_req ioreq; | ||
268 | struct kvm_pal_call pal_data; | ||
269 | struct kvm_sal_call sal_data; | ||
270 | struct kvm_switch_rr6 rr_data; | ||
271 | struct kvm_ipi_data ipi_data; | ||
272 | struct kvm_ptc_g ptc_g_data; | ||
273 | } u; | ||
274 | }; | ||
275 | |||
276 | union pte_flags { | ||
277 | unsigned long val; | ||
278 | struct { | ||
279 | unsigned long p : 1; /*0 */ | ||
280 | unsigned long : 1; /* 1 */ | ||
281 | unsigned long ma : 3; /* 2-4 */ | ||
282 | unsigned long a : 1; /* 5 */ | ||
283 | unsigned long d : 1; /* 6 */ | ||
284 | unsigned long pl : 2; /* 7-8 */ | ||
285 | unsigned long ar : 3; /* 9-11 */ | ||
286 | unsigned long ppn : 38; /* 12-49 */ | ||
287 | unsigned long : 2; /* 50-51 */ | ||
288 | unsigned long ed : 1; /* 52 */ | ||
289 | }; | ||
290 | }; | ||
291 | |||
292 | union ia64_pta { | ||
293 | unsigned long val; | ||
294 | struct { | ||
295 | unsigned long ve : 1; | ||
296 | unsigned long reserved0 : 1; | ||
297 | unsigned long size : 6; | ||
298 | unsigned long vf : 1; | ||
299 | unsigned long reserved1 : 6; | ||
300 | unsigned long base : 49; | ||
301 | }; | ||
302 | }; | ||
303 | |||
304 | struct thash_cb { | ||
305 | /* THASH base information */ | ||
306 | struct thash_data *hash; /* hash table pointer */ | ||
307 | union ia64_pta pta; | ||
308 | int num; | ||
309 | }; | ||
310 | |||
311 | struct kvm_vcpu_stat { | ||
312 | }; | ||
313 | |||
314 | struct kvm_vcpu_arch { | ||
315 | int launched; | ||
316 | int last_exit; | ||
317 | int last_run_cpu; | ||
318 | int vmm_tr_slot; | ||
319 | int vm_tr_slot; | ||
320 | |||
321 | #define VCPU_MP_STATE_RUNNABLE 0 | ||
322 | #define VCPU_MP_STATE_UNINITIALIZED 1 | ||
323 | #define VCPU_MP_STATE_INIT_RECEIVED 2 | ||
324 | #define VCPU_MP_STATE_HALTED 3 | ||
325 | int mp_state; | ||
326 | |||
327 | #define MAX_PTC_G_NUM 3 | ||
328 | int ptc_g_count; | ||
329 | struct kvm_ptc_g ptc_g_data[MAX_PTC_G_NUM]; | ||
330 | |||
331 | /*halt timer to wake up sleepy vcpus*/ | ||
332 | struct hrtimer hlt_timer; | ||
333 | long ht_active; | ||
334 | |||
335 | struct kvm_lapic *apic; /* kernel irqchip context */ | ||
336 | struct vpd *vpd; | ||
337 | |||
338 | /* Exit data for vmm_transition*/ | ||
339 | struct exit_ctl_data exit_data; | ||
340 | |||
341 | cpumask_t cache_coherent_map; | ||
342 | |||
343 | unsigned long vmm_rr; | ||
344 | unsigned long host_rr6; | ||
345 | unsigned long psbits[8]; | ||
346 | unsigned long cr_iipa; | ||
347 | unsigned long cr_isr; | ||
348 | unsigned long vsa_base; | ||
349 | unsigned long dirty_log_lock_pa; | ||
350 | unsigned long __gp; | ||
351 | /* TR and TC. */ | ||
352 | struct thash_data itrs[NITRS]; | ||
353 | struct thash_data dtrs[NDTRS]; | ||
354 | /* Bit is set if there is a tr/tc for the region. */ | ||
355 | unsigned char itr_regions; | ||
356 | unsigned char dtr_regions; | ||
357 | unsigned char tc_regions; | ||
358 | /* purge all */ | ||
359 | unsigned long ptce_base; | ||
360 | unsigned long ptce_count[2]; | ||
361 | unsigned long ptce_stride[2]; | ||
362 | /* itc/itm */ | ||
363 | unsigned long last_itc; | ||
364 | long itc_offset; | ||
365 | unsigned long itc_check; | ||
366 | unsigned long timer_check; | ||
367 | unsigned long timer_pending; | ||
368 | |||
369 | unsigned long vrr[8]; | ||
370 | unsigned long ibr[8]; | ||
371 | unsigned long dbr[8]; | ||
372 | unsigned long insvc[4]; /* Interrupt in service. */ | ||
373 | unsigned long xtp; | ||
374 | |||
375 | unsigned long metaphysical_rr0; /* from kvm_arch (so is pinned) */ | ||
376 | unsigned long metaphysical_rr4; /* from kvm_arch (so is pinned) */ | ||
377 | unsigned long metaphysical_saved_rr0; /* from kvm_arch */ | ||
378 | unsigned long metaphysical_saved_rr4; /* from kvm_arch */ | ||
379 | unsigned long fp_psr; /*used for lazy float register */ | ||
380 | unsigned long saved_gp; | ||
381 | /*for phycial emulation */ | ||
382 | int mode_flags; | ||
383 | struct thash_cb vtlb; | ||
384 | struct thash_cb vhpt; | ||
385 | char irq_check; | ||
386 | char irq_new_pending; | ||
387 | |||
388 | unsigned long opcode; | ||
389 | unsigned long cause; | ||
390 | union context host; | ||
391 | union context guest; | ||
392 | }; | ||
393 | |||
394 | struct kvm_vm_stat { | ||
395 | u64 remote_tlb_flush; | ||
396 | }; | ||
397 | |||
398 | struct kvm_sal_data { | ||
399 | unsigned long boot_ip; | ||
400 | unsigned long boot_gp; | ||
401 | }; | ||
402 | |||
403 | struct kvm_arch { | ||
404 | unsigned long vm_base; | ||
405 | unsigned long metaphysical_rr0; | ||
406 | unsigned long metaphysical_rr4; | ||
407 | unsigned long vmm_init_rr; | ||
408 | unsigned long vhpt_base; | ||
409 | unsigned long vtlb_base; | ||
410 | unsigned long vpd_base; | ||
411 | spinlock_t dirty_log_lock; | ||
412 | struct kvm_ioapic *vioapic; | ||
413 | struct kvm_vm_stat stat; | ||
414 | struct kvm_sal_data rdv_sal_data; | ||
415 | }; | ||
416 | |||
417 | union cpuid3_t { | ||
418 | u64 value; | ||
419 | struct { | ||
420 | u64 number : 8; | ||
421 | u64 revision : 8; | ||
422 | u64 model : 8; | ||
423 | u64 family : 8; | ||
424 | u64 archrev : 8; | ||
425 | u64 rv : 24; | ||
426 | }; | ||
427 | }; | ||
428 | |||
429 | struct kvm_pt_regs { | ||
430 | /* The following registers are saved by SAVE_MIN: */ | ||
431 | unsigned long b6; /* scratch */ | ||
432 | unsigned long b7; /* scratch */ | ||
433 | |||
434 | unsigned long ar_csd; /* used by cmp8xchg16 (scratch) */ | ||
435 | unsigned long ar_ssd; /* reserved for future use (scratch) */ | ||
436 | |||
437 | unsigned long r8; /* scratch (return value register 0) */ | ||
438 | unsigned long r9; /* scratch (return value register 1) */ | ||
439 | unsigned long r10; /* scratch (return value register 2) */ | ||
440 | unsigned long r11; /* scratch (return value register 3) */ | ||
441 | |||
442 | unsigned long cr_ipsr; /* interrupted task's psr */ | ||
443 | unsigned long cr_iip; /* interrupted task's instruction pointer */ | ||
444 | unsigned long cr_ifs; /* interrupted task's function state */ | ||
445 | |||
446 | unsigned long ar_unat; /* interrupted task's NaT register (preserved) */ | ||
447 | unsigned long ar_pfs; /* prev function state */ | ||
448 | unsigned long ar_rsc; /* RSE configuration */ | ||
449 | /* The following two are valid only if cr_ipsr.cpl > 0: */ | ||
450 | unsigned long ar_rnat; /* RSE NaT */ | ||
451 | unsigned long ar_bspstore; /* RSE bspstore */ | ||
452 | |||
453 | unsigned long pr; /* 64 predicate registers (1 bit each) */ | ||
454 | unsigned long b0; /* return pointer (bp) */ | ||
455 | unsigned long loadrs; /* size of dirty partition << 16 */ | ||
456 | |||
457 | unsigned long r1; /* the gp pointer */ | ||
458 | unsigned long r12; /* interrupted task's memory stack pointer */ | ||
459 | unsigned long r13; /* thread pointer */ | ||
460 | |||
461 | unsigned long ar_fpsr; /* floating point status (preserved) */ | ||
462 | unsigned long r15; /* scratch */ | ||
463 | |||
464 | /* The remaining registers are NOT saved for system calls. */ | ||
465 | unsigned long r14; /* scratch */ | ||
466 | unsigned long r2; /* scratch */ | ||
467 | unsigned long r3; /* scratch */ | ||
468 | unsigned long r16; /* scratch */ | ||
469 | unsigned long r17; /* scratch */ | ||
470 | unsigned long r18; /* scratch */ | ||
471 | unsigned long r19; /* scratch */ | ||
472 | unsigned long r20; /* scratch */ | ||
473 | unsigned long r21; /* scratch */ | ||
474 | unsigned long r22; /* scratch */ | ||
475 | unsigned long r23; /* scratch */ | ||
476 | unsigned long r24; /* scratch */ | ||
477 | unsigned long r25; /* scratch */ | ||
478 | unsigned long r26; /* scratch */ | ||
479 | unsigned long r27; /* scratch */ | ||
480 | unsigned long r28; /* scratch */ | ||
481 | unsigned long r29; /* scratch */ | ||
482 | unsigned long r30; /* scratch */ | ||
483 | unsigned long r31; /* scratch */ | ||
484 | unsigned long ar_ccv; /* compare/exchange value (scratch) */ | ||
485 | |||
486 | /* | ||
487 | * Floating point registers that the kernel considers scratch: | ||
488 | */ | ||
489 | struct ia64_fpreg f6; /* scratch */ | ||
490 | struct ia64_fpreg f7; /* scratch */ | ||
491 | struct ia64_fpreg f8; /* scratch */ | ||
492 | struct ia64_fpreg f9; /* scratch */ | ||
493 | struct ia64_fpreg f10; /* scratch */ | ||
494 | struct ia64_fpreg f11; /* scratch */ | ||
495 | |||
496 | unsigned long r4; /* preserved */ | ||
497 | unsigned long r5; /* preserved */ | ||
498 | unsigned long r6; /* preserved */ | ||
499 | unsigned long r7; /* preserved */ | ||
500 | unsigned long eml_unat; /* used for emulating instruction */ | ||
501 | unsigned long pad0; /* alignment pad */ | ||
502 | }; | ||
503 | |||
504 | static inline struct kvm_pt_regs *vcpu_regs(struct kvm_vcpu *v) | ||
505 | { | ||
506 | return (struct kvm_pt_regs *) ((unsigned long) v + IA64_STK_OFFSET) - 1; | ||
507 | } | ||
508 | |||
509 | typedef int kvm_vmm_entry(void); | ||
510 | typedef void kvm_tramp_entry(union context *host, union context *guest); | ||
511 | |||
512 | struct kvm_vmm_info{ | ||
513 | struct module *module; | ||
514 | kvm_vmm_entry *vmm_entry; | ||
515 | kvm_tramp_entry *tramp_entry; | ||
516 | unsigned long vmm_ivt; | ||
517 | }; | ||
518 | |||
519 | int kvm_highest_pending_irq(struct kvm_vcpu *vcpu); | ||
520 | int kvm_emulate_halt(struct kvm_vcpu *vcpu); | ||
521 | int kvm_pal_emul(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run); | ||
522 | void kvm_sal_emul(struct kvm_vcpu *vcpu); | ||
523 | |||
524 | #endif | ||
diff --git a/include/asm-ia64/kvm_para.h b/include/asm-ia64/kvm_para.h new file mode 100644 index 000000000000..9f9796bb3441 --- /dev/null +++ b/include/asm-ia64/kvm_para.h | |||
@@ -0,0 +1,29 @@ | |||
1 | #ifndef __IA64_KVM_PARA_H | ||
2 | #define __IA64_KVM_PARA_H | ||
3 | |||
4 | /* | ||
5 | * asm-ia64/kvm_para.h | ||
6 | * | ||
7 | * Copyright (C) 2007 Xiantao Zhang <xiantao.zhang@intel.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify it | ||
10 | * under the terms and conditions of the GNU General Public License, | ||
11 | * version 2, as published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
16 | * more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License along with | ||
19 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
20 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
21 | * | ||
22 | */ | ||
23 | |||
24 | static inline unsigned int kvm_arch_para_features(void) | ||
25 | { | ||
26 | return 0; | ||
27 | } | ||
28 | |||
29 | #endif | ||