Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: remove vm mmap method

It was used in conjunction with KVM_SET_MEMORY_REGION ioctl which was
removed by b74a07beed0 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>

-32
-32
virt/kvm/kvm_main.c
··· 2528 2528 } 2529 2529 #endif 2530 2530 2531 - static 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 - 2552 - static const struct vm_operations_struct kvm_vm_vm_ops = { 2553 - .fault = kvm_vm_fault, 2554 - }; 2555 - 2556 - static 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 - 2562 2531 static struct file_operations kvm_vm_fops = { 2563 2532 .release = kvm_vm_release, 2564 2533 .unlocked_ioctl = kvm_vm_ioctl, 2565 2534 #ifdef CONFIG_COMPAT 2566 2535 .compat_ioctl = kvm_vm_compat_ioctl, 2567 2536 #endif 2568 - .mmap = kvm_vm_mmap, 2569 2537 .llseek = noop_llseek, 2570 2538 }; 2571 2539