From patchwork Sun May 11 17:13:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alvise Rigo X-Patchwork-Id: 347806 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 15D6A140087 for ; Mon, 12 May 2014 03:17:42 +1000 (EST) Received: from localhost ([::1]:33754 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjXNb-0003sJ-TB for incoming@patchwork.ozlabs.org; Sun, 11 May 2014 13:17:39 -0400 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) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Z3BR/0PUkUABl2aL3UWpeoULcbYfD68HMhOHKtlcy5I=; b=CDwLUm3+44OcL1sGQryxXq4W+cFuCH84XfjvinEE8N+MqosaDmpJWTIXI9k8/ClNtG NPsSo7l7SeuIyrkjvaPRiKQp3wqbMsk6zFg2Y2+ZQBWV6C2WQbIQD4IM1JVMQQA56CDc rMJwjhRtEahTdQdr7FWep5utMrZ7BAwoemXVuQGpiocFgeSvCFAz67QMef09IJIRFw64 0MVUVQd0U6hMgaoOAEtLHLGGCSJG09qqVjTlha7B1DUvE13d81dc1MjJHQ+VrnKwWozm 4cSWCOvzMkkoz8jhCfkEPnK8mJckp4s6E5N4HsGOqMW5TGSXTQh+5nBqX8FzCQ2WZ5l0 46rg== X-Gm-Message-State: ALoCoQmHjX2v86OOW5LjtniAM2zoS4HUm6pci+6Wnt0JNhAOZZgDHJUhjY4xnYiPimlkvR8EmmrT X-Received: by 10.194.77.148 with SMTP id s20mr17569544wjw.31.1399828429956; Sun, 11 May 2014 10:13:49 -0700 (PDT) Received: from localhost.localdomain (AGrenoble-651-1-595-48.w90-42.abo.wanadoo.fr. [90.42.235.48]) by mx.google.com with ESMTPSA id fq2sm11326154wib.2.2014.05.11.10.13.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 11 May 2014 10:13:49 -0700 (PDT) From: Alvise Rigo To: qemu-devel@nongnu.org, a.motakis@virtualopensystems.com, eric.auger@st.com, kim.phillips@linaro.org Date: Sun, 11 May 2014 19:13:35 +0200 Message-Id: <1399828415-13007-5-git-send-email-a.rigo@virtualopensystems.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1399828415-13007-1-git-send-email-a.rigo@virtualopensystems.com> References: <1399828415-13007-1-git-send-email-a.rigo@virtualopensystems.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.52 Cc: Alex Williamson , tech@virtualopensystems.com, Alvise Rigo Subject: [Qemu-devel] [RFC v2 4/4] Always use eventfd as notifying mechanism X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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;