ia64/xen-unstable

view xen/include/asm-x86/hvm/vmx/vmcs.h @ 12226:45e34f00a78f

[HVM] Clean up VCPU initialisation in Xen. No longer
parse HVM e820 tables in Xen (add some extra HVM parameters as a
cleaner alternative). Lots of code removal.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Thu Nov 02 15:55:51 2006 +0000 (2006-11-02)
parents 646a120334ef
children 1db00df48218
line source
1 /*
2 * vmcs.h: VMCS related definitions
3 * Copyright (c) 2004, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
17 *
18 */
19 #ifndef __ASM_X86_HVM_VMX_VMCS_H__
20 #define __ASM_X86_HVM_VMX_VMCS_H__
22 #include <asm/config.h>
23 #include <asm/hvm/io.h>
24 #include <asm/hvm/vmx/cpu.h>
25 #include <public/hvm/vmx_assist.h>
27 extern int start_vmx(void);
28 extern void vmcs_dump_vcpu(void);
29 extern void vmx_init_vmcs_config(void);
30 extern void setup_vmcs_dump(void);
32 struct vmcs_struct {
33 u32 vmcs_revision_id;
34 unsigned char data [0]; /* vmcs size is read from MSR */
35 };
37 enum {
38 VMX_INDEX_MSR_LSTAR = 0,
39 VMX_INDEX_MSR_STAR,
40 VMX_INDEX_MSR_CSTAR,
41 VMX_INDEX_MSR_SYSCALL_MASK,
42 VMX_INDEX_MSR_EFER,
44 VMX_MSR_COUNT,
45 };
47 struct vmx_msr_state {
48 unsigned long flags;
49 unsigned long msr_items[VMX_MSR_COUNT];
50 unsigned long shadow_gs;
51 };
53 struct arch_vmx_struct {
54 /* Virtual address of VMCS. */
55 struct vmcs_struct *vmcs;
57 /* Protects remote usage of VMCS (VMPTRLD/VMCLEAR). */
58 spinlock_t vmcs_lock;
60 /*
61 * Activation and launch status of this VMCS.
62 * - Activated on a CPU by VMPTRLD. Deactivated by VMCLEAR.
63 * - Launched on active CPU by VMLAUNCH when current VMCS.
64 */
65 int active_cpu;
66 int launched;
68 /* Cache of cpu execution control. */
69 u32 exec_control;
71 /* If there is vector installed in the INTR_INFO_FIELD. */
72 u32 vector_injected;
74 unsigned long cpu_cr0; /* copy of guest CR0 */
75 unsigned long cpu_shadow_cr0; /* copy of guest read shadow CR0 */
76 unsigned long cpu_shadow_cr4; /* copy of guest read shadow CR4 */
77 unsigned long cpu_cr2; /* save CR2 */
78 unsigned long cpu_cr3;
79 unsigned long cpu_based_exec_control;
80 struct vmx_msr_state msr_content;
81 unsigned long vmxassist_enabled:1;
82 };
84 #define vmx_schedule_tail(next) \
85 (next)->thread.arch_vmx.arch_vmx_schedule_tail((next))
87 void vmx_do_resume(struct vcpu *);
89 struct vmcs_struct *vmx_alloc_host_vmcs(void);
90 void vmx_free_host_vmcs(struct vmcs_struct *vmcs);
92 int vmx_create_vmcs(struct vcpu *v);
93 void vmx_destroy_vmcs(struct vcpu *v);
94 void vmx_vmcs_enter(struct vcpu *v);
95 void vmx_vmcs_exit(struct vcpu *v);
97 #define VMCS_USE_HOST_ENV 1
98 #define VMCS_USE_SEPARATE_ENV 0
100 extern int vmcs_version;
102 #define CPU_BASED_VIRTUAL_INTR_PENDING 0x00000004
103 #define CPU_BASED_USE_TSC_OFFSETING 0x00000008
104 #define CPU_BASED_HLT_EXITING 0x00000080
105 #define CPU_BASED_INVDPG_EXITING 0x00000200
106 #define CPU_BASED_MWAIT_EXITING 0x00000400
107 #define CPU_BASED_RDPMC_EXITING 0x00000800
108 #define CPU_BASED_RDTSC_EXITING 0x00001000
109 #define CPU_BASED_CR8_LOAD_EXITING 0x00080000
110 #define CPU_BASED_CR8_STORE_EXITING 0x00100000
111 #define CPU_BASED_TPR_SHADOW 0x00200000
112 #define CPU_BASED_MOV_DR_EXITING 0x00800000
113 #define CPU_BASED_UNCOND_IO_EXITING 0x01000000
114 #define CPU_BASED_ACTIVATE_IO_BITMAP 0x02000000
115 #define CPU_BASED_MONITOR_EXITING 0x20000000
116 #define CPU_BASED_PAUSE_EXITING 0x40000000
118 #define PIN_BASED_EXT_INTR_MASK 0x00000001
119 #define PIN_BASED_NMI_EXITING 0x00000008
121 #define VM_EXIT_IA32E_MODE 0x00000200
122 #define VM_EXIT_ACK_INTR_ON_EXIT 0x00008000
124 #define VM_ENTRY_IA32E_MODE 0x00000200
125 #define VM_ENTRY_SMM 0x00000400
126 #define VM_ENTRY_DEACT_DUAL_MONITOR 0x00000800
128 /* VMCS Encordings */
129 enum vmcs_field {
130 GUEST_ES_SELECTOR = 0x00000800,
131 GUEST_CS_SELECTOR = 0x00000802,
132 GUEST_SS_SELECTOR = 0x00000804,
133 GUEST_DS_SELECTOR = 0x00000806,
134 GUEST_FS_SELECTOR = 0x00000808,
135 GUEST_GS_SELECTOR = 0x0000080a,
136 GUEST_LDTR_SELECTOR = 0x0000080c,
137 GUEST_TR_SELECTOR = 0x0000080e,
138 HOST_ES_SELECTOR = 0x00000c00,
139 HOST_CS_SELECTOR = 0x00000c02,
140 HOST_SS_SELECTOR = 0x00000c04,
141 HOST_DS_SELECTOR = 0x00000c06,
142 HOST_FS_SELECTOR = 0x00000c08,
143 HOST_GS_SELECTOR = 0x00000c0a,
144 HOST_TR_SELECTOR = 0x00000c0c,
145 IO_BITMAP_A = 0x00002000,
146 IO_BITMAP_A_HIGH = 0x00002001,
147 IO_BITMAP_B = 0x00002002,
148 IO_BITMAP_B_HIGH = 0x00002003,
149 VM_EXIT_MSR_STORE_ADDR = 0x00002006,
150 VM_EXIT_MSR_STORE_ADDR_HIGH = 0x00002007,
151 VM_EXIT_MSR_LOAD_ADDR = 0x00002008,
152 VM_EXIT_MSR_LOAD_ADDR_HIGH = 0x00002009,
153 VM_ENTRY_MSR_LOAD_ADDR = 0x0000200a,
154 VM_ENTRY_MSR_LOAD_ADDR_HIGH = 0x0000200b,
155 TSC_OFFSET = 0x00002010,
156 TSC_OFFSET_HIGH = 0x00002011,
157 VIRTUAL_APIC_PAGE_ADDR = 0x00002012,
158 VIRTUAL_APIC_PAGE_ADDR_HIGH = 0x00002013,
159 VMCS_LINK_POINTER = 0x00002800,
160 VMCS_LINK_POINTER_HIGH = 0x00002801,
161 GUEST_IA32_DEBUGCTL = 0x00002802,
162 GUEST_IA32_DEBUGCTL_HIGH = 0x00002803,
163 PIN_BASED_VM_EXEC_CONTROL = 0x00004000,
164 CPU_BASED_VM_EXEC_CONTROL = 0x00004002,
165 EXCEPTION_BITMAP = 0x00004004,
166 PAGE_FAULT_ERROR_CODE_MASK = 0x00004006,
167 PAGE_FAULT_ERROR_CODE_MATCH = 0x00004008,
168 CR3_TARGET_COUNT = 0x0000400a,
169 VM_EXIT_CONTROLS = 0x0000400c,
170 VM_EXIT_MSR_STORE_COUNT = 0x0000400e,
171 VM_EXIT_MSR_LOAD_COUNT = 0x00004010,
172 VM_ENTRY_CONTROLS = 0x00004012,
173 VM_ENTRY_MSR_LOAD_COUNT = 0x00004014,
174 VM_ENTRY_INTR_INFO_FIELD = 0x00004016,
175 VM_ENTRY_EXCEPTION_ERROR_CODE = 0x00004018,
176 VM_ENTRY_INSTRUCTION_LEN = 0x0000401a,
177 TPR_THRESHOLD = 0x0000401c,
178 SECONDARY_VM_EXEC_CONTROL = 0x0000401e,
179 VM_INSTRUCTION_ERROR = 0x00004400,
180 VM_EXIT_REASON = 0x00004402,
181 VM_EXIT_INTR_INFO = 0x00004404,
182 VM_EXIT_INTR_ERROR_CODE = 0x00004406,
183 IDT_VECTORING_INFO_FIELD = 0x00004408,
184 IDT_VECTORING_ERROR_CODE = 0x0000440a,
185 VM_EXIT_INSTRUCTION_LEN = 0x0000440c,
186 VMX_INSTRUCTION_INFO = 0x0000440e,
187 GUEST_ES_LIMIT = 0x00004800,
188 GUEST_CS_LIMIT = 0x00004802,
189 GUEST_SS_LIMIT = 0x00004804,
190 GUEST_DS_LIMIT = 0x00004806,
191 GUEST_FS_LIMIT = 0x00004808,
192 GUEST_GS_LIMIT = 0x0000480a,
193 GUEST_LDTR_LIMIT = 0x0000480c,
194 GUEST_TR_LIMIT = 0x0000480e,
195 GUEST_GDTR_LIMIT = 0x00004810,
196 GUEST_IDTR_LIMIT = 0x00004812,
197 GUEST_ES_AR_BYTES = 0x00004814,
198 GUEST_CS_AR_BYTES = 0x00004816,
199 GUEST_SS_AR_BYTES = 0x00004818,
200 GUEST_DS_AR_BYTES = 0x0000481a,
201 GUEST_FS_AR_BYTES = 0x0000481c,
202 GUEST_GS_AR_BYTES = 0x0000481e,
203 GUEST_LDTR_AR_BYTES = 0x00004820,
204 GUEST_TR_AR_BYTES = 0x00004822,
205 GUEST_INTERRUPTIBILITY_INFO = 0x00004824,
206 GUEST_ACTIVITY_STATE = 0x00004826,
207 GUEST_SYSENTER_CS = 0x0000482A,
208 HOST_IA32_SYSENTER_CS = 0x00004c00,
209 CR0_GUEST_HOST_MASK = 0x00006000,
210 CR4_GUEST_HOST_MASK = 0x00006002,
211 CR0_READ_SHADOW = 0x00006004,
212 CR4_READ_SHADOW = 0x00006006,
213 CR3_TARGET_VALUE0 = 0x00006008,
214 CR3_TARGET_VALUE1 = 0x0000600a,
215 CR3_TARGET_VALUE2 = 0x0000600c,
216 CR3_TARGET_VALUE3 = 0x0000600e,
217 EXIT_QUALIFICATION = 0x00006400,
218 GUEST_LINEAR_ADDRESS = 0x0000640a,
219 GUEST_CR0 = 0x00006800,
220 GUEST_CR3 = 0x00006802,
221 GUEST_CR4 = 0x00006804,
222 GUEST_ES_BASE = 0x00006806,
223 GUEST_CS_BASE = 0x00006808,
224 GUEST_SS_BASE = 0x0000680a,
225 GUEST_DS_BASE = 0x0000680c,
226 GUEST_FS_BASE = 0x0000680e,
227 GUEST_GS_BASE = 0x00006810,
228 GUEST_LDTR_BASE = 0x00006812,
229 GUEST_TR_BASE = 0x00006814,
230 GUEST_GDTR_BASE = 0x00006816,
231 GUEST_IDTR_BASE = 0x00006818,
232 GUEST_DR7 = 0x0000681a,
233 GUEST_RSP = 0x0000681c,
234 GUEST_RIP = 0x0000681e,
235 GUEST_RFLAGS = 0x00006820,
236 GUEST_PENDING_DBG_EXCEPTIONS = 0x00006822,
237 GUEST_SYSENTER_ESP = 0x00006824,
238 GUEST_SYSENTER_EIP = 0x00006826,
239 HOST_CR0 = 0x00006c00,
240 HOST_CR3 = 0x00006c02,
241 HOST_CR4 = 0x00006c04,
242 HOST_FS_BASE = 0x00006c06,
243 HOST_GS_BASE = 0x00006c08,
244 HOST_TR_BASE = 0x00006c0a,
245 HOST_GDTR_BASE = 0x00006c0c,
246 HOST_IDTR_BASE = 0x00006c0e,
247 HOST_IA32_SYSENTER_ESP = 0x00006c10,
248 HOST_IA32_SYSENTER_EIP = 0x00006c12,
249 HOST_RSP = 0x00006c14,
250 HOST_RIP = 0x00006c16,
251 };
253 #endif /* ASM_X86_HVM_VMX_VMCS_H__ */
255 /*
256 * Local variables:
257 * mode: C
258 * c-set-style: "BSD"
259 * c-basic-offset: 4
260 * tab-width: 4
261 * indent-tabs-mode: nil
262 * End:
263 */