diff options
author | Cam Macdonell <cam@cs.ualberta.ca> | 2010-07-26 18:10:59 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-08-10 16:25:15 -0500 |
commit | 44f1a3d8765b19ee88ca493e8e13cefb6ee50cbe (patch) | |
tree | ac088cf7628b687ed624569beb24dbcc4a4d439f /kvm-all.c | |
parent | b6828931ebac027b869e40ec9518a291078dafe5 (diff) | |
download | qemu-44f1a3d8765b19ee88ca493e8e13cefb6ee50cbe.zip qemu-44f1a3d8765b19ee88ca493e8e13cefb6ee50cbe.tar.gz qemu-44f1a3d8765b19ee88ca493e8e13cefb6ee50cbe.tar.bz2 |
Add function to assign ioeventfd to MMIO.
Signed-off-by: Cam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'kvm-all.c')
-rw-r--r-- | kvm-all.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -1241,6 +1241,38 @@ int kvm_set_signal_mask(CPUState *env, const sigset_t *sigset) return r; } +int kvm_set_ioeventfd_mmio_long(int fd, uint32_t addr, uint32_t val, bool assign) +{ +#ifdef KVM_IOEVENTFD + int ret; + struct kvm_ioeventfd iofd; + + iofd.datamatch = val; + iofd.addr = addr; + iofd.len = 4; + iofd.flags = KVM_IOEVENTFD_FLAG_DATAMATCH; + iofd.fd = fd; + + if (!kvm_enabled()) { + return -ENOSYS; + } + + if (!assign) { + iofd.flags |= KVM_IOEVENTFD_FLAG_DEASSIGN; + } + + ret = kvm_vm_ioctl(kvm_state, KVM_IOEVENTFD, &iofd); + + if (ret < 0) { + return -errno; + } + + return 0; +#else + return -ENOSYS; +#endif +} + int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t val, bool assign) { #ifdef KVM_IOEVENTFD |