Commit c9a5eccac1abf50649949f15754a7635f263a1ff

Authored by Andrey Smetanin
Committed by Paolo Bonzini
1 parent ba1aefcd6d

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>

Showing 2 changed files with 16 additions and 1 deletions Side-by-side Diff

include/linux/kvm_host.h
... ... @@ -828,6 +828,10 @@
828 828 int kvm_set_irq_inatomic(struct kvm *kvm, int irq_source_id, u32 irq, int level);
829 829 int kvm_set_msi(struct kvm_kernel_irq_routing_entry *irq_entry, struct kvm *kvm,
830 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 835 bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin);
832 836 void kvm_notify_acked_gsi(struct kvm *kvm, int gsi);
833 837 void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
... ... @@ -171,6 +171,15 @@
171 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 184 * Called with wqh->lock held and interrupts disabled
176 185 */
... ... @@ -195,7 +204,9 @@
195 204 if (irq.type == KVM_IRQ_ROUTING_MSI)
196 205 kvm_set_msi(&irq, kvm, KVM_USERSPACE_IRQ_SOURCE_ID, 1,
197 206 false);
198   - else
  207 + else if (kvm_arch_set_irq(&irq, kvm,
  208 + KVM_USERSPACE_IRQ_SOURCE_ID, 1,
  209 + false) == -EWOULDBLOCK)
199 210 schedule_work(&irqfd->inject);
200 211 srcu_read_unlock(&kvm->irq_srcu, idx);
201 212 }