diff options
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r-- | virt/kvm/kvm_main.c | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index e28f3caa539d..1b95cc926cfc 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -2324,6 +2324,34 @@ static int kvm_ioctl_create_device(struct kvm *kvm, | |||
2324 | return 0; | 2324 | return 0; |
2325 | } | 2325 | } |
2326 | 2326 | ||
2327 | static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) | ||
2328 | { | ||
2329 | switch (arg) { | ||
2330 | case KVM_CAP_USER_MEMORY: | ||
2331 | case KVM_CAP_DESTROY_MEMORY_REGION_WORKS: | ||
2332 | case KVM_CAP_JOIN_MEMORY_REGIONS_WORKS: | ||
2333 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE | ||
2334 | case KVM_CAP_SET_BOOT_CPU_ID: | ||
2335 | #endif | ||
2336 | case KVM_CAP_INTERNAL_ERROR_DATA: | ||
2337 | #ifdef CONFIG_HAVE_KVM_MSI | ||
2338 | case KVM_CAP_SIGNAL_MSI: | ||
2339 | #endif | ||
2340 | #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING | ||
2341 | case KVM_CAP_IRQFD_RESAMPLE: | ||
2342 | #endif | ||
2343 | case KVM_CAP_CHECK_EXTENSION_VM: | ||
2344 | return 1; | ||
2345 | #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING | ||
2346 | case KVM_CAP_IRQ_ROUTING: | ||
2347 | return KVM_MAX_IRQ_ROUTES; | ||
2348 | #endif | ||
2349 | default: | ||
2350 | break; | ||
2351 | } | ||
2352 | return kvm_vm_ioctl_check_extension(kvm, arg); | ||
2353 | } | ||
2354 | |||
2327 | static long kvm_vm_ioctl(struct file *filp, | 2355 | static long kvm_vm_ioctl(struct file *filp, |
2328 | unsigned int ioctl, unsigned long arg) | 2356 | unsigned int ioctl, unsigned long arg) |
2329 | { | 2357 | { |
@@ -2487,6 +2515,9 @@ static long kvm_vm_ioctl(struct file *filp, | |||
2487 | r = 0; | 2515 | r = 0; |
2488 | break; | 2516 | break; |
2489 | } | 2517 | } |
2518 | case KVM_CHECK_EXTENSION: | ||
2519 | r = kvm_vm_ioctl_check_extension_generic(kvm, arg); | ||
2520 | break; | ||
2490 | default: | 2521 | default: |
2491 | r = kvm_arch_vm_ioctl(filp, ioctl, arg); | 2522 | r = kvm_arch_vm_ioctl(filp, ioctl, arg); |
2492 | if (r == -ENOTTY) | 2523 | if (r == -ENOTTY) |
@@ -2571,33 +2602,6 @@ static int kvm_dev_ioctl_create_vm(unsigned long type) | |||
2571 | return r; | 2602 | return r; |
2572 | } | 2603 | } |
2573 | 2604 | ||
2574 | static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg) | ||
2575 | { | ||
2576 | switch (arg) { | ||
2577 | case KVM_CAP_USER_MEMORY: | ||
2578 | case KVM_CAP_DESTROY_MEMORY_REGION_WORKS: | ||
2579 | case KVM_CAP_JOIN_MEMORY_REGIONS_WORKS: | ||
2580 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE | ||
2581 | case KVM_CAP_SET_BOOT_CPU_ID: | ||
2582 | #endif | ||
2583 | case KVM_CAP_INTERNAL_ERROR_DATA: | ||
2584 | #ifdef CONFIG_HAVE_KVM_MSI | ||
2585 | case KVM_CAP_SIGNAL_MSI: | ||
2586 | #endif | ||
2587 | #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING | ||
2588 | case KVM_CAP_IRQFD_RESAMPLE: | ||
2589 | #endif | ||
2590 | return 1; | ||
2591 | #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING | ||
2592 | case KVM_CAP_IRQ_ROUTING: | ||
2593 | return KVM_MAX_IRQ_ROUTES; | ||
2594 | #endif | ||
2595 | default: | ||
2596 | break; | ||
2597 | } | ||
2598 | return kvm_vm_ioctl_check_extension(kvm, arg); | ||
2599 | } | ||
2600 | |||
2601 | static long kvm_dev_ioctl(struct file *filp, | 2605 | static long kvm_dev_ioctl(struct file *filp, |
2602 | unsigned int ioctl, unsigned long arg) | 2606 | unsigned int ioctl, unsigned long arg) |
2603 | { | 2607 | { |