From patchwork Sun Nov 23 18:35:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 5362361 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AD8379F39D for ; Sun, 23 Nov 2014 18:40:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E377F202C8 for ; Sun, 23 Nov 2014 18:40:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A96FB2028D for ; Sun, 23 Nov 2014 18:40:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xsc3Y-0005eL-3e; Sun, 23 Nov 2014 18:38:44 +0000 Received: from mail-wi0-f182.google.com ([209.85.212.182]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xsc2m-0005Hc-E9 for linux-arm-kernel@lists.infradead.org; Sun, 23 Nov 2014 18:37:57 +0000 Received: by mail-wi0-f182.google.com with SMTP id h11so3738366wiw.9 for ; Sun, 23 Nov 2014 10:37:34 -0800 (PST) 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=2nWT1kjGNyJ+sPbRqCKY8MGxJktnGXpsE9/Shf+s9hA=; b=YWnl14f19nLGPsHsXlBfD8CsFJohhK+ZVa37n4qhl1sFgzR2MQAerRQkMS8I/k3ymP +7692NLiWNDl5O3XPb3bqb4YdEwTn4hSW694DI/oZVsfhiYdJwDTolHJURE528KcnTzm LcfhSkzEUpffVMAr6/ipXSe2sf9ufjCSE41rfe6jExx/GHm+/R1AlgXGzNnvbjJMtON7 fIwmxfEJ/uQOZkgSuNA2a1GdQ4reiMX4sThSPHONu2OcYEjAs2fFfDTiPRJLao7zNZzd 2jPOLCzUNUAFcXVvT6paE+XTzKkH7xdgx5F71f7anKHABadJjykBSwjj3HDSG63ZJgqf VYBw== X-Gm-Message-State: ALoCoQkqiU76D4KZgRyLGRHwqnryf2VWoNBOcjONAMmmY6Y1FIpEyMShfzH086whCXR/GvMD/Ery X-Received: by 10.194.123.99 with SMTP id lz3mr9355731wjb.31.1416767854590; Sun, 23 Nov 2014 10:37:34 -0800 (PST) Received: from gnx2579.gnb.st.com (weg38-3-78-232-41-119.fbx.proxad.net. [78.232.41.119]) by mx.google.com with ESMTPSA id hk9sm17535471wjb.46.2014.11.23.10.37.32 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Nov 2014 10:37:34 -0800 (PST) From: Eric Auger To: eric.auger@st.com, eric.auger@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, alex.williamson@redhat.com, joel.schopp@amd.com, kim.phillips@freescale.com, paulus@samba.org, gleb@kernel.org, pbonzini@redhat.com, agraf@suse.de Subject: [PATCH v3 3/8] VFIO: platform: forwarded state tested when selecting IRQ handler Date: Sun, 23 Nov 2014 19:35:55 +0100 Message-Id: <1416767760-14487-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416767760-14487-1-git-send-email-eric.auger@linaro.org> References: <1416767760-14487-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141123_103756_707737_37542C09 X-CRM114-Status: GOOD ( 12.77 ) X-Spam-Score: -0.7 (/) Cc: feng.wu@intel.com, patches@linaro.org, john.liuli@huawei.com, ming.lei@canonical.com, will.deacon@arm.com, a.rigo@virtualopensystems.com, linux-kernel@vger.kernel.org, a.motakis@virtualopensystems.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In case the IRQ is forwarded, the VFIO platform IRQ handler does not need to disable the IRQ anymore. When setting the IRQ handler we now also test the forwarded state. In case the IRQ is forwarded we select the edge handler (no automaske). Signed-off-by: Eric Auger --- v2 -> v3: - forwarded state was tested in the handler. Now the forwarded state is tested before setting the handler. This definitively limits the dynamics of forwarded state changes but I don't think there is a use case where we need to be able to change the state at any time. --- drivers/vfio/platform/vfio_platform_irq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/platform/vfio_platform_irq.c b/drivers/vfio/platform/vfio_platform_irq.c index 08d400e..61a2920 100644 --- a/drivers/vfio/platform/vfio_platform_irq.c +++ b/drivers/vfio/platform/vfio_platform_irq.c @@ -230,8 +230,13 @@ static int vfio_platform_set_irq_trigger(struct vfio_platform_device *vdev, { struct vfio_platform_irq *irq = &vdev->irqs[index]; irq_handler_t handler; + struct irq_data *d; + bool is_forwarded; - if (vdev->irqs[index].flags & VFIO_IRQ_INFO_MASKABLE) + d = irq_get_irq_data(irq->hwirq); + is_forwarded = irqd_irq_forwarded(d); + + if ((vdev->irqs[index].flags & VFIO_IRQ_INFO_MASKABLE) && !is_forwarded) handler = vfio_maskable_irq_handler; else handler = vfio_irq_handler;