aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/kvm_host.h3
-rw-r--r--arch/x86/kvm/x86.c23
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);
657void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr); 657void kvm_requeue_exception(struct kvm_vcpu *vcpu, unsigned nr);
658void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code); 658void kvm_requeue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code);
659void kvm_inject_page_fault(struct kvm_vcpu *vcpu); 659void kvm_inject_page_fault(struct kvm_vcpu *vcpu);
660int 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);
660bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl); 663bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl);
661 664
662int kvm_pic_set_irq(void *opaque, int irq, int level); 665int 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)
370EXPORT_SYMBOL_GPL(kvm_require_cpl); 370EXPORT_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 */
377int 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}
393EXPORT_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 */
375int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3) 398int load_pdptrs(struct kvm_vcpu *vcpu, unsigned long cr3)