diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2013-02-28 06:33:20 -0500 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2013-03-05 17:12:17 -0500 |
commit | 2b83451b45d720ca38c03878ce42ff9139cad9e3 (patch) | |
tree | 374b4ab82ffc115dc8cb76f783f7735521b6c7bf /virt | |
parent | 060f0ce6ff975decd1e0ee318c08e228bccbee1e (diff) |
KVM: ioeventfd for virtio-ccw devices.
Enhance KVM_IOEVENTFD with a new flag that allows to attach to virtio-ccw
devices on s390 via the KVM_VIRTIO_CCW_NOTIFY_BUS.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/eventfd.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index 0b6fe69bb03d..020522ed9094 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c | |||
@@ -674,15 +674,24 @@ ioeventfd_check_collision(struct kvm *kvm, struct _ioeventfd *p) | |||
674 | return false; | 674 | return false; |
675 | } | 675 | } |
676 | 676 | ||
677 | static enum kvm_bus ioeventfd_bus_from_flags(__u32 flags) | ||
678 | { | ||
679 | if (flags & KVM_IOEVENTFD_FLAG_PIO) | ||
680 | return KVM_PIO_BUS; | ||
681 | if (flags & KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY) | ||
682 | return KVM_VIRTIO_CCW_NOTIFY_BUS; | ||
683 | return KVM_MMIO_BUS; | ||
684 | } | ||
685 | |||
677 | static int | 686 | static int |
678 | kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) | 687 | kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) |
679 | { | 688 | { |
680 | int pio = args->flags & KVM_IOEVENTFD_FLAG_PIO; | 689 | enum kvm_bus bus_idx; |
681 | enum kvm_bus bus_idx = pio ? KVM_PIO_BUS : KVM_MMIO_BUS; | ||
682 | struct _ioeventfd *p; | 690 | struct _ioeventfd *p; |
683 | struct eventfd_ctx *eventfd; | 691 | struct eventfd_ctx *eventfd; |
684 | int ret; | 692 | int ret; |
685 | 693 | ||
694 | bus_idx = ioeventfd_bus_from_flags(args->flags); | ||
686 | /* must be natural-word sized */ | 695 | /* must be natural-word sized */ |
687 | switch (args->len) { | 696 | switch (args->len) { |
688 | case 1: | 697 | case 1: |
@@ -757,12 +766,12 @@ fail: | |||
757 | static int | 766 | static int |
758 | kvm_deassign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) | 767 | kvm_deassign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args) |
759 | { | 768 | { |
760 | int pio = args->flags & KVM_IOEVENTFD_FLAG_PIO; | 769 | enum kvm_bus bus_idx; |
761 | enum kvm_bus bus_idx = pio ? KVM_PIO_BUS : KVM_MMIO_BUS; | ||
762 | struct _ioeventfd *p, *tmp; | 770 | struct _ioeventfd *p, *tmp; |
763 | struct eventfd_ctx *eventfd; | 771 | struct eventfd_ctx *eventfd; |
764 | int ret = -ENOENT; | 772 | int ret = -ENOENT; |
765 | 773 | ||
774 | bus_idx = ioeventfd_bus_from_flags(args->flags); | ||
766 | eventfd = eventfd_ctx_fdget(args->fd); | 775 | eventfd = eventfd_ctx_fdget(args->fd); |
767 | if (IS_ERR(eventfd)) | 776 | if (IS_ERR(eventfd)) |
768 | return PTR_ERR(eventfd); | 777 | return PTR_ERR(eventfd); |