diff options
-rw-r--r-- | drivers/kvm/kvm.h | 84 | ||||
-rw-r--r-- | drivers/kvm/x86.h | 84 |
2 files changed, 84 insertions, 84 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 41f6ee2134de..19014564ddbb 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -375,19 +375,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size, | |||
375 | struct module *module); | 375 | struct module *module); |
376 | void kvm_exit(void); | 376 | void kvm_exit(void); |
377 | 377 | ||
378 | int kvm_mmu_module_init(void); | ||
379 | void kvm_mmu_module_exit(void); | ||
380 | |||
381 | void kvm_mmu_destroy(struct kvm_vcpu *vcpu); | ||
382 | int kvm_mmu_create(struct kvm_vcpu *vcpu); | ||
383 | int kvm_mmu_setup(struct kvm_vcpu *vcpu); | ||
384 | void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte); | ||
385 | |||
386 | int kvm_mmu_reset_context(struct kvm_vcpu *vcpu); | ||
387 | void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot); | ||
388 | void kvm_mmu_zap_all(struct kvm *kvm); | ||
389 | void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages); | ||
390 | |||
391 | hpa_t gpa_to_hpa(struct kvm *kvm, gpa_t gpa); | 378 | hpa_t gpa_to_hpa(struct kvm *kvm, gpa_t gpa); |
392 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) | 379 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) |
393 | #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) | 380 | #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) |
@@ -421,83 +408,12 @@ struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn); | |||
421 | int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); | 408 | int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn); |
422 | void mark_page_dirty(struct kvm *kvm, gfn_t gfn); | 409 | void mark_page_dirty(struct kvm *kvm, gfn_t gfn); |
423 | 410 | ||
424 | enum emulation_result { | ||
425 | EMULATE_DONE, /* no further processing */ | ||
426 | EMULATE_DO_MMIO, /* kvm_run filled with mmio request */ | ||
427 | EMULATE_FAIL, /* can't emulate this instruction */ | ||
428 | }; | ||
429 | |||
430 | int emulate_instruction(struct kvm_vcpu *vcpu, struct kvm_run *run, | ||
431 | unsigned long cr2, u16 error_code, int no_decode); | ||
432 | void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context); | ||
433 | void realmode_lgdt(struct kvm_vcpu *vcpu, u16 size, unsigned long address); | ||
434 | void realmode_lidt(struct kvm_vcpu *vcpu, u16 size, unsigned long address); | ||
435 | void realmode_lmsw(struct kvm_vcpu *vcpu, unsigned long msw, | ||
436 | unsigned long *rflags); | ||
437 | |||
438 | unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr); | ||
439 | void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long value, | ||
440 | unsigned long *rflags); | ||
441 | int kvm_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *data); | ||
442 | int kvm_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data); | ||
443 | |||
444 | struct x86_emulate_ctxt; | ||
445 | |||
446 | int kvm_emulate_pio(struct kvm_vcpu *vcpu, struct kvm_run *run, int in, | ||
447 | int size, unsigned port); | ||
448 | int kvm_emulate_pio_string(struct kvm_vcpu *vcpu, struct kvm_run *run, int in, | ||
449 | int size, unsigned long count, int down, | ||
450 | gva_t address, int rep, unsigned port); | ||
451 | void kvm_emulate_cpuid(struct kvm_vcpu *vcpu); | ||
452 | int kvm_emulate_halt(struct kvm_vcpu *vcpu); | ||
453 | int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address); | ||
454 | int emulate_clts(struct kvm_vcpu *vcpu); | ||
455 | int emulator_get_dr(struct x86_emulate_ctxt *ctxt, int dr, | ||
456 | unsigned long *dest); | ||
457 | int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr, | ||
458 | unsigned long value); | ||
459 | |||
460 | void set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0); | ||
461 | void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr0); | ||
462 | void set_cr4(struct kvm_vcpu *vcpu, unsigned long cr0); | ||
463 | void set_cr8(struct kvm_vcpu *vcpu, unsigned long cr0); | ||
464 | unsigned long get_cr8(struct kvm_vcpu *vcpu); | ||
465 | void lmsw(struct kvm_vcpu *vcpu, unsigned long msw); | ||
466 | void kvm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l); | ||
467 | |||
468 | int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata); | ||
469 | int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data); | ||
470 | |||
471 | void fx_init(struct kvm_vcpu *vcpu); | ||
472 | |||
473 | void kvm_vcpu_block(struct kvm_vcpu *vcpu); | 411 | void kvm_vcpu_block(struct kvm_vcpu *vcpu); |
474 | void kvm_resched(struct kvm_vcpu *vcpu); | 412 | void kvm_resched(struct kvm_vcpu *vcpu); |
475 | void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); | 413 | void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); |
476 | void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); | 414 | void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); |
477 | void kvm_flush_remote_tlbs(struct kvm *kvm); | 415 | void kvm_flush_remote_tlbs(struct kvm *kvm); |
478 | 416 | ||
479 | int emulator_read_std(unsigned long addr, | ||
480 | void *val, | ||
481 | unsigned int bytes, | ||
482 | struct kvm_vcpu *vcpu); | ||
483 | int emulator_write_emulated(unsigned long addr, | ||
484 | const void *val, | ||
485 | unsigned int bytes, | ||
486 | struct kvm_vcpu *vcpu); | ||
487 | |||
488 | unsigned long segment_base(u16 selector); | ||
489 | |||
490 | void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, | ||
491 | const u8 *new, int bytes); | ||
492 | int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva); | ||
493 | void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu); | ||
494 | int kvm_mmu_load(struct kvm_vcpu *vcpu); | ||
495 | void kvm_mmu_unload(struct kvm_vcpu *vcpu); | ||
496 | |||
497 | int kvm_emulate_hypercall(struct kvm_vcpu *vcpu); | ||
498 | |||
499 | int kvm_fix_hypercall(struct kvm_vcpu *vcpu); | ||
500 | |||
501 | long kvm_arch_dev_ioctl(struct file *filp, | 417 | long kvm_arch_dev_ioctl(struct file *filp, |
502 | unsigned int ioctl, unsigned long arg); | 418 | unsigned int ioctl, unsigned long arg); |
503 | long kvm_arch_vcpu_ioctl(struct file *filp, | 419 | long kvm_arch_vcpu_ioctl(struct file *filp, |
diff --git a/drivers/kvm/x86.h b/drivers/kvm/x86.h index f1c43cafb0ca..90b791bf6287 100644 --- a/drivers/kvm/x86.h +++ b/drivers/kvm/x86.h | |||
@@ -225,6 +225,90 @@ struct kvm_x86_ops { | |||
225 | 225 | ||
226 | extern struct kvm_x86_ops *kvm_x86_ops; | 226 | extern struct kvm_x86_ops *kvm_x86_ops; |
227 | 227 | ||
228 | int kvm_mmu_module_init(void); | ||
229 | void kvm_mmu_module_exit(void); | ||
230 | |||
231 | void kvm_mmu_destroy(struct kvm_vcpu *vcpu); | ||
232 | int kvm_mmu_create(struct kvm_vcpu *vcpu); | ||
233 | int kvm_mmu_setup(struct kvm_vcpu *vcpu); | ||
234 | void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte); | ||
235 | |||
236 | int kvm_mmu_reset_context(struct kvm_vcpu *vcpu); | ||
237 | void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot); | ||
238 | void kvm_mmu_zap_all(struct kvm *kvm); | ||
239 | void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages); | ||
240 | |||
241 | enum emulation_result { | ||
242 | EMULATE_DONE, /* no further processing */ | ||
243 | EMULATE_DO_MMIO, /* kvm_run filled with mmio request */ | ||
244 | EMULATE_FAIL, /* can't emulate this instruction */ | ||
245 | }; | ||
246 | |||
247 | int emulate_instruction(struct kvm_vcpu *vcpu, struct kvm_run *run, | ||
248 | unsigned long cr2, u16 error_code, int no_decode); | ||
249 | void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context); | ||
250 | void realmode_lgdt(struct kvm_vcpu *vcpu, u16 size, unsigned long address); | ||
251 | void realmode_lidt(struct kvm_vcpu *vcpu, u16 size, unsigned long address); | ||
252 | void realmode_lmsw(struct kvm_vcpu *vcpu, unsigned long msw, | ||
253 | unsigned long *rflags); | ||
254 | |||
255 | unsigned long realmode_get_cr(struct kvm_vcpu *vcpu, int cr); | ||
256 | void realmode_set_cr(struct kvm_vcpu *vcpu, int cr, unsigned long value, | ||
257 | unsigned long *rflags); | ||
258 | int kvm_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *data); | ||
259 | int kvm_set_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data); | ||
260 | |||
261 | struct x86_emulate_ctxt; | ||
262 | |||
263 | int kvm_emulate_pio(struct kvm_vcpu *vcpu, struct kvm_run *run, int in, | ||
264 | int size, unsigned port); | ||
265 | int kvm_emulate_pio_string(struct kvm_vcpu *vcpu, struct kvm_run *run, int in, | ||
266 | int size, unsigned long count, int down, | ||
267 | gva_t address, int rep, unsigned port); | ||
268 | void kvm_emulate_cpuid(struct kvm_vcpu *vcpu); | ||
269 | int kvm_emulate_halt(struct kvm_vcpu *vcpu); | ||
270 | int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address); | ||
271 | int emulate_clts(struct kvm_vcpu *vcpu); | ||
272 | int emulator_get_dr(struct x86_emulate_ctxt *ctxt, int dr, | ||
273 | unsigned long *dest); | ||
274 | int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr, | ||
275 | unsigned long value); | ||
276 | |||
277 | void set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0); | ||
278 | void set_cr3(struct kvm_vcpu *vcpu, unsigned long cr0); | ||
279 | void set_cr4(struct kvm_vcpu *vcpu, unsigned long cr0); | ||
280 | void set_cr8(struct kvm_vcpu *vcpu, unsigned long cr0); | ||
281 | unsigned long get_cr8(struct kvm_vcpu *vcpu); | ||
282 | void lmsw(struct kvm_vcpu *vcpu, unsigned long msw); | ||
283 | void kvm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l); | ||
284 | |||
285 | int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata); | ||
286 | int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data); | ||
287 | |||
288 | void fx_init(struct kvm_vcpu *vcpu); | ||
289 | |||
290 | int emulator_read_std(unsigned long addr, | ||
291 | void *val, | ||
292 | unsigned int bytes, | ||
293 | struct kvm_vcpu *vcpu); | ||
294 | int emulator_write_emulated(unsigned long addr, | ||
295 | const void *val, | ||
296 | unsigned int bytes, | ||
297 | struct kvm_vcpu *vcpu); | ||
298 | |||
299 | unsigned long segment_base(u16 selector); | ||
300 | |||
301 | void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, | ||
302 | const u8 *new, int bytes); | ||
303 | int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva); | ||
304 | void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu); | ||
305 | int kvm_mmu_load(struct kvm_vcpu *vcpu); | ||
306 | void kvm_mmu_unload(struct kvm_vcpu *vcpu); | ||
307 | |||
308 | int kvm_emulate_hypercall(struct kvm_vcpu *vcpu); | ||
309 | |||
310 | int kvm_fix_hypercall(struct kvm_vcpu *vcpu); | ||
311 | |||
228 | int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code); | 312 | int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t gva, u32 error_code); |
229 | 313 | ||
230 | static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) | 314 | static inline void kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) |