Make ioeventfd could be enabled or disabled (default). Since ioeventfd
is not yet ready in kvm-arm, without this option, qemu will get a
problem if it attempts to initialize ioeventfd.

Signed-off-by: Ying-Shiuan Pan <yingshiuan....@gmail.com>
Signed-off-by: Li Liu <john.li...@huawei.com>
Signed-off-by: Shannon Zhao <zhaoshengl...@huawei.com>
---
 hw/net/virtio-net.c        |    1 +
 hw/virtio/virtio-mmio.c    |    3 ++-
 include/hw/virtio/virtio.h |    1 +
 3 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 9b88775..d89d4a6 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1723,6 +1723,7 @@ static Property virtio_net_properties[] = {
                                                TX_TIMER_INTERVAL),
     DEFINE_PROP_INT32("x-txburst", VirtIONet, net_conf.txburst, TX_BURST),
     DEFINE_PROP_STRING("tx", VirtIONet, net_conf.tx),
+    DEFINE_PROP_BOOL("ioeventfd", VirtIONet, parent_obj.use_ioeventfd, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index c543e71..16697ed 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -124,7 +124,8 @@ static void virtio_mmio_start_ioeventfd(VirtIOMMIOProxy 
*proxy)
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
     int n, r;
 
-    if (proxy->ioeventfd_disabled ||
+    if (!vdev->use_ioeventfd ||
+        proxy->ioeventfd_disabled ||
         proxy->ioeventfd_started) {
         return;
     }
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 0726d76..e4bc8ad 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -127,6 +127,7 @@ struct VirtIODevice
     bool vm_running;
     VMChangeStateEntry *vmstate;
     char *bus_name;
+    bool use_ioeventfd;
     uint8_t device_endian;
 };
 
-- 
1.7.1


Reply via email to