diff options
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/bitops.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/calling.h | 52 | ||||
-rw-r--r-- | arch/x86/include/asm/entry_arch.h | 19 | ||||
-rw-r--r-- | arch/x86/include/asm/irq.h | 12 | ||||
-rw-r--r-- | arch/x86/include/asm/kvm_emulate.h | 30 | ||||
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 81 | ||||
-rw-r--r-- | arch/x86/include/asm/kvm_para.h | 6 | ||||
-rw-r--r-- | arch/x86/include/asm/module.h | 7 | ||||
-rw-r--r-- | arch/x86/include/asm/msr-index.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/olpc.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/page_32_types.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/percpu.h | 14 | ||||
-rw-r--r-- | arch/x86/include/asm/pgtable_32.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/pvclock.h | 38 | ||||
-rw-r--r-- | arch/x86/include/asm/segment.h | 32 | ||||
-rw-r--r-- | arch/x86/include/asm/tlbflush.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/trampoline.h | 3 |
17 files changed, 206 insertions, 101 deletions
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h index bafd80defa43..903683b07e42 100644 --- a/arch/x86/include/asm/bitops.h +++ b/arch/x86/include/asm/bitops.h | |||
@@ -440,6 +440,8 @@ static inline int fls(int x) | |||
440 | 440 | ||
441 | #ifdef __KERNEL__ | 441 | #ifdef __KERNEL__ |
442 | 442 | ||
443 | #include <asm-generic/bitops/find.h> | ||
444 | |||
443 | #include <asm-generic/bitops/sched.h> | 445 | #include <asm-generic/bitops/sched.h> |
444 | 446 | ||
445 | #define ARCH_HAS_FAST_MULTIPLIER 1 | 447 | #define ARCH_HAS_FAST_MULTIPLIER 1 |
diff --git a/arch/x86/include/asm/calling.h b/arch/x86/include/asm/calling.h index 0e63c9a2a8d0..30af5a832163 100644 --- a/arch/x86/include/asm/calling.h +++ b/arch/x86/include/asm/calling.h | |||
@@ -48,36 +48,38 @@ For 32-bit we have the following conventions - kernel is built with | |||
48 | 48 | ||
49 | 49 | ||
50 | /* | 50 | /* |
51 | * 64-bit system call stack frame layout defines and helpers, | 51 | * 64-bit system call stack frame layout defines and helpers, for |
52 | * for assembly code: | 52 | * assembly code (note that the seemingly unnecessary parentheses |
53 | * are to prevent cpp from inserting spaces in expressions that get | ||
54 | * passed to macros): | ||
53 | */ | 55 | */ |
54 | 56 | ||
55 | #define R15 0 | 57 | #define R15 (0) |
56 | #define R14 8 | 58 | #define R14 (8) |
57 | #define R13 16 | 59 | #define R13 (16) |
58 | #define R12 24 | 60 | #define R12 (24) |
59 | #define RBP 32 | 61 | #define RBP (32) |
60 | #define RBX 40 | 62 | #define RBX (40) |
61 | 63 | ||
62 | /* arguments: interrupts/non tracing syscalls only save up to here: */ | 64 | /* arguments: interrupts/non tracing syscalls only save up to here: */ |
63 | #define R11 48 | 65 | #define R11 (48) |
64 | #define R10 56 | 66 | #define R10 (56) |
65 | #define R9 64 | 67 | #define R9 (64) |
66 | #define R8 72 | 68 | #define R8 (72) |
67 | #define RAX 80 | 69 | #define RAX (80) |
68 | #define RCX 88 | 70 | #define RCX (88) |
69 | #define RDX 96 | 71 | #define RDX (96) |
70 | #define RSI 104 | 72 | #define RSI (104) |
71 | #define RDI 112 | 73 | #define RDI (112) |
72 | #define ORIG_RAX 120 /* + error_code */ | 74 | #define ORIG_RAX (120) /* + error_code */ |
73 | /* end of arguments */ | 75 | /* end of arguments */ |
74 | 76 | ||
75 | /* cpu exception frame or undefined in case of fast syscall: */ | 77 | /* cpu exception frame or undefined in case of fast syscall: */ |
76 | #define RIP 128 | 78 | #define RIP (128) |
77 | #define CS 136 | 79 | #define CS (136) |
78 | #define EFLAGS 144 | 80 | #define EFLAGS (144) |
79 | #define RSP 152 | 81 | #define RSP (152) |
80 | #define SS 160 | 82 | #define SS (160) |
81 | 83 | ||
82 | #define ARGOFFSET R11 | 84 | #define ARGOFFSET R11 |
83 | #define SWFRAME ORIG_RAX | 85 | #define SWFRAME ORIG_RAX |
@@ -111,7 +113,7 @@ For 32-bit we have the following conventions - kernel is built with | |||
111 | .endif | 113 | .endif |
112 | .endm | 114 | .endm |
113 | 115 | ||
114 | #define ARG_SKIP 9*8 | 116 | #define ARG_SKIP (9*8) |
115 | 117 | ||
116 | .macro RESTORE_ARGS skiprax=0, addskip=0, skiprcx=0, skipr11=0, \ | 118 | .macro RESTORE_ARGS skiprax=0, addskip=0, skiprcx=0, skipr11=0, \ |
117 | skipr8910=0, skiprdx=0 | 119 | skipr8910=0, skiprdx=0 |
@@ -169,7 +171,7 @@ For 32-bit we have the following conventions - kernel is built with | |||
169 | .endif | 171 | .endif |
170 | .endm | 172 | .endm |
171 | 173 | ||
172 | #define REST_SKIP 6*8 | 174 | #define REST_SKIP (6*8) |
173 | 175 | ||
174 | .macro SAVE_REST | 176 | .macro SAVE_REST |
175 | subq $REST_SKIP, %rsp | 177 | subq $REST_SKIP, %rsp |
diff --git a/arch/x86/include/asm/entry_arch.h b/arch/x86/include/asm/entry_arch.h index b8e96a18676b..57650ab4a5f5 100644 --- a/arch/x86/include/asm/entry_arch.h +++ b/arch/x86/include/asm/entry_arch.h | |||
@@ -16,22 +16,11 @@ BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR) | |||
16 | BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR) | 16 | BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR) |
17 | BUILD_INTERRUPT(reboot_interrupt,REBOOT_VECTOR) | 17 | BUILD_INTERRUPT(reboot_interrupt,REBOOT_VECTOR) |
18 | 18 | ||
19 | BUILD_INTERRUPT3(invalidate_interrupt0,INVALIDATE_TLB_VECTOR_START+0, | 19 | .irpc idx, "01234567" |
20 | smp_invalidate_interrupt) | 20 | BUILD_INTERRUPT3(invalidate_interrupt\idx, |
21 | BUILD_INTERRUPT3(invalidate_interrupt1,INVALIDATE_TLB_VECTOR_START+1, | 21 | (INVALIDATE_TLB_VECTOR_START)+\idx, |
22 | smp_invalidate_interrupt) | ||
23 | BUILD_INTERRUPT3(invalidate_interrupt2,INVALIDATE_TLB_VECTOR_START+2, | ||
24 | smp_invalidate_interrupt) | ||
25 | BUILD_INTERRUPT3(invalidate_interrupt3,INVALIDATE_TLB_VECTOR_START+3, | ||
26 | smp_invalidate_interrupt) | ||
27 | BUILD_INTERRUPT3(invalidate_interrupt4,INVALIDATE_TLB_VECTOR_START+4, | ||
28 | smp_invalidate_interrupt) | ||
29 | BUILD_INTERRUPT3(invalidate_interrupt5,INVALIDATE_TLB_VECTOR_START+5, | ||
30 | smp_invalidate_interrupt) | ||
31 | BUILD_INTERRUPT3(invalidate_interrupt6,INVALIDATE_TLB_VECTOR_START+6, | ||
32 | smp_invalidate_interrupt) | ||
33 | BUILD_INTERRUPT3(invalidate_interrupt7,INVALIDATE_TLB_VECTOR_START+7, | ||
34 | smp_invalidate_interrupt) | 22 | smp_invalidate_interrupt) |
23 | .endr | ||
35 | #endif | 24 | #endif |
36 | 25 | ||
37 | BUILD_INTERRUPT(x86_platform_ipi, X86_PLATFORM_IPI_VECTOR) | 26 | BUILD_INTERRUPT(x86_platform_ipi, X86_PLATFORM_IPI_VECTOR) |
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h index 5458380b6ef8..0bf5b0083650 100644 --- a/arch/x86/include/asm/irq.h +++ b/arch/x86/include/asm/irq.h | |||
@@ -19,18 +19,16 @@ static inline int irq_canonicalize(int irq) | |||
19 | # define ARCH_HAS_NMI_WATCHDOG | 19 | # define ARCH_HAS_NMI_WATCHDOG |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #ifdef CONFIG_4KSTACKS | 22 | #ifdef CONFIG_X86_32 |
23 | extern void irq_ctx_init(int cpu); | 23 | extern void irq_ctx_init(int cpu); |
24 | extern void irq_ctx_exit(int cpu); | 24 | extern void irq_ctx_exit(int cpu); |
25 | # define __ARCH_HAS_DO_SOFTIRQ | ||
26 | #else | 25 | #else |
27 | # define irq_ctx_init(cpu) do { } while (0) | 26 | # define irq_ctx_init(cpu) do { } while (0) |
28 | # define irq_ctx_exit(cpu) do { } while (0) | 27 | # define irq_ctx_exit(cpu) do { } while (0) |
29 | # ifdef CONFIG_X86_64 | ||
30 | # define __ARCH_HAS_DO_SOFTIRQ | ||
31 | # endif | ||
32 | #endif | 28 | #endif |
33 | 29 | ||
30 | #define __ARCH_HAS_DO_SOFTIRQ | ||
31 | |||
34 | #ifdef CONFIG_HOTPLUG_CPU | 32 | #ifdef CONFIG_HOTPLUG_CPU |
35 | #include <linux/cpumask.h> | 33 | #include <linux/cpumask.h> |
36 | extern void fixup_irqs(void); | 34 | extern void fixup_irqs(void); |
diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h index 1f99ecfc48e1..b36c6b3fe144 100644 --- a/arch/x86/include/asm/kvm_emulate.h +++ b/arch/x86/include/asm/kvm_emulate.h | |||
@@ -139,6 +139,7 @@ struct x86_emulate_ops { | |||
139 | void (*set_segment_selector)(u16 sel, int seg, struct kvm_vcpu *vcpu); | 139 | void (*set_segment_selector)(u16 sel, int seg, struct kvm_vcpu *vcpu); |
140 | unsigned long (*get_cached_segment_base)(int seg, struct kvm_vcpu *vcpu); | 140 | unsigned long (*get_cached_segment_base)(int seg, struct kvm_vcpu *vcpu); |
141 | void (*get_gdt)(struct desc_ptr *dt, struct kvm_vcpu *vcpu); | 141 | void (*get_gdt)(struct desc_ptr *dt, struct kvm_vcpu *vcpu); |
142 | void (*get_idt)(struct desc_ptr *dt, struct kvm_vcpu *vcpu); | ||
142 | ulong (*get_cr)(int cr, struct kvm_vcpu *vcpu); | 143 | ulong (*get_cr)(int cr, struct kvm_vcpu *vcpu); |
143 | int (*set_cr)(int cr, ulong val, struct kvm_vcpu *vcpu); | 144 | int (*set_cr)(int cr, ulong val, struct kvm_vcpu *vcpu); |
144 | int (*cpl)(struct kvm_vcpu *vcpu); | 145 | int (*cpl)(struct kvm_vcpu *vcpu); |
@@ -156,7 +157,10 @@ struct operand { | |||
156 | unsigned long orig_val; | 157 | unsigned long orig_val; |
157 | u64 orig_val64; | 158 | u64 orig_val64; |
158 | }; | 159 | }; |
159 | unsigned long *ptr; | 160 | union { |
161 | unsigned long *reg; | ||
162 | unsigned long mem; | ||
163 | } addr; | ||
160 | union { | 164 | union { |
161 | unsigned long val; | 165 | unsigned long val; |
162 | u64 val64; | 166 | u64 val64; |
@@ -190,6 +194,7 @@ struct decode_cache { | |||
190 | bool has_seg_override; | 194 | bool has_seg_override; |
191 | u8 seg_override; | 195 | u8 seg_override; |
192 | unsigned int d; | 196 | unsigned int d; |
197 | int (*execute)(struct x86_emulate_ctxt *ctxt); | ||
193 | unsigned long regs[NR_VCPU_REGS]; | 198 | unsigned long regs[NR_VCPU_REGS]; |
194 | unsigned long eip; | 199 | unsigned long eip; |
195 | /* modrm */ | 200 | /* modrm */ |
@@ -197,17 +202,16 @@ struct decode_cache { | |||
197 | u8 modrm_mod; | 202 | u8 modrm_mod; |
198 | u8 modrm_reg; | 203 | u8 modrm_reg; |
199 | u8 modrm_rm; | 204 | u8 modrm_rm; |
200 | u8 use_modrm_ea; | 205 | u8 modrm_seg; |
201 | bool rip_relative; | 206 | bool rip_relative; |
202 | unsigned long modrm_ea; | ||
203 | void *modrm_ptr; | ||
204 | unsigned long modrm_val; | ||
205 | struct fetch_cache fetch; | 207 | struct fetch_cache fetch; |
206 | struct read_cache io_read; | 208 | struct read_cache io_read; |
207 | struct read_cache mem_read; | 209 | struct read_cache mem_read; |
208 | }; | 210 | }; |
209 | 211 | ||
210 | struct x86_emulate_ctxt { | 212 | struct x86_emulate_ctxt { |
213 | struct x86_emulate_ops *ops; | ||
214 | |||
211 | /* Register state before/after emulation. */ | 215 | /* Register state before/after emulation. */ |
212 | struct kvm_vcpu *vcpu; | 216 | struct kvm_vcpu *vcpu; |
213 | 217 | ||
@@ -220,12 +224,11 @@ struct x86_emulate_ctxt { | |||
220 | /* interruptibility state, as a result of execution of STI or MOV SS */ | 224 | /* interruptibility state, as a result of execution of STI or MOV SS */ |
221 | int interruptibility; | 225 | int interruptibility; |
222 | 226 | ||
223 | bool restart; /* restart string instruction after writeback */ | 227 | bool perm_ok; /* do not check permissions if true */ |
224 | 228 | ||
225 | int exception; /* exception that happens during emulation or -1 */ | 229 | int exception; /* exception that happens during emulation or -1 */ |
226 | u32 error_code; /* error code for exception */ | 230 | u32 error_code; /* error code for exception */ |
227 | bool error_code_valid; | 231 | bool error_code_valid; |
228 | unsigned long cr2; /* faulted address in case of #PF */ | ||
229 | 232 | ||
230 | /* decode cache */ | 233 | /* decode cache */ |
231 | struct decode_cache decode; | 234 | struct decode_cache decode; |
@@ -249,13 +252,14 @@ struct x86_emulate_ctxt { | |||
249 | #define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64 | 252 | #define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64 |
250 | #endif | 253 | #endif |
251 | 254 | ||
252 | int x86_decode_insn(struct x86_emulate_ctxt *ctxt, | 255 | int x86_decode_insn(struct x86_emulate_ctxt *ctxt); |
253 | struct x86_emulate_ops *ops); | 256 | #define EMULATION_FAILED -1 |
254 | int x86_emulate_insn(struct x86_emulate_ctxt *ctxt, | 257 | #define EMULATION_OK 0 |
255 | struct x86_emulate_ops *ops); | 258 | #define EMULATION_RESTART 1 |
259 | int x86_emulate_insn(struct x86_emulate_ctxt *ctxt); | ||
256 | int emulator_task_switch(struct x86_emulate_ctxt *ctxt, | 260 | int emulator_task_switch(struct x86_emulate_ctxt *ctxt, |
257 | struct x86_emulate_ops *ops, | ||
258 | u16 tss_selector, int reason, | 261 | u16 tss_selector, int reason, |
259 | bool has_error_code, u32 error_code); | 262 | bool has_error_code, u32 error_code); |
260 | 263 | int emulate_int_real(struct x86_emulate_ctxt *ctxt, | |
264 | struct x86_emulate_ops *ops, int irq); | ||
261 | #endif /* _ASM_X86_KVM_X86_EMULATE_H */ | 265 | #endif /* _ASM_X86_KVM_X86_EMULATE_H */ |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index c52e2eb40a1e..9e6fe391094e 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -236,10 +236,14 @@ struct kvm_pio_request { | |||
236 | */ | 236 | */ |
237 | struct kvm_mmu { | 237 | struct kvm_mmu { |
238 | void (*new_cr3)(struct kvm_vcpu *vcpu); | 238 | void (*new_cr3)(struct kvm_vcpu *vcpu); |
239 | void (*set_cr3)(struct kvm_vcpu *vcpu, unsigned long root); | ||
240 | unsigned long (*get_cr3)(struct kvm_vcpu *vcpu); | ||
239 | int (*page_fault)(struct kvm_vcpu *vcpu, gva_t gva, u32 err); | 241 | int (*page_fault)(struct kvm_vcpu *vcpu, gva_t gva, u32 err); |
242 | void (*inject_page_fault)(struct kvm_vcpu *vcpu); | ||
240 | void (*free)(struct kvm_vcpu *vcpu); | 243 | void (*free)(struct kvm_vcpu *vcpu); |
241 | gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access, | 244 | gpa_t (*gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t gva, u32 access, |
242 | u32 *error); | 245 | u32 *error); |
246 | gpa_t (*translate_gpa)(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access); | ||
243 | void (*prefetch_page)(struct kvm_vcpu *vcpu, | 247 | void (*prefetch_page)(struct kvm_vcpu *vcpu, |
244 | struct kvm_mmu_page *page); | 248 | struct kvm_mmu_page *page); |
245 | int (*sync_page)(struct kvm_vcpu *vcpu, | 249 | int (*sync_page)(struct kvm_vcpu *vcpu, |
@@ -249,13 +253,18 @@ struct kvm_mmu { | |||
249 | int root_level; | 253 | int root_level; |
250 | int shadow_root_level; | 254 | int shadow_root_level; |
251 | union kvm_mmu_page_role base_role; | 255 | union kvm_mmu_page_role base_role; |
256 | bool direct_map; | ||
252 | 257 | ||
253 | u64 *pae_root; | 258 | u64 *pae_root; |
259 | u64 *lm_root; | ||
254 | u64 rsvd_bits_mask[2][4]; | 260 | u64 rsvd_bits_mask[2][4]; |
261 | |||
262 | bool nx; | ||
263 | |||
264 | u64 pdptrs[4]; /* pae */ | ||
255 | }; | 265 | }; |
256 | 266 | ||
257 | struct kvm_vcpu_arch { | 267 | struct kvm_vcpu_arch { |
258 | u64 host_tsc; | ||
259 | /* | 268 | /* |
260 | * rip and regs accesses must go through | 269 | * rip and regs accesses must go through |
261 | * kvm_{register,rip}_{read,write} functions. | 270 | * kvm_{register,rip}_{read,write} functions. |
@@ -272,7 +281,6 @@ struct kvm_vcpu_arch { | |||
272 | unsigned long cr4_guest_owned_bits; | 281 | unsigned long cr4_guest_owned_bits; |
273 | unsigned long cr8; | 282 | unsigned long cr8; |
274 | u32 hflags; | 283 | u32 hflags; |
275 | u64 pdptrs[4]; /* pae */ | ||
276 | u64 efer; | 284 | u64 efer; |
277 | u64 apic_base; | 285 | u64 apic_base; |
278 | struct kvm_lapic *apic; /* kernel irqchip context */ | 286 | struct kvm_lapic *apic; /* kernel irqchip context */ |
@@ -282,7 +290,41 @@ struct kvm_vcpu_arch { | |||
282 | u64 ia32_misc_enable_msr; | 290 | u64 ia32_misc_enable_msr; |
283 | bool tpr_access_reporting; | 291 | bool tpr_access_reporting; |
284 | 292 | ||
293 | /* | ||
294 | * Paging state of the vcpu | ||
295 | * | ||
296 | * If the vcpu runs in guest mode with two level paging this still saves | ||
297 | * the paging mode of the l1 guest. This context is always used to | ||
298 | * handle faults. | ||
299 | */ | ||
285 | struct kvm_mmu mmu; | 300 | struct kvm_mmu mmu; |
301 | |||
302 | /* | ||
303 | * Paging state of an L2 guest (used for nested npt) | ||
304 | * | ||
305 | * This context will save all necessary information to walk page tables | ||
306 | * of the an L2 guest. This context is only initialized for page table | ||
307 | * walking and not for faulting since we never handle l2 page faults on | ||
308 | * the host. | ||
309 | */ | ||
310 | struct kvm_mmu nested_mmu; | ||
311 | |||
312 | /* | ||
313 | * Pointer to the mmu context currently used for | ||
314 | * gva_to_gpa translations. | ||
315 | */ | ||
316 | struct kvm_mmu *walk_mmu; | ||
317 | |||
318 | /* | ||
319 | * This struct is filled with the necessary information to propagate a | ||
320 | * page fault into the guest | ||
321 | */ | ||
322 | struct { | ||
323 | u64 address; | ||
324 | unsigned error_code; | ||
325 | bool nested; | ||
326 | } fault; | ||
327 | |||
286 | /* only needed in kvm_pv_mmu_op() path, but it's hot so | 328 | /* only needed in kvm_pv_mmu_op() path, but it's hot so |
287 | * put it here to avoid allocation */ | 329 | * put it here to avoid allocation */ |
288 | struct kvm_pv_mmu_op_buffer mmu_op_buffer; | 330 | struct kvm_pv_mmu_op_buffer mmu_op_buffer; |
@@ -336,9 +378,15 @@ struct kvm_vcpu_arch { | |||
336 | 378 | ||
337 | gpa_t time; | 379 | gpa_t time; |
338 | struct pvclock_vcpu_time_info hv_clock; | 380 | struct pvclock_vcpu_time_info hv_clock; |
339 | unsigned int hv_clock_tsc_khz; | 381 | unsigned int hw_tsc_khz; |
340 | unsigned int time_offset; | 382 | unsigned int time_offset; |
341 | struct page *time_page; | 383 | struct page *time_page; |
384 | u64 last_host_tsc; | ||
385 | u64 last_guest_tsc; | ||
386 | u64 last_kernel_ns; | ||
387 | u64 last_tsc_nsec; | ||
388 | u64 last_tsc_write; | ||
389 | bool tsc_catchup; | ||
342 | 390 | ||
343 | bool nmi_pending; | 391 | bool nmi_pending; |
344 | bool nmi_injected; | 392 | bool nmi_injected; |
@@ -367,9 +415,9 @@ struct kvm_vcpu_arch { | |||
367 | }; | 415 | }; |
368 | 416 | ||
369 | struct kvm_arch { | 417 | struct kvm_arch { |
370 | unsigned int n_free_mmu_pages; | 418 | unsigned int n_used_mmu_pages; |
371 | unsigned int n_requested_mmu_pages; | 419 | unsigned int n_requested_mmu_pages; |
372 | unsigned int n_alloc_mmu_pages; | 420 | unsigned int n_max_mmu_pages; |
373 | atomic_t invlpg_counter; | 421 | atomic_t invlpg_counter; |
374 | struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES]; | 422 | struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES]; |
375 | /* | 423 | /* |
@@ -394,8 +442,14 @@ struct kvm_arch { | |||
394 | gpa_t ept_identity_map_addr; | 442 | gpa_t ept_identity_map_addr; |
395 | 443 | ||
396 | unsigned long irq_sources_bitmap; | 444 | unsigned long irq_sources_bitmap; |
397 | u64 vm_init_tsc; | ||
398 | s64 kvmclock_offset; | 445 | s64 kvmclock_offset; |
446 | spinlock_t tsc_write_lock; | ||
447 | u64 last_tsc_nsec; | ||
448 | u64 last_tsc_offset; | ||
449 | u64 last_tsc_write; | ||
450 | u32 virtual_tsc_khz; | ||
451 | u32 virtual_tsc_mult; | ||
452 | s8 virtual_tsc_shift; | ||
399 | 453 | ||
400 | struct kvm_xen_hvm_config xen_hvm_config; | 454 | struct kvm_xen_hvm_config xen_hvm_config; |
401 | 455 | ||
@@ -505,6 +559,7 @@ struct kvm_x86_ops { | |||
505 | void (*queue_exception)(struct kvm_vcpu *vcpu, unsigned nr, | 559 | void (*queue_exception)(struct kvm_vcpu *vcpu, unsigned nr, |
506 | bool has_error_code, u32 error_code, | 560 | bool has_error_code, u32 error_code, |
507 | bool reinject); | 561 | bool reinject); |
562 | void (*cancel_injection)(struct kvm_vcpu *vcpu); | ||
508 | int (*interrupt_allowed)(struct kvm_vcpu *vcpu); | 563 | int (*interrupt_allowed)(struct kvm_vcpu *vcpu); |
509 | int (*nmi_allowed)(struct kvm_vcpu *vcpu); | 564 | int (*nmi_allowed)(struct kvm_vcpu *vcpu); |
510 | bool (*get_nmi_mask)(struct kvm_vcpu *vcpu); | 565 | bool (*get_nmi_mask)(struct kvm_vcpu *vcpu); |
@@ -517,11 +572,16 @@ struct kvm_x86_ops { | |||
517 | u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio); | 572 | u64 (*get_mt_mask)(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio); |
518 | int (*get_lpage_level)(void); | 573 | int (*get_lpage_level)(void); |
519 | bool (*rdtscp_supported)(void); | 574 | bool (*rdtscp_supported)(void); |
575 | void (*adjust_tsc_offset)(struct kvm_vcpu *vcpu, s64 adjustment); | ||
576 | |||
577 | void (*set_tdp_cr3)(struct kvm_vcpu *vcpu, unsigned long cr3); | ||
520 | 578 | ||
521 | void (*set_supported_cpuid)(u32 func, struct kvm_cpuid_entry2 *entry); | 579 | void (*set_supported_cpuid)(u32 func, struct kvm_cpuid_entry2 *entry); |
522 | 580 | ||
523 | bool (*has_wbinvd_exit)(void); | 581 | bool (*has_wbinvd_exit)(void); |
524 | 582 | ||
583 | void (*write_tsc_offset)(struct kvm_vcpu *vcpu, u64 offset); | ||
584 | |||
525 | const struct trace_print_flags *exit_reasons_str; | 585 | const struct trace_print_flags *exit_reasons_str; |
526 | }; | 586 | }; |
527 | 587 | ||
@@ -544,7 +604,7 @@ void kvm_mmu_zap_all(struct kvm *kvm); | |||
544 | unsigned int kvm_mmu_calculate_mmu_pages(struct kvm *kvm); | 604 | unsigned int kvm_mmu_calculate_mmu_pages(struct kvm *kvm); |
545 | void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages); | 605 | void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages); |
546 | 606 | ||
547 | int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3); | 607 | int load_pdptrs(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, unsigned long cr3); |
548 | 608 | ||
549 | int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, | 609 | int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, |
550 | const void *val, int bytes); | 610 | const void *val, int bytes); |
@@ -608,8 +668,11 @@ void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr); | |||
608 | void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); | 668 | void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); |
609 | void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr); | 669 | void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr); |
610 | void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); | 670 | void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); |
611 | void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2, | 671 | void kvm_inject_page_fault(struct kvm_vcpu *vcpu); |
612 | u32 error_code); | 672 | int kvm_read_guest_page_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, |
673 | gfn_t gfn, void *data, int offset, int len, | ||
674 | u32 access); | ||
675 | void kvm_propagate_fault(struct kvm_vcpu *vcpu); | ||
613 | bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl); | 676 | bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl); |
614 | 677 | ||
615 | int kvm_pic_set_irq(void *opaque, int irq, int level); | 678 | int kvm_pic_set_irq(void *opaque, int irq, int level); |
diff --git a/arch/x86/include/asm/kvm_para.h b/arch/x86/include/asm/kvm_para.h index 05eba5e9a8e8..7b562b6184bc 100644 --- a/arch/x86/include/asm/kvm_para.h +++ b/arch/x86/include/asm/kvm_para.h | |||
@@ -158,6 +158,12 @@ static inline unsigned int kvm_arch_para_features(void) | |||
158 | return cpuid_eax(KVM_CPUID_FEATURES); | 158 | return cpuid_eax(KVM_CPUID_FEATURES); |
159 | } | 159 | } |
160 | 160 | ||
161 | #ifdef CONFIG_KVM_GUEST | ||
162 | void __init kvm_guest_init(void); | ||
163 | #else | ||
164 | #define kvm_guest_init() do { } while (0) | ||
161 | #endif | 165 | #endif |
162 | 166 | ||
167 | #endif /* __KERNEL__ */ | ||
168 | |||
163 | #endif /* _ASM_X86_KVM_PARA_H */ | 169 | #endif /* _ASM_X86_KVM_PARA_H */ |
diff --git a/arch/x86/include/asm/module.h b/arch/x86/include/asm/module.h index 3e2ce58a31a3..67763c5d8b4e 100644 --- a/arch/x86/include/asm/module.h +++ b/arch/x86/include/asm/module.h | |||
@@ -60,12 +60,7 @@ | |||
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | #ifdef CONFIG_X86_32 | 62 | #ifdef CONFIG_X86_32 |
63 | # ifdef CONFIG_4KSTACKS | 63 | # define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY |
64 | # define MODULE_STACKSIZE "4KSTACKS " | ||
65 | # else | ||
66 | # define MODULE_STACKSIZE "" | ||
67 | # endif | ||
68 | # define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE | ||
69 | #endif | 64 | #endif |
70 | 65 | ||
71 | #endif /* _ASM_X86_MODULE_H */ | 66 | #endif /* _ASM_X86_MODULE_H */ |
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 986f7790fdb2..83c4bb1d917d 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h | |||
@@ -198,6 +198,7 @@ | |||
198 | #define MSR_IA32_TSC 0x00000010 | 198 | #define MSR_IA32_TSC 0x00000010 |
199 | #define MSR_IA32_PLATFORM_ID 0x00000017 | 199 | #define MSR_IA32_PLATFORM_ID 0x00000017 |
200 | #define MSR_IA32_EBL_CR_POWERON 0x0000002a | 200 | #define MSR_IA32_EBL_CR_POWERON 0x0000002a |
201 | #define MSR_EBC_FREQUENCY_ID 0x0000002c | ||
201 | #define MSR_IA32_FEATURE_CONTROL 0x0000003a | 202 | #define MSR_IA32_FEATURE_CONTROL 0x0000003a |
202 | 203 | ||
203 | #define FEATURE_CONTROL_LOCKED (1<<0) | 204 | #define FEATURE_CONTROL_LOCKED (1<<0) |
diff --git a/arch/x86/include/asm/olpc.h b/arch/x86/include/asm/olpc.h index 101229b0d8ed..42a978c0c1b3 100644 --- a/arch/x86/include/asm/olpc.h +++ b/arch/x86/include/asm/olpc.h | |||
@@ -89,6 +89,8 @@ extern int olpc_ec_mask_unset(uint8_t bits); | |||
89 | /* EC commands */ | 89 | /* EC commands */ |
90 | 90 | ||
91 | #define EC_FIRMWARE_REV 0x08 | 91 | #define EC_FIRMWARE_REV 0x08 |
92 | #define EC_WLAN_ENTER_RESET 0x35 | ||
93 | #define EC_WLAN_LEAVE_RESET 0x25 | ||
92 | 94 | ||
93 | /* SCI source values */ | 95 | /* SCI source values */ |
94 | 96 | ||
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h index 6f1b7331313f..ade619ff9e2a 100644 --- a/arch/x86/include/asm/page_32_types.h +++ b/arch/x86/include/asm/page_32_types.h | |||
@@ -15,11 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) | 16 | #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) |
17 | 17 | ||
18 | #ifdef CONFIG_4KSTACKS | ||
19 | #define THREAD_ORDER 0 | ||
20 | #else | ||
21 | #define THREAD_ORDER 1 | 18 | #define THREAD_ORDER 1 |
22 | #endif | ||
23 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) | 19 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) |
24 | 20 | ||
25 | #define STACKFAULT_STACK 0 | 21 | #define STACKFAULT_STACK 0 |
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index cd28f9ad910d..f899e01a8ac9 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h | |||
@@ -47,6 +47,20 @@ | |||
47 | #ifdef CONFIG_SMP | 47 | #ifdef CONFIG_SMP |
48 | #define __percpu_arg(x) "%%"__stringify(__percpu_seg)":%P" #x | 48 | #define __percpu_arg(x) "%%"__stringify(__percpu_seg)":%P" #x |
49 | #define __my_cpu_offset percpu_read(this_cpu_off) | 49 | #define __my_cpu_offset percpu_read(this_cpu_off) |
50 | |||
51 | /* | ||
52 | * Compared to the generic __my_cpu_offset version, the following | ||
53 | * saves one instruction and avoids clobbering a temp register. | ||
54 | */ | ||
55 | #define __this_cpu_ptr(ptr) \ | ||
56 | ({ \ | ||
57 | unsigned long tcp_ptr__; \ | ||
58 | __verify_pcpu_ptr(ptr); \ | ||
59 | asm volatile("add " __percpu_arg(1) ", %0" \ | ||
60 | : "=r" (tcp_ptr__) \ | ||
61 | : "m" (this_cpu_off), "0" (ptr)); \ | ||
62 | (typeof(*(ptr)) __kernel __force *)tcp_ptr__; \ | ||
63 | }) | ||
50 | #else | 64 | #else |
51 | #define __percpu_arg(x) "%P" #x | 65 | #define __percpu_arg(x) "%P" #x |
52 | #endif | 66 | #endif |
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h index f686f49e8b7b..8abde9ec90bf 100644 --- a/arch/x86/include/asm/pgtable_32.h +++ b/arch/x86/include/asm/pgtable_32.h | |||
@@ -26,7 +26,7 @@ struct mm_struct; | |||
26 | struct vm_area_struct; | 26 | struct vm_area_struct; |
27 | 27 | ||
28 | extern pgd_t swapper_pg_dir[1024]; | 28 | extern pgd_t swapper_pg_dir[1024]; |
29 | extern pgd_t trampoline_pg_dir[1024]; | 29 | extern pgd_t initial_page_table[1024]; |
30 | 30 | ||
31 | static inline void pgtable_cache_init(void) { } | 31 | static inline void pgtable_cache_init(void) { } |
32 | static inline void check_pgt_cache(void) { } | 32 | static inline void check_pgt_cache(void) { } |
diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h index cd02f324aa6b..7f7e577a0e39 100644 --- a/arch/x86/include/asm/pvclock.h +++ b/arch/x86/include/asm/pvclock.h | |||
@@ -12,4 +12,42 @@ void pvclock_read_wallclock(struct pvclock_wall_clock *wall, | |||
12 | struct pvclock_vcpu_time_info *vcpu, | 12 | struct pvclock_vcpu_time_info *vcpu, |
13 | struct timespec *ts); | 13 | struct timespec *ts); |
14 | 14 | ||
15 | /* | ||
16 | * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction, | ||
17 | * yielding a 64-bit result. | ||
18 | */ | ||
19 | static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift) | ||
20 | { | ||
21 | u64 product; | ||
22 | #ifdef __i386__ | ||
23 | u32 tmp1, tmp2; | ||
24 | #endif | ||
25 | |||
26 | if (shift < 0) | ||
27 | delta >>= -shift; | ||
28 | else | ||
29 | delta <<= shift; | ||
30 | |||
31 | #ifdef __i386__ | ||
32 | __asm__ ( | ||
33 | "mul %5 ; " | ||
34 | "mov %4,%%eax ; " | ||
35 | "mov %%edx,%4 ; " | ||
36 | "mul %5 ; " | ||
37 | "xor %5,%5 ; " | ||
38 | "add %4,%%eax ; " | ||
39 | "adc %5,%%edx ; " | ||
40 | : "=A" (product), "=r" (tmp1), "=r" (tmp2) | ||
41 | : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) ); | ||
42 | #elif defined(__x86_64__) | ||
43 | __asm__ ( | ||
44 | "mul %%rdx ; shrd $32,%%rdx,%%rax" | ||
45 | : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) ); | ||
46 | #else | ||
47 | #error implement me! | ||
48 | #endif | ||
49 | |||
50 | return product; | ||
51 | } | ||
52 | |||
15 | #endif /* _ASM_X86_PVCLOCK_H */ | 53 | #endif /* _ASM_X86_PVCLOCK_H */ |
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h index 14e0ed86a6f9..231f1c1d6607 100644 --- a/arch/x86/include/asm/segment.h +++ b/arch/x86/include/asm/segment.h | |||
@@ -73,31 +73,31 @@ | |||
73 | 73 | ||
74 | #define GDT_ENTRY_DEFAULT_USER_DS 15 | 74 | #define GDT_ENTRY_DEFAULT_USER_DS 15 |
75 | 75 | ||
76 | #define GDT_ENTRY_KERNEL_BASE 12 | 76 | #define GDT_ENTRY_KERNEL_BASE (12) |
77 | 77 | ||
78 | #define GDT_ENTRY_KERNEL_CS (GDT_ENTRY_KERNEL_BASE + 0) | 78 | #define GDT_ENTRY_KERNEL_CS (GDT_ENTRY_KERNEL_BASE+0) |
79 | 79 | ||
80 | #define GDT_ENTRY_KERNEL_DS (GDT_ENTRY_KERNEL_BASE + 1) | 80 | #define GDT_ENTRY_KERNEL_DS (GDT_ENTRY_KERNEL_BASE+1) |
81 | 81 | ||
82 | #define GDT_ENTRY_TSS (GDT_ENTRY_KERNEL_BASE + 4) | 82 | #define GDT_ENTRY_TSS (GDT_ENTRY_KERNEL_BASE+4) |
83 | #define GDT_ENTRY_LDT (GDT_ENTRY_KERNEL_BASE + 5) | 83 | #define GDT_ENTRY_LDT (GDT_ENTRY_KERNEL_BASE+5) |
84 | 84 | ||
85 | #define GDT_ENTRY_PNPBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 6) | 85 | #define GDT_ENTRY_PNPBIOS_BASE (GDT_ENTRY_KERNEL_BASE+6) |
86 | #define GDT_ENTRY_APMBIOS_BASE (GDT_ENTRY_KERNEL_BASE + 11) | 86 | #define GDT_ENTRY_APMBIOS_BASE (GDT_ENTRY_KERNEL_BASE+11) |
87 | 87 | ||
88 | #define GDT_ENTRY_ESPFIX_SS (GDT_ENTRY_KERNEL_BASE + 14) | 88 | #define GDT_ENTRY_ESPFIX_SS (GDT_ENTRY_KERNEL_BASE+14) |
89 | #define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS * 8) | 89 | #define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS*8) |
90 | 90 | ||
91 | #define GDT_ENTRY_PERCPU (GDT_ENTRY_KERNEL_BASE + 15) | 91 | #define GDT_ENTRY_PERCPU (GDT_ENTRY_KERNEL_BASE+15) |
92 | #ifdef CONFIG_SMP | 92 | #ifdef CONFIG_SMP |
93 | #define __KERNEL_PERCPU (GDT_ENTRY_PERCPU * 8) | 93 | #define __KERNEL_PERCPU (GDT_ENTRY_PERCPU * 8) |
94 | #else | 94 | #else |
95 | #define __KERNEL_PERCPU 0 | 95 | #define __KERNEL_PERCPU 0 |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | #define GDT_ENTRY_STACK_CANARY (GDT_ENTRY_KERNEL_BASE + 16) | 98 | #define GDT_ENTRY_STACK_CANARY (GDT_ENTRY_KERNEL_BASE+16) |
99 | #ifdef CONFIG_CC_STACKPROTECTOR | 99 | #ifdef CONFIG_CC_STACKPROTECTOR |
100 | #define __KERNEL_STACK_CANARY (GDT_ENTRY_STACK_CANARY * 8) | 100 | #define __KERNEL_STACK_CANARY (GDT_ENTRY_STACK_CANARY*8) |
101 | #else | 101 | #else |
102 | #define __KERNEL_STACK_CANARY 0 | 102 | #define __KERNEL_STACK_CANARY 0 |
103 | #endif | 103 | #endif |
@@ -182,10 +182,10 @@ | |||
182 | 182 | ||
183 | #endif | 183 | #endif |
184 | 184 | ||
185 | #define __KERNEL_CS (GDT_ENTRY_KERNEL_CS * 8) | 185 | #define __KERNEL_CS (GDT_ENTRY_KERNEL_CS*8) |
186 | #define __KERNEL_DS (GDT_ENTRY_KERNEL_DS * 8) | 186 | #define __KERNEL_DS (GDT_ENTRY_KERNEL_DS*8) |
187 | #define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS* 8 + 3) | 187 | #define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS*8+3) |
188 | #define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS* 8 + 3) | 188 | #define __USER_CS (GDT_ENTRY_DEFAULT_USER_CS*8+3) |
189 | #ifndef CONFIG_PARAVIRT | 189 | #ifndef CONFIG_PARAVIRT |
190 | #define get_kernel_rpl() 0 | 190 | #define get_kernel_rpl() 0 |
191 | #endif | 191 | #endif |
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 7f3eba08e7de..169be8938b96 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h | |||
@@ -172,6 +172,4 @@ static inline void flush_tlb_kernel_range(unsigned long start, | |||
172 | flush_tlb_all(); | 172 | flush_tlb_all(); |
173 | } | 173 | } |
174 | 174 | ||
175 | extern void zap_low_mappings(bool early); | ||
176 | |||
177 | #endif /* _ASM_X86_TLBFLUSH_H */ | 175 | #endif /* _ASM_X86_TLBFLUSH_H */ |
diff --git a/arch/x86/include/asm/trampoline.h b/arch/x86/include/asm/trampoline.h index 4dde797c0578..f4500fb3b485 100644 --- a/arch/x86/include/asm/trampoline.h +++ b/arch/x86/include/asm/trampoline.h | |||
@@ -13,16 +13,13 @@ extern unsigned char *trampoline_base; | |||
13 | 13 | ||
14 | extern unsigned long init_rsp; | 14 | extern unsigned long init_rsp; |
15 | extern unsigned long initial_code; | 15 | extern unsigned long initial_code; |
16 | extern unsigned long initial_page_table; | ||
17 | extern unsigned long initial_gs; | 16 | extern unsigned long initial_gs; |
18 | 17 | ||
19 | #define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) | 18 | #define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) |
20 | 19 | ||
21 | extern unsigned long setup_trampoline(void); | 20 | extern unsigned long setup_trampoline(void); |
22 | extern void __init setup_trampoline_page_table(void); | ||
23 | extern void __init reserve_trampoline_memory(void); | 21 | extern void __init reserve_trampoline_memory(void); |
24 | #else | 22 | #else |
25 | static inline void setup_trampoline_page_table(void) {} | ||
26 | static inline void reserve_trampoline_memory(void) {} | 23 | static inline void reserve_trampoline_memory(void) {} |
27 | #endif /* CONFIG_X86_TRAMPOLINE */ | 24 | #endif /* CONFIG_X86_TRAMPOLINE */ |
28 | 25 | ||