summaryrefslogtreecommitdiff
path: root/kvm-all.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2010-04-06 12:06:50 -0300
committerMarcelo Tosatti <mtosatti@redhat.com>2010-04-06 12:06:50 -0300
commitecf79ca799d4704130710fc9bd8a69ec23356f86 (patch)
treebc9ebe14438220a06864729a775c7771e2e0c957 /kvm-all.c
parentbc3db4ee17a8aa0ea6e6c6058b8b676031cacec2 (diff)
parentca82180603446831187203383de4b5ede4e2c346 (diff)
Merge commit 'ca82180603446831187203383de4b5ede4e2c346' into upstream-merge
* commit 'ca82180603446831187203383de4b5ede4e2c346': kvm: add API to set ioeventfd tap: add interface to get device fd Conflicts: kvm-all.c Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'kvm-all.c')
-rw-r--r--kvm-all.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/kvm-all.c b/kvm-all.c
index 608da0675..665f6716a 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1187,6 +1187,27 @@ int kvm_set_signal_mask(CPUState *env, const sigset_t *sigset)
return r;
}
+#ifdef KVM_IOEVENTFD
+int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t val, bool assign)
+{
+ struct kvm_ioeventfd kick = {
+ .datamatch = val,
+ .addr = addr,
+ .len = 2,
+ .flags = KVM_IOEVENTFD_FLAG_DATAMATCH | KVM_IOEVENTFD_FLAG_PIO,
+ .fd = fd,
+ };
+ int r;
+ if (!kvm_enabled())
+ return -ENOSYS;
+ if (!assign)
+ kick.flags |= KVM_IOEVENTFD_FLAG_DEASSIGN;
+ r = kvm_vm_ioctl(kvm_state, KVM_IOEVENTFD, &kick);
+ if (r < 0)
+ return r;
+ return 0;
+}
+#endif
+
#undef PAGE_SIZE
#include "qemu-kvm.c"
-