diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kvm.h | 11 | ||||
-rw-r--r-- | include/linux/kvm_host.h | 24 |
2 files changed, 35 insertions, 0 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 7b17141c47c..8f53f24e527 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -418,6 +418,7 @@ struct kvm_trace_rec { | |||
418 | #ifdef __KVM_HAVE_MCE | 418 | #ifdef __KVM_HAVE_MCE |
419 | #define KVM_CAP_MCE 31 | 419 | #define KVM_CAP_MCE 31 |
420 | #endif | 420 | #endif |
421 | #define KVM_CAP_IRQFD 32 | ||
421 | 422 | ||
422 | #ifdef KVM_CAP_IRQ_ROUTING | 423 | #ifdef KVM_CAP_IRQ_ROUTING |
423 | 424 | ||
@@ -470,6 +471,15 @@ struct kvm_x86_mce { | |||
470 | }; | 471 | }; |
471 | #endif | 472 | #endif |
472 | 473 | ||
474 | #define KVM_IRQFD_FLAG_DEASSIGN (1 << 0) | ||
475 | |||
476 | struct kvm_irqfd { | ||
477 | __u32 fd; | ||
478 | __u32 gsi; | ||
479 | __u32 flags; | ||
480 | __u8 pad[20]; | ||
481 | }; | ||
482 | |||
473 | /* | 483 | /* |
474 | * ioctls for VM fds | 484 | * ioctls for VM fds |
475 | */ | 485 | */ |
@@ -514,6 +524,7 @@ struct kvm_x86_mce { | |||
514 | #define KVM_ASSIGN_SET_MSIX_ENTRY \ | 524 | #define KVM_ASSIGN_SET_MSIX_ENTRY \ |
515 | _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry) | 525 | _IOW(KVMIO, 0x74, struct kvm_assigned_msix_entry) |
516 | #define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) | 526 | #define KVM_DEASSIGN_DEV_IRQ _IOW(KVMIO, 0x75, struct kvm_assigned_irq) |
527 | #define KVM_IRQFD _IOW(KVMIO, 0x76, struct kvm_irqfd) | ||
517 | 528 | ||
518 | /* | 529 | /* |
519 | * ioctls for vcpu fds | 530 | * ioctls for vcpu fds |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 3060bdc35ff..7724dcb6ff7 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -136,6 +136,12 @@ struct kvm { | |||
136 | struct list_head vm_list; | 136 | struct list_head vm_list; |
137 | struct kvm_io_bus mmio_bus; | 137 | struct kvm_io_bus mmio_bus; |
138 | struct kvm_io_bus pio_bus; | 138 | struct kvm_io_bus pio_bus; |
139 | #ifdef CONFIG_HAVE_KVM_EVENTFD | ||
140 | struct { | ||
141 | spinlock_t lock; | ||
142 | struct list_head items; | ||
143 | } irqfds; | ||
144 | #endif | ||
139 | struct kvm_vm_stat stat; | 145 | struct kvm_vm_stat stat; |
140 | struct kvm_arch arch; | 146 | struct kvm_arch arch; |
141 | atomic_t users_count; | 147 | atomic_t users_count; |
@@ -525,4 +531,22 @@ static inline void kvm_free_irq_routing(struct kvm *kvm) {} | |||
525 | 531 | ||
526 | #endif | 532 | #endif |
527 | 533 | ||
534 | #ifdef CONFIG_HAVE_KVM_EVENTFD | ||
535 | |||
536 | void kvm_irqfd_init(struct kvm *kvm); | ||
537 | int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags); | ||
538 | void kvm_irqfd_release(struct kvm *kvm); | ||
539 | |||
540 | #else | ||
541 | |||
542 | static inline void kvm_irqfd_init(struct kvm *kvm) {} | ||
543 | static inline int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags) | ||
544 | { | ||
545 | return -EINVAL; | ||
546 | } | ||
547 | |||
548 | static inline void kvm_irqfd_release(struct kvm *kvm) {} | ||
549 | |||
550 | #endif /* CONFIG_HAVE_KVM_EVENTFD */ | ||
551 | |||
528 | #endif | 552 | #endif |