From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjXK0-0007ZT-SY for qemu-devel@nongnu.org; Sun, 11 May 2014 13:14:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjXJu-0005Xl-Mj for qemu-devel@nongnu.org; Sun, 11 May 2014 13:13:56 -0400 Received: from mail-wg0-f52.google.com ([74.125.82.52]:58263) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjXJu-0005Xe-HK for qemu-devel@nongnu.org; Sun, 11 May 2014 13:13:50 -0400 Received: by mail-wg0-f52.google.com with SMTP id l18so5808198wgh.23 for ; Sun, 11 May 2014 10:13:50 -0700 (PDT) From: Alvise Rigo Date: Sun, 11 May 2014 19:13:35 +0200 Message-Id: <1399828415-13007-5-git-send-email-a.rigo@virtualopensystems.com> In-Reply-To: <1399828415-13007-1-git-send-email-a.rigo@virtualopensystems.com> References: <1399828415-13007-1-git-send-email-a.rigo@virtualopensystems.com> Subject: [Qemu-devel] [RFC v2 4/4] Always use eventfd as notifying mechanism List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, a.motakis@virtualopensystems.com, eric.auger@st.com, kim.phillips@linaro.org Cc: Alex Williamson , tech@virtualopensystems.com, 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 ec6a29e..40109c6 100644 --- a/hw/vfio/platform.c +++ b/hw/vfio/platform.c @@ -324,6 +324,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.9.1