From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7PBu-0002QZ-0a for qemu-devel@nongnu.org; Tue, 13 Mar 2012 06:43:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7PBn-0004FV-1q for qemu-devel@nongnu.org; Tue, 13 Mar 2012 06:42:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7PBm-0004FO-QD for qemu-devel@nongnu.org; Tue, 13 Mar 2012 06:42:46 -0400 From: Amos Kong Date: Tue, 13 Mar 2012 18:42:40 +0800 Message-ID: <20120313104240.8741.15753.stgit@dhcp-8-167.nay.redhat.com> In-Reply-To: <20120313103602.8741.71939.stgit@dhcp-8-167.nay.redhat.com> References: <20120313103602.8741.71939.stgit@dhcp-8-167.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 2/2] virtio-pci: fallback to userspace when there is no enough available ioeventfd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, kvm@vger.kernel.org, mtosatti@redhat.com, qemu-devel@nongnu.org, avi@redhat.com 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 --- hw/virtio-pci.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) 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); }