From patchwork Mon Sep 1 12:52:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 36359 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7AB3A2032B for ; Mon, 1 Sep 2014 12:53:43 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id cm18sf17429811qab.11 for ; Mon, 01 Sep 2014 05:53:43 -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=njBr9RmpmM+R+suZ+BZJ7OQGDRcnIYPLfMmHR2u2120=; b=VlSAy2cZQPHl8Uf81qxY1Kejkf6XS5IM3ZaWpkrnYCFL99ttnrUDGoJSe/8H9Jdh+z GOg+sKW0tXNvAdEqrAXF8CsMeH9fV2Zn+M1R8vIkVe7yWZdY7pbMFX4uHxrqvnqcvUQw K8vp/FUAC9ttOG8GFHzZPr5VSRrxsRNWU3Rrx47swXoS/srd2NIZhk6zk8WntSMaT1xl 8/fh97GythrN5/ICmWY1v89hNqXYu6L/w5soa04zuA43TtcxzlFqcNRUk7HZYc7qioqL ov5VG9lYXPauuh6rQvNWI0d5O4A9JYIIL8oKo91X9OvtpJbG9lBkgG/7ALYYlwmxn31B Tfiw== X-Gm-Message-State: ALoCoQldz7SPKG527LCJPOuv7QjsAfLDYve8LDT7USMdadrIKpW2FnPBE7VT+jIYN0NnMEkOMCBS X-Received: by 10.236.104.199 with SMTP id i47mr13761406yhg.33.1409576023137; Mon, 01 Sep 2014 05:53:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.100 with SMTP id l91ls1907738qge.69.gmail; Mon, 01 Sep 2014 05:53:43 -0700 (PDT) X-Received: by 10.221.6.201 with SMTP id ol9mr25179787vcb.2.1409576023021; Mon, 01 Sep 2014 05:53:43 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id h8si288687vdj.81.2014.09.01.05.53.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Sep 2014 05:53:42 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id im17so5381143vcb.41 for ; Mon, 01 Sep 2014 05:53:42 -0700 (PDT) X-Received: by 10.220.77.65 with SMTP id f1mr274889vck.48.1409576022929; Mon, 01 Sep 2014 05:53:42 -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.221.45.67 with SMTP id uj3csp383149vcb; Mon, 1 Sep 2014 05:53:42 -0700 (PDT) X-Received: by 10.194.174.202 with SMTP id bu10mr32493145wjc.70.1409576021475; Mon, 01 Sep 2014 05:53:41 -0700 (PDT) Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by mx.google.com with ESMTPS id o14si9760350wie.41.2014.09.01.05.53.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Sep 2014 05:53:41 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.174 as permitted sender) client-ip=209.85.212.174; Received: by mail-wi0-f174.google.com with SMTP id d1so12592312wiv.1 for ; Mon, 01 Sep 2014 05:53:40 -0700 (PDT) X-Received: by 10.180.19.10 with SMTP id a10mr21004009wie.49.1409576020873; Mon, 01 Sep 2014 05:53:40 -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 y5sm1928678wje.32.2014.09.01.05.53.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Sep 2014 05:53:40 -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, joel.schopp@amd.com, kim.phillips@freescale.com, paulus@samba.org, gleb@kernel.org, pbonzini@redhat.com Cc: linux-kernel@vger.kernel.org, patches@linaro.org, will.deacon@arm.com, a.motakis@virtualopensystems.com, a.rigo@virtualopensystems.com, john.liuli@huawei.com Subject: [RFC v2 4/9] VFIO: platform: handler tests whether the IRQ is forwarded Date: Mon, 1 Sep 2014 14:52:43 +0200 Message-Id: <1409575968-5329-5-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1409575968-5329-1-git-send-email-eric.auger@linaro.org> References: <1409575968-5329-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.220.182 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. In that mode, when the handler completes the IRQ is not deactivated but only its priority is lowered. Some other actor (typically a guest) is supposed to deactivate the IRQ, allowing at that time a new physical IRQ to hit. In virtualization use case, the physical IRQ is automatically completed by the interrupt controller when the guest completes the corresponding virtual IRQ. Signed-off-by: Eric Auger --- 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 6768508..1f851b2 100644 --- a/drivers/vfio/platform/vfio_platform_irq.c +++ b/drivers/vfio/platform/vfio_platform_irq.c @@ -88,13 +88,18 @@ static irqreturn_t vfio_irq_handler(int irq, void *dev_id) struct vfio_platform_irq *irq_ctx = dev_id; unsigned long flags; int ret = IRQ_NONE; + struct irq_data *d; + bool is_forwarded; spin_lock_irqsave(&irq_ctx->lock, flags); if (!irq_ctx->masked) { ret = IRQ_HANDLED; + d = irq_get_irq_data(irq_ctx->hwirq); + is_forwarded = irqd_irq_forwarded(d); - if (irq_ctx->flags & VFIO_IRQ_INFO_AUTOMASKED) { + if (irq_ctx->flags & VFIO_IRQ_INFO_AUTOMASKED && + !is_forwarded) { disable_irq_nosync(irq_ctx->hwirq); irq_ctx->masked = true; }