diff options
author | Andrey Smetanin <asmetanin@virtuozzo.com> | 2015-10-16 03:07:47 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2015-10-16 04:34:29 -0400 |
commit | c9a5eccac1abf50649949f15754a7635f263a1ff (patch) | |
tree | c84abaa40f878ac85415eb0d71be3a34902b9827 | |
parent | ba1aefcd6db5536d3eb3ca3ce7bd6786960140ea (diff) |
kvm/eventfd: add arch-specific set_irq
Allow for arch-specific interrupt types to be set. For that, add
kvm_arch_set_irq() which takes interrupt type-specific action if it
recognizes the interrupt type given, and -EWOULDBLOCK otherwise.
The default implementation always returns -EWOULDBLOCK.
Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com>
Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Vitaly Kuznetsov <vkuznets@redhat.com>
CC: "K. Y. Srinivasan" <kys@microsoft.com>
CC: Gleb Natapov <gleb@kernel.org>
CC: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | include/linux/kvm_host.h | 4 | ||||
-rw-r--r-- | virt/kvm/eventfd.c | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index b66861c297c4..eba9caebc9c1 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -828,6 +828,10 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level, | |||
828 | int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); | 828 | int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level); |
829 | int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm, | 829 | int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm, |
830 | int irq_source_id, int level, bool line_status); | 830 | int irq_source_id, int level, bool line_status); |
831 | |||
832 | int kvm_arch_set_irq(struct kvm_kernel_irq_routing_entry *irq, struct kvm *kvm, | ||
833 | int irq_source_id, int level, bool line_status); | ||
834 | |||
831 | bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin); | 835 | bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin); |
832 | void kvm_notify_acked_gsi(struct kvm *kvm, int gsi); | 836 | void kvm_notify_acked_gsi(struct kvm *kvm, int gsi); |
833 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); | 837 | void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin); |
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index f6b986a41823..e29fd2640709 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c | |||
@@ -171,6 +171,15 @@ irqfd_deactivate(struct kvm_kernel_irqfd *irqfd) | |||
171 | queue_work(irqfd_cleanup_wq, &irqfd->shutdown); | 171 | queue_work(irqfd_cleanup_wq, &irqfd->shutdown); |
172 | } | 172 | } |
173 | 173 | ||
174 | int __attribute__((weak)) kvm_arch_set_irq( | ||
175 | struct kvm_kernel_irq_routing_entry *irq, | ||
176 | struct kvm *kvm, int irq_source_id, | ||
177 | int level, | ||
178 | bool line_status) | ||
179 | { | ||
180 | return -EWOULDBLOCK; | ||
181 | } | ||
182 | |||
174 | /* | 183 | /* |
175 | * Called with wqh->lock held and interrupts disabled | 184 | * Called with wqh->lock held and interrupts disabled |
176 | */ | 185 | */ |
@@ -195,7 +204,9 @@ irqfd_wakeup(wait_queue_t *wait, unsigned mode, int sync, void *key) | |||
195 | if (irq.type == KVM_IRQ_ROUTING_MSI) | 204 | if (irq.type == KVM_IRQ_ROUTING_MSI) |
196 | kvm_set_msi(&irq, kvm, KVM_USERSPACE_IRQ_SOURCE_ID, 1, | 205 | kvm_set_msi(&irq, kvm, KVM_USERSPACE_IRQ_SOURCE_ID, 1, |
197 | false); | 206 | false); |
198 | else | 207 | else if (kvm_arch_set_irq(&irq, kvm, |
208 | KVM_USERSPACE_IRQ_SOURCE_ID, 1, | ||
209 | false) == -EWOULDBLOCK) | ||
199 | schedule_work(&irqfd->inject); | 210 | schedule_work(&irqfd->inject); |
200 | srcu_read_unlock(&kvm->irq_srcu, idx); | 211 | srcu_read_unlock(&kvm->irq_srcu, idx); |
201 | } | 212 | } |