path: root/kvm-all.c
diff options
authorPavel Fedin <p.fedin@samsung.com>2015-11-20 12:37:16 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2015-12-17 15:24:34 +0100
commit8c56c1a592b5092d91da8d8943c17777d6462a6f (patch)
tree63ad5cd60370b1cdf26ff80b5c472658952d540f /kvm-all.c
parentbc92e4e97ed62efa61ba983f57dfe33f10fe1d88 (diff)
memory: emulate ioeventfd
The ioeventfd mechanism is used by vhost, dataplane, and virtio-pci to turn guest MMIO/PIO writes into eventfd file descriptor events. This allows arbitrary threads to be notified when the guest writes to a specific MMIO/PIO address. qtest and TCG do not support ioeventfd because memory writes are not checked against registered ioeventfds in QEMU. This patch implements this in memory_region_dispatch_write() so qtest can use ioeventfd. Also this patch fixes vhost aborting on some misconfigured old kernels like 3.18.0 on ARM. It is possible to explicitly enable CONFIG_EVENTFD in expert settings, while MMIO binding support in KVM will still be missing. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Message-Id: <006e01d12377$0b9c2d40$22d487c0$@samsung.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'kvm-all.c')
1 files changed, 4 insertions, 2 deletions
diff --git a/kvm-all.c b/kvm-all.c
index a45c92bd1c..ed707fe580 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1628,8 +1628,10 @@ static int kvm_init(MachineState *ms)
kvm_state = s;
- s->memory_listener.listener.eventfd_add = kvm_mem_ioeventfd_add;
- s->memory_listener.listener.eventfd_del = kvm_mem_ioeventfd_del;
+ if (kvm_eventfds_allowed) {
+ s->memory_listener.listener.eventfd_add = kvm_mem_ioeventfd_add;
+ s->memory_listener.listener.eventfd_del = kvm_mem_ioeventfd_del;
+ }
s->memory_listener.listener.coalesced_mmio_add = kvm_coalesce_mmio_region;
s->memory_listener.listener.coalesced_mmio_del = kvm_uncoalesce_mmio_region;