diff mbox

[2/2] virtio-pci: fallback to userspace when there is no enough available ioeventfd

Message ID 20120313104240.8741.15753.stgit@dhcp-8-167.nay.redhat.com
State New
Headers show

Commit Message

Amos Kong March 13, 2012, 10:42 a.m. UTC
Qemu already supported multiple function devices, pci-bridge
would support more pci devices. But iobus dev in kernel are
limited. If there is no enough available ioeventfd, then
clean VIRTIO_PCI_FLAG_USE_IOEVENTFD bit, virtio-pci would
fallback to userspace.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 hw/virtio-pci.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index d63f303..d15b11b 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -322,6 +322,9 @@  static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
         virtio_set_status(vdev, val & 0xFF);
 
         if (val & VIRTIO_CONFIG_S_DRIVER_OK) {
+            if (kvm_has_many_ioeventfds() == 0) {
+                proxy->flags &= ~VIRTIO_PCI_FLAG_USE_IOEVENTFD;
+            }
             virtio_pci_start_ioeventfd(proxy);
         }