kvm_main.c (2ac5e38ea4203852d6e99edd3cf11f044b0a409f) | kvm_main.c (e5d83c74a5800c2a1fa3ba982c1c4b2b39ae6db2) |
---|---|
1/* 2 * Kernel-based Virtual Machine driver for Linux 3 * 4 * This module enables machines with Intel VT-x extensions to run virtual 5 * machines without emulation or binary translation. 6 * 7 * Copyright (C) 2006 Qumranet, Inc. 8 * Copyright 2010 Red Hat, Inc. and/or its affiliates. --- 2934 unchanged lines hidden (view full) --- 2943 case KVM_CAP_SIGNAL_MSI: 2944#endif 2945#ifdef CONFIG_HAVE_KVM_IRQFD 2946 case KVM_CAP_IRQFD: 2947 case KVM_CAP_IRQFD_RESAMPLE: 2948#endif 2949 case KVM_CAP_IOEVENTFD_ANY_LENGTH: 2950 case KVM_CAP_CHECK_EXTENSION_VM: | 1/* 2 * Kernel-based Virtual Machine driver for Linux 3 * 4 * This module enables machines with Intel VT-x extensions to run virtual 5 * machines without emulation or binary translation. 6 * 7 * Copyright (C) 2006 Qumranet, Inc. 8 * Copyright 2010 Red Hat, Inc. and/or its affiliates. --- 2934 unchanged lines hidden (view full) --- 2943 case KVM_CAP_SIGNAL_MSI: 2944#endif 2945#ifdef CONFIG_HAVE_KVM_IRQFD 2946 case KVM_CAP_IRQFD: 2947 case KVM_CAP_IRQFD_RESAMPLE: 2948#endif 2949 case KVM_CAP_IOEVENTFD_ANY_LENGTH: 2950 case KVM_CAP_CHECK_EXTENSION_VM: |
2951 case KVM_CAP_ENABLE_CAP_VM: |
|
2951 return 1; 2952#ifdef CONFIG_KVM_MMIO 2953 case KVM_CAP_COALESCED_MMIO: 2954 return KVM_COALESCED_MMIO_PAGE_OFFSET; 2955 case KVM_CAP_COALESCED_PIO: 2956 return 1; 2957#endif 2958#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING --- 7 unchanged lines hidden (view full) --- 2966 case KVM_CAP_MAX_VCPU_ID: 2967 return KVM_MAX_VCPU_ID; 2968 default: 2969 break; 2970 } 2971 return kvm_vm_ioctl_check_extension(kvm, arg); 2972} 2973 | 2952 return 1; 2953#ifdef CONFIG_KVM_MMIO 2954 case KVM_CAP_COALESCED_MMIO: 2955 return KVM_COALESCED_MMIO_PAGE_OFFSET; 2956 case KVM_CAP_COALESCED_PIO: 2957 return 1; 2958#endif 2959#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING --- 7 unchanged lines hidden (view full) --- 2967 case KVM_CAP_MAX_VCPU_ID: 2968 return KVM_MAX_VCPU_ID; 2969 default: 2970 break; 2971 } 2972 return kvm_vm_ioctl_check_extension(kvm, arg); 2973} 2974 |
2975int __attribute__((weak)) kvm_vm_ioctl_enable_cap(struct kvm *kvm, 2976 struct kvm_enable_cap *cap) 2977{ 2978 return -EINVAL; 2979} 2980 2981static int kvm_vm_ioctl_enable_cap_generic(struct kvm *kvm, 2982 struct kvm_enable_cap *cap) 2983{ 2984 switch (cap->cap) { 2985 default: 2986 return kvm_vm_ioctl_enable_cap(kvm, cap); 2987 } 2988} 2989 |
|
2974static long kvm_vm_ioctl(struct file *filp, 2975 unsigned int ioctl, unsigned long arg) 2976{ 2977 struct kvm *kvm = filp->private_data; 2978 void __user *argp = (void __user *)arg; 2979 int r; 2980 2981 if (kvm->mm != current->mm) 2982 return -EIO; 2983 switch (ioctl) { 2984 case KVM_CREATE_VCPU: 2985 r = kvm_vm_ioctl_create_vcpu(kvm, arg); 2986 break; | 2990static long kvm_vm_ioctl(struct file *filp, 2991 unsigned int ioctl, unsigned long arg) 2992{ 2993 struct kvm *kvm = filp->private_data; 2994 void __user *argp = (void __user *)arg; 2995 int r; 2996 2997 if (kvm->mm != current->mm) 2998 return -EIO; 2999 switch (ioctl) { 3000 case KVM_CREATE_VCPU: 3001 r = kvm_vm_ioctl_create_vcpu(kvm, arg); 3002 break; |
3003 case KVM_ENABLE_CAP: { 3004 struct kvm_enable_cap cap; 3005 3006 r = -EFAULT; 3007 if (copy_from_user(&cap, argp, sizeof(cap))) 3008 goto out; 3009 r = kvm_vm_ioctl_enable_cap_generic(kvm, &cap); 3010 break; 3011 } |
|
2987 case KVM_SET_USER_MEMORY_REGION: { 2988 struct kvm_userspace_memory_region kvm_userspace_mem; 2989 2990 r = -EFAULT; 2991 if (copy_from_user(&kvm_userspace_mem, argp, 2992 sizeof(kvm_userspace_mem))) 2993 goto out; 2994 --- 1123 unchanged lines hidden --- | 3012 case KVM_SET_USER_MEMORY_REGION: { 3013 struct kvm_userspace_memory_region kvm_userspace_mem; 3014 3015 r = -EFAULT; 3016 if (copy_from_user(&kvm_userspace_mem, argp, 3017 sizeof(kvm_userspace_mem))) 3018 goto out; 3019 --- 1123 unchanged lines hidden --- |