diff options
author | Gregory Haskins <ghaskins@novell.com> | 2009-05-20 10:30:49 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-09-10 01:32:41 -0400 |
commit | 721eecbf4fe995ca94a9edec0c9843b1cc0eaaf3 (patch) | |
tree | c759fe98a4ea5e2e2a7694e4b44a558407077290 /include/linux/kvm_host.h | |
parent | 0ba12d10817a8db1fd7d96d3283ec6c0b294aeab (diff) |
KVM: irqfd
KVM provides a complete virtual system environment for guests, including
support for injecting interrupts modeled after the real exception/interrupt
facilities present on the native platform (such as the IDT on x86).
Virtual interrupts can come from a variety of sources (emulated devices,
pass-through devices, etc) but all must be injected to the guest via
the KVM infrastructure. This patch adds a new mechanism to inject a specific
interrupt to a guest using a decoupled eventfd mechnanism: Any legal signal
on the irqfd (using eventfd semantics from either userspace or kernel) will
translate into an injected interrupt in the guest at the next available
interrupt window.
Signed-off-by: Gregory Haskins <ghaskins@novell.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r-- | include/linux/kvm_host.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 3060bdc35ffe..7724dcb6ff76 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 |