aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm_main.c
diff options
context:
space:
mode:
authorZhang Xiantao <xiantao.zhang@intel.com>2007-11-16 00:05:55 -0500
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:53:03 -0500
commit8b0067913d9d0439d4cf3c1f7314ba71fc7b2958 (patch)
treea8de1898124085d7f4157ee6812413f65900af37 /drivers/kvm/kvm_main.c
parente08aa78ae5747c6e1dc525e8a40f23c2ea61d757 (diff)
KVM: Portability: Make kvm_vcpu_ioctl_translate arch dependent
Move kvm_vcpu_ioctl_translate to arch, since mmu would be put under arch. Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
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;