diff options
-rw-r--r-- | arch/x86/include/asm/kvm_host.h | 3 | ||||
-rw-r--r-- | arch/x86/kvm/x86.c | 23 |
2 files changed, 26 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 8ec3547c433d..08bc383083ff 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -657,6 +657,9 @@ void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); | |||
657 | void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr); | 657 | void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr); |
658 | void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); | 658 | void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); |
659 | void kvm_inject_page_fault(struct kvm_vcpu *vcpu); | 659 | void kvm_inject_page_fault(struct kvm_vcpu *vcpu); |
660 | int kvm_read_guest_page_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, | ||
661 | gfn_t gfn, void *data, int offset, int len, | ||
662 | u32 access); | ||
660 | bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl); | 663 | bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl); |
661 | 664 | ||
662 | int kvm_pic_set_irq(void *opaque, int irq, int level); | 665 | int kvm_pic_set_irq(void *opaque, int irq, int level); |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 4196fc719142..a2efb70f4cc8 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -370,6 +370,29 @@ bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl) | |||
370 | EXPORT_SYMBOL_GPL(kvm_require_cpl); | 370 | EXPORT_SYMBOL_GPL(kvm_require_cpl); |
371 | 371 | ||
372 | /* | 372 | /* |
373 | * This function will be used to read from the physical memory of the currently | ||
374 | * running guest. The difference to kvm_read_guest_page is that this function | ||
375 | * can read from guest physical or from the guest's guest physical memory. | ||
376 | */ | ||
377 | int kvm_read_guest_page_mmu(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, | ||
378 | gfn_t ngfn, void *data, int offset, int len, | ||
379 | u32 access) | ||
380 | { | ||
381 | gfn_t real_gfn; | ||
382 | gpa_t ngpa; | ||
383 | |||
384 | ngpa = gfn_to_gpa(ngfn); | ||
385 | real_gfn = mmu->translate_gpa(vcpu, ngpa, access); | ||
386 | if (real_gfn == UNMAPPED_GVA) | ||
387 | return -EFAULT; | ||
388 | |||
389 | real_gfn = gpa_to_gfn(real_gfn); | ||
390 | |||
391 | return kvm_read_guest_page(vcpu->kvm, real_gfn, data, offset, len); | ||
392 | } | ||
393 | EXPORT_SYMBOL_GPL(kvm_read_guest_page_mmu); | ||
394 | |||
395 | /* | ||
373 | * Load the pae pdptrs. Return true is they are all valid. | 396 | * Load the pae pdptrs. Return true is they are all valid. |
374 | */ | 397 | */ |
375 | int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3) | 398 | int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3) |