diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2013-02-15 10:18:43 +0100 |
---|---|---|
committer | Cornelia Huck <cornelia.huck@de.ibm.com> | 2013-06-25 17:11:11 +0200 |
commit | b4436a0b4db0334c3157f71e9baa2944a133c4d4 (patch) | |
tree | 2cec150cd86566799faf013f67e432656097eef4 /target-s390x | |
parent | 6504a93011138458a2e4f67b513c5a77bdb3cae1 (diff) |
virtio-ccw: Wire up ioeventfd.
On hosts that support ioeventfd, make use of it for host-to-guest
notifications via diagnose 500.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'target-s390x')
-rw-r--r-- | target-s390x/cpu.h | 16 | ||||
-rw-r--r-- | target-s390x/kvm.c | 19 |
2 files changed, 35 insertions, 0 deletions
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h index 0ce82cf830..918c819c64 100644 --- a/target-s390x/cpu.h +++ b/target-s390x/cpu.h @@ -1081,6 +1081,7 @@ void kvm_s390_io_interrupt(S390CPU *cpu, uint16_t subchannel_id, void kvm_s390_crw_mchk(S390CPU *cpu); void kvm_s390_enable_css_support(S390CPU *cpu); int kvm_s390_get_registers_partial(CPUState *cpu); +int kvm_s390_assign_subch_ioeventfd(int fd, uint32_t sch, int vq, bool assign); #else static inline void kvm_s390_io_interrupt(S390CPU *cpu, uint16_t subchannel_id, @@ -1099,6 +1100,11 @@ static inline int kvm_s390_get_registers_partial(CPUState *cpu) { return -ENOSYS; } +static inline int kvm_s390_assign_subch_ioeventfd(int fd, uint32_t sch, int vq, + bool assign) +{ + return -ENOSYS; +} #endif static inline void s390_io_interrupt(S390CPU *cpu, @@ -1125,4 +1131,14 @@ static inline void s390_crw_mchk(S390CPU *cpu) } } +static inline int s390_assign_subch_ioeventfd(int fd, uint32_t sch_id, int vq, + bool assign) +{ + if (kvm_enabled()) { + return kvm_s390_assign_subch_ioeventfd(fd, sch_id, vq, assign); + } else { + return -ENOSYS; + } +} + #endif diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 4d9ac4ad0c..650d3a5da9 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -932,3 +932,22 @@ void kvm_s390_enable_css_support(S390CPU *cpu) void kvm_arch_init_irq_routing(KVMState *s) { } + +int kvm_s390_assign_subch_ioeventfd(int fd, uint32_t sch, int vq, bool assign) +{ + struct kvm_ioeventfd kick = { + .flags = KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY | + KVM_IOEVENTFD_FLAG_DATAMATCH, + .fd = fd, + .datamatch = vq, + .addr = sch, + .len = 8, + }; + if (!kvm_check_extension(kvm_state, KVM_CAP_IOEVENTFD)) { + return -ENOSYS; + } + if (!assign) { + kick.flags |= KVM_IOEVENTFD_FLAG_DEASSIGN; + } + return kvm_vm_ioctl(kvm_state, KVM_IOEVENTFD, &kick); +} |