aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/kvm/kvm_main.c')
-rw-r--r--drivers/kvm/kvm_main.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index c782f27265de..3946025f3d37 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -761,28 +761,6 @@ void kvm_resched(struct kvm_vcpu *vcpu)
761} 761}
762EXPORT_SYMBOL_GPL(kvm_resched); 762EXPORT_SYMBOL_GPL(kvm_resched);
763 763
764/*
765 * Translate a guest virtual address to a guest physical address.
766 */
767static int kvm_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
768 struct kvm_translation *tr)
769{
770 unsigned long vaddr = tr->linear_address;
771 gpa_t gpa;
772
773 vcpu_load(vcpu);
774 mutex_lock(&vcpu->kvm->lock);
775 gpa = vcpu->mmu.gva_to_gpa(vcpu, vaddr);
776 tr->physical_address = gpa;
777 tr->valid = gpa != UNMAPPED_GVA;
778 tr->writeable = 1;
779 tr->usermode = 0;
780 mutex_unlock(&vcpu->kvm->lock);
781 vcpu_put(vcpu);
782
783 return 0;
784}
785
786static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, 764static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
787 struct kvm_interrupt *irq) 765 struct kvm_interrupt *irq)
788{ 766{
@@ -986,7 +964,7 @@ static long kvm_vcpu_ioctl(struct file *filp,
986 r = -EFAULT; 964 r = -EFAULT;
987 if (copy_from_user(&tr, argp, sizeof tr)) 965 if (copy_from_user(&tr, argp, sizeof tr))
988 goto out; 966 goto out;
989 r = kvm_vcpu_ioctl_translate(vcpu, &tr); 967 r = kvm_arch_vcpu_ioctl_translate(vcpu, &tr);
990 if (r) 968 if (r)
991 goto out; 969 goto out;
992 r = -EFAULT; 970 r = -EFAULT;