From patchwork Thu Mar 19 14:55:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 46038 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7336521515 for ; Thu, 19 Mar 2015 14:58:30 +0000 (UTC) Received: by wghl18 with SMTP id l18sf12917860wgh.1 for ; Thu, 19 Mar 2015 07:58:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=1rb5smjxrPZR49l/npWU/JinQiErrgB1GMrmeGzi6KM=; b=Xl70ZEy1Jk6IDcTJXSMBMxF2aab5tblYatoWmWeFT2bJ2EId0GnTwjL35lM2WJClpM 7x+ERpDjxlWQ+JSfR/W6QFibDHGdhifxQcIGJCnoAAqsUtpm6n+ge4Tm0FlHOMUumZJ5 3YVpzGpN45XVl0uQ/J66biNFptdQQlvUCY//BMzFkVmh1oFhpVRJK6CHdjZWyV8M9q0f XqzlFtQb8GCR9BUtTpWkYD/4hoHvUkfP0XnzmaZfLp3ulf76/BQ0MnyxYtd6oiFpl1uV 0UODmNKicQtsZ0aHvREo8Ifz44bmul6wRibB84cBn4sQhYgUL8kGsnQowG9/MNAuazdv C7Nw== X-Gm-Message-State: ALoCoQnVDf4uvXgLjvPt4b898058OmCCbTj6dd4Swg0WGbouMOEW8wMBIAtBNeqqhgB25zceYNRZ X-Received: by 10.112.142.1 with SMTP id rs1mr10107060lbb.19.1426777109744; Thu, 19 Mar 2015 07:58:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.10 with SMTP id 10ls279787lay.26.gmail; Thu, 19 Mar 2015 07:58:29 -0700 (PDT) X-Received: by 10.112.16.1 with SMTP id b1mr54658143lbd.39.1426777109471; Thu, 19 Mar 2015 07:58:29 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id d9si1148151lad.116.2015.03.19.07.58.29 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 07:58:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbnq5 with SMTP id q5so26627491lbn.0 for ; Thu, 19 Mar 2015 07:58:29 -0700 (PDT) X-Received: by 10.152.8.15 with SMTP id n15mr41838765laa.41.1426777109266; Thu, 19 Mar 2015 07:58:29 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.35.133 with SMTP id h5csp441345lbj; Thu, 19 Mar 2015 07:58:28 -0700 (PDT) X-Received: by 10.181.12.105 with SMTP id ep9mr17172671wid.85.1426777108618; Thu, 19 Mar 2015 07:58:28 -0700 (PDT) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com. [209.85.212.179]) by mx.google.com with ESMTPS id d7si3585255wiz.9.2015.03.19.07.58.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 07:58:28 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.179 as permitted sender) client-ip=209.85.212.179; Received: by wifj2 with SMTP id j2so71506476wif.1 for ; Thu, 19 Mar 2015 07:58:28 -0700 (PDT) X-Received: by 10.194.210.103 with SMTP id mt7mr155394903wjc.103.1426777108285; Thu, 19 Mar 2015 07:58:28 -0700 (PDT) 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 a6sm1695350wiy.17.2015.03.19.07.58.26 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 19 Mar 2015 07:58:27 -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, kvm@vger.kernel.org, alex.williamson@redhat.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, pbonzini@redhat.com, kim.phillips@freescale.com, b.reynal@virtualopensystems.com, feng.wu@intel.com Subject: [RFC v5 02/13] VFIO: platform: test forwarded state when selecting IRQ handler Date: Thu, 19 Mar 2015 15:55:40 +0100 Message-Id: <1426776951-24901-3-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426776951-24901-1-git-send-email-eric.auger@linaro.org> References: <1426776951-24901-1-git-send-email-eric.auger@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: eric.auger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;