aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/kvm_main.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 7a317a7f9025..10015d6e4d08 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2528,44 +2528,12 @@ out:
2528} 2528}
2529#endif 2529#endif
2530 2530
2531static int kvm_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
2532{
2533 struct page *page[1];
2534 unsigned long addr;
2535 int npages;
2536 gfn_t gfn = vmf->pgoff;
2537 struct kvm *kvm = vma->vm_file->private_data;
2538
2539 addr = gfn_to_hva(kvm, gfn);
2540 if (kvm_is_error_hva(addr))
2541 return VM_FAULT_SIGBUS;
2542
2543 npages = get_user_pages(current, current->mm, addr, 1, 1, 0, page,
2544 NULL);
2545 if (unlikely(npages != 1))
2546 return VM_FAULT_SIGBUS;
2547
2548 vmf->page = page[0];
2549 return 0;
2550}
2551
2552static const struct vm_operations_struct kvm_vm_vm_ops = {
2553 .fault = kvm_vm_fault,
2554};
2555
2556static int kvm_vm_mmap(struct file *file, struct vm_area_struct *vma)
2557{
2558 vma->vm_ops = &kvm_vm_vm_ops;
2559 return 0;
2560}
2561
2562static struct file_operations kvm_vm_fops = { 2531static struct file_operations kvm_vm_fops = {
2563 .release = kvm_vm_release, 2532 .release = kvm_vm_release,
2564 .unlocked_ioctl = kvm_vm_ioctl, 2533 .unlocked_ioctl = kvm_vm_ioctl,
2565#ifdef CONFIG_COMPAT 2534#ifdef CONFIG_COMPAT
2566 .compat_ioctl = kvm_vm_compat_ioctl, 2535 .compat_ioctl = kvm_vm_compat_ioctl,
2567#endif 2536#endif
2568 .mmap = kvm_vm_mmap,
2569 .llseek = noop_llseek, 2537 .llseek = noop_llseek,
2570}; 2538};
2571 2539