From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrN0y-0002b3-Qp for qemu-devel@nongnu.org; Mon, 02 Jun 2014 03:50:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WrN0s-0001U8-LG for qemu-devel@nongnu.org; Mon, 02 Jun 2014 03:50:40 -0400 Received: from mail-we0-f178.google.com ([74.125.82.178]:59181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WrN0s-0001U2-As for qemu-devel@nongnu.org; Mon, 02 Jun 2014 03:50:34 -0400 Received: by mail-we0-f178.google.com with SMTP id u56so4635474wes.37 for ; Mon, 02 Jun 2014 00:50:33 -0700 (PDT) From: Eric Auger Date: Mon, 2 Jun 2014 08:49:33 +0100 Message-Id: <1401695374-4287-10-git-send-email-eric.auger@linaro.org> In-Reply-To: <1401695374-4287-1-git-send-email-eric.auger@linaro.org> References: <1401695374-4287-1-git-send-email-eric.auger@linaro.org> Subject: [Qemu-devel] [RFC v3 09/10] Always use eventfd as notifying mechanism List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: eric.auger@st.com, christoffer.dall@linaro.org, qemu-devel@nongnu.org, kim.phillips@freescale.com, a.rigo@virtualopensystems.com Cc: peter.maydell@linaro.org, eric.auger@linaro.org, patches@linaro.org, agraf@suse.de, stuart.yoder@freescale.com, alex.williamson@redhat.com, christophe.barnichon@st.com, a.motakis@virtualopensystems.com, kvmarm@lists.cs.columbia.edu From: Alvise Rigo When eventfd is not configured the method event_notifier_init fallbacks to the pipe/pipe2 system call, causing an error in VFIO_DEVICE_SET_IRQS since we pass to the kernel a file descriptor which is not created by eventfd. Signed-off-by: Alvise Rigo --- hw/vfio/platform.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c index 377783b..56dde5f 100644 --- a/hw/vfio/platform.c +++ b/hw/vfio/platform.c @@ -346,6 +346,11 @@ static int vfio_enable_intp(VFIODevice *vdev, unsigned int index) sysbus_init_irq(sbdev, &intp->qemuirq); ret = event_notifier_init(&intp->interrupt, 0); + if (!ret && (intp->interrupt.rfd != intp->interrupt.wfd)) { + /* event_notifier_init created a pipe instead of eventfd */ + ret = -1; + } + if (ret) { error_report("vfio: Error: event_notifier_init failed "); return ret; -- 1.8.3.2