From patchwork Wed Feb 11 08:32:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 5811071 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8F79D9F37F for ; Wed, 11 Feb 2015 08:38:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C537220211 for ; Wed, 11 Feb 2015 08:38:54 +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 011E7201BB for ; Wed, 11 Feb 2015 08:38:54 +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 1YLSmY-000354-Im; Wed, 11 Feb 2015 08:36:26 +0000 Received: from mail-ig0-f170.google.com ([209.85.213.170]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YLSlS-0000ET-Af for linux-arm-kernel@lists.infradead.org; Wed, 11 Feb 2015 08:35:19 +0000 Received: by mail-ig0-f170.google.com with SMTP id l13so26498494iga.1 for ; Wed, 11 Feb 2015 00:34:55 -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=1rb5smjxrPZR49l/npWU/JinQiErrgB1GMrmeGzi6KM=; b=MUqPTdFhs5kXIyMWM11lUmWhKQM0FdymNcJD9PjCXjMD7fnet/lPieve5TX2YwyVkP rr9HeCm3dLKydruGZ4deh7dnz9XmsE++TjEmbxds3aDwE9rp+rAsbmfHQiahcOTIS1yi zh5RdAbVMm2L/UnyiiNYZ5h2axGIk4KQJZM5ZVpi7cFWtle1f0x0rxY0jskE7DQRA2XE RqwX9vjwGdroQn9ESmdRIQzI3NGySN0eZ664zY9kjAkMA8OHMzBlsdcf9I/2ixQTGn3X ux/P0qvuFONGIJwTU6UDBqst/Um77sk0pFJp3Y0cuz0C74hby3xSMl4O/CIF2AVXPoUT Kbeg== X-Gm-Message-State: ALoCoQm/eq6PjYf4QdWmg3V95uyaS7sA8PpPc8IyVcCiPzD0mpF9zClP1as9TqxxQ9r+++dalJ4D X-Received: by 10.42.222.68 with SMTP id if4mr1812169icb.45.1423643695367; Wed, 11 Feb 2015 00:34:55 -0800 (PST) Received: from gnx2579.solutionip.com ([113.28.134.59]) by mx.google.com with ESMTPSA id m38sm62189ioi.39.2015.02.11.00.34.50 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 11 Feb 2015 00:34:54 -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, feng.wu@intel.com Subject: [RFC v4 02/13] VFIO: platform: test forwarded state when selecting IRQ handler Date: Wed, 11 Feb 2015 09:32:12 +0100 Message-Id: <1423643543-24409-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423643543-24409-1-git-send-email-eric.auger@linaro.org> References: <1423643543-24409-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150211_003518_458149_0D0C5704 X-CRM114-Status: GOOD ( 11.70 ) X-Spam-Score: -0.7 (/) Cc: b.reynal@virtualopensystems.com, patches@linaro.org, gleb@kernel.org, andre.przywara@arm.com, a.rigo@virtualopensystems.com, pbonzini@redhat.com, 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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 vfio_irq_handler. Signed-off-by: Eric Auger --- v3 -> v4: - change title 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. Conflicts: drivers/vfio/platform/vfio_platform_irq.c --- 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 88bba57..132bb3f 100644 --- a/drivers/vfio/platform/vfio_platform_irq.c +++ b/drivers/vfio/platform/vfio_platform_irq.c @@ -229,8 +229,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_AUTOMASKED) + d = irq_get_irq_data(irq->hwirq); + is_forwarded = irqd_irq_forwarded(d); + + if (vdev->irqs[index].flags & VFIO_IRQ_INFO_AUTOMASKED && !is_forwarded) handler = vfio_automasked_irq_handler; else handler = vfio_irq_handler;