diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/kvm/kvm.h | 3 | ||||
-rw-r--r-- | drivers/kvm/kvm_main.c | 18 | ||||
-rw-r--r-- | drivers/kvm/x86.c | 20 |
3 files changed, 25 insertions, 16 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 96d9c7da14c2..a7be0733bc48 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h | |||
@@ -628,6 +628,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
628 | unsigned int ioctl, unsigned long arg); | 628 | unsigned int ioctl, unsigned long arg); |
629 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu); | 629 | void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu); |
630 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu); | 630 | void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu); |
631 | |||
632 | int kvm_dev_ioctl_check_extension(long ext); | ||
633 | |||
631 | int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, | 634 | int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, |
632 | struct | 635 | struct |
633 | kvm_userspace_memory_region *mem, | 636 | kvm_userspace_memory_region *mem, |
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index e0f20d020281..c782f27265de 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -1198,23 +1198,9 @@ static long kvm_dev_ioctl(struct file *filp, | |||
1198 | goto out; | 1198 | goto out; |
1199 | r = kvm_dev_ioctl_create_vm(); | 1199 | r = kvm_dev_ioctl_create_vm(); |
1200 | break; | 1200 | break; |
1201 | case KVM_CHECK_EXTENSION: { | 1201 | case KVM_CHECK_EXTENSION: |
1202 | int ext = (long)argp; | 1202 | r = kvm_dev_ioctl_check_extension((long)argp); |
1203 | |||
1204 | switch (ext) { | ||
1205 | case KVM_CAP_IRQCHIP: | ||
1206 | case KVM_CAP_HLT: | ||
1207 | case KVM_CAP_MMU_SHADOW_CACHE_CONTROL: | ||
1208 | case KVM_CAP_USER_MEMORY: | ||
1209 | case KVM_CAP_SET_TSS_ADDR: | ||
1210 | r = 1; | ||
1211 | break; | ||
1212 | default: | ||
1213 | r = 0; | ||
1214 | break; | ||
1215 | } | ||
1216 | break; | 1203 | break; |
1217 | } | ||
1218 | case KVM_GET_VCPU_MMAP_SIZE: | 1204 | case KVM_GET_VCPU_MMAP_SIZE: |
1219 | r = -EINVAL; | 1205 | r = -EINVAL; |
1220 | if (arg) | 1206 | if (arg) |
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c index bbfa810bf8bd..609792637fb4 100644 --- a/drivers/kvm/x86.c +++ b/drivers/kvm/x86.c | |||
@@ -599,6 +599,26 @@ void decache_vcpus_on_cpu(int cpu) | |||
599 | spin_unlock(&kvm_lock); | 599 | spin_unlock(&kvm_lock); |
600 | } | 600 | } |
601 | 601 | ||
602 | int kvm_dev_ioctl_check_extension(long ext) | ||
603 | { | ||
604 | int r; | ||
605 | |||
606 | switch (ext) { | ||
607 | case KVM_CAP_IRQCHIP: | ||
608 | case KVM_CAP_HLT: | ||
609 | case KVM_CAP_MMU_SHADOW_CACHE_CONTROL: | ||
610 | case KVM_CAP_USER_MEMORY: | ||
611 | case KVM_CAP_SET_TSS_ADDR: | ||
612 | r = 1; | ||
613 | break; | ||
614 | default: | ||
615 | r = 0; | ||
616 | break; | ||
617 | } | ||
618 | return r; | ||
619 | |||
620 | } | ||
621 | |||
602 | long kvm_arch_dev_ioctl(struct file *filp, | 622 | long kvm_arch_dev_ioctl(struct file *filp, |
603 | unsigned int ioctl, unsigned long arg) | 623 | unsigned int ioctl, unsigned long arg) |
604 | { | 624 | { |