Skip to content

Commit

Permalink
KVM: remove vm mmap method
Browse files Browse the repository at this point in the history
It was used in conjunction with KVM_SET_MEMORY_REGION ioctl which was
removed by b74a07b in 2010, QEMU stopped using it in 2008, so
it is time to remove the code finally.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
  • Loading branch information
Gleb Natapov committed Nov 6, 2013
1 parent 27ef63c commit 80f5b5e
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2528,44 +2528,12 @@ static long kvm_vm_compat_ioctl(struct file *filp,
}
#endif

static int kvm_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
struct page *page[1];
unsigned long addr;
int npages;
gfn_t gfn = vmf->pgoff;
struct kvm *kvm = vma->vm_file->private_data;

addr = gfn_to_hva(kvm, gfn);
if (kvm_is_error_hva(addr))
return VM_FAULT_SIGBUS;

npages = get_user_pages(current, current->mm, addr, 1, 1, 0, page,
NULL);
if (unlikely(npages != 1))
return VM_FAULT_SIGBUS;

vmf->page = page[0];
return 0;
}

static const struct vm_operations_struct kvm_vm_vm_ops = {
.fault = kvm_vm_fault,
};

static int kvm_vm_mmap(struct file *file, struct vm_area_struct *vma)
{
vma->vm_ops = &kvm_vm_vm_ops;
return 0;
}

static struct file_operations kvm_vm_fops = {
.release = kvm_vm_release,
.unlocked_ioctl = kvm_vm_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = kvm_vm_compat_ioctl,
#endif
.mmap = kvm_vm_mmap,
.llseek = noop_llseek,
};

Expand Down

0 comments on commit 80f5b5e

Please sign in to comment.