From patchwork Mon Apr 13 12:29:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Auger X-Patchwork-Id: 6208351 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 5DDE09F1AC for ; Mon, 13 Apr 2015 12:36:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7FC562035B for ; Mon, 13 Apr 2015 12:36:36 +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 8E12720361 for ; Mon, 13 Apr 2015 12:36:35 +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 1YhdYb-0007UB-2F; Mon, 13 Apr 2015 12:33:41 +0000 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YhdXt-000799-7f for linux-arm-kernel@lists.infradead.org; Mon, 13 Apr 2015 12:32:58 +0000 Received: by wizk4 with SMTP id k4so70360753wiz.1 for ; Mon, 13 Apr 2015 05:32:35 -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=1rb5smjxrPZR49l/npWU/JinQiErrgB1GMrmeGzi6KM=; b=BBVs45GxZ5RGFtk/I+FfLPBVaJDJrpZ08NGvrpjD7nUvTfMQ5KFHQEQz5SEyuxQpLB HuKDIgyWdHuzPaT57c6Ki5xpbCuxBXxCtlEl9YJVVSLOE/l+OZ0vPU/oSucczEcS3z1X 7N9JwszAZhUJA9N52lu4QiwznsajxWg51dJET3KjlTzJ+xCybSeHlftuO5keDI/zU6m+ gMLc3SsJ2aKPeMze43PNh3eKwecAn3IxK5VcZjWdLrMHGC0x//v0E2l5D4cGDApYO4RG PDxoipwNLSJ1OWtDtOWtiYFyYhUFXEdkwvSO05GJZOSOAzIu7IpIwilhBmzhI+njSlm/ AIJA== X-Gm-Message-State: ALoCoQkBU8X72BV8xd0rKOQpDyfZqOwEdbL/tltM/sRNanpmDdXMLXKksp1JIRArgyBmpth0KHL4 X-Received: by 10.180.101.98 with SMTP id ff2mr21134163wib.15.1428928355033; Mon, 13 Apr 2015 05:32:35 -0700 (PDT) Received: from gnx2579.gnb.st.com (LCaen-156-56-7-90.w80-11.abo.wanadoo.fr. [80.11.198.90]) by mx.google.com with ESMTPSA id fl14sm2879910wjc.11.2015.04.13.05.32.33 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Apr 2015 05:32:34 -0700 (PDT) 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, pbonzini@redhat.com Subject: [RFC v6 02/16] VFIO: platform: test forwarded state when selecting IRQ handler Date: Mon, 13 Apr 2015 14:29:17 +0200 Message-Id: <1428928171-18884-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428928171-18884-1-git-send-email-eric.auger@linaro.org> References: <1428928171-18884-1-git-send-email-eric.auger@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150413_053257_456021_096D310B X-CRM114-Status: GOOD ( 12.25 ) X-Spam-Score: -0.7 (/) Cc: b.reynal@virtualopensystems.com, feng.wu@intel.com, linux-kernel@vger.kernel.org, patches@linaro.org 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;