From patchwork Mon Aug 25 13:27:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Auger Eric X-Patchwork-Id: 35912 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A07E020565 for ; Mon, 25 Aug 2014 13:28:43 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wp18sf78737444obc.9 for ; Mon, 25 Aug 2014 06:28: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=TAkRQgzRr5D7+7c0IdlWc60ko4Vp8WPwUPihAYZBusMBNGFnmxqyTT3HWSfgFgs+OG qS8vtosOIdgyT6tHCLjoA0SmATC26K7QpY1BqhJg//+nOAORkAk/n8x3TGx4ZZ8dPd4p wNNo2H7uJl4lp48zVvoPbuNcx1MhfuAi4C2a8jqOudNiib5NaHUWY8LSwdwXFPbyaa6K vUxM0Z865M5hMfyViVR9wffxWgqlUlc3ZpVNC6v+th3ZI06/YMZE1s0506Ci7TF3sivf zP2WiKwJ9JP6I4SSwsIUuKNbftc62XD28rqMOuxYgMsu7limwqtUKFgvU6bZUz4AKds1 Px4Q== X-Gm-Message-State: ALoCoQn4bd8St5J4ZZIS9wqtGAns6XydywhAF4Wsk+CqRGfY9rw0rYMZlkGdOeEdH7TiJT8JtkAe X-Received: by 10.43.74.198 with SMTP id yx6mr1059788icb.32.1408973323279; Mon, 25 Aug 2014 06:28:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.228 with SMTP id b91ls2011547qge.88.gmail; Mon, 25 Aug 2014 06:28:43 -0700 (PDT) X-Received: by 10.52.239.108 with SMTP id vr12mr5876902vdc.30.1408973323128; Mon, 25 Aug 2014 06:28:43 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id od6si3076049vcb.4.2014.08.25.06.28.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 06:28:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id la4so15224349vcb.33 for ; Mon, 25 Aug 2014 06:28:43 -0700 (PDT) X-Received: by 10.220.77.65 with SMTP id f1mr5531477vck.48.1408973323063; Mon, 25 Aug 2014 06:28:43 -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 uj3csp117320vcb; Mon, 25 Aug 2014 06:28:42 -0700 (PDT) X-Received: by 10.194.209.169 with SMTP id mn9mr2527272wjc.122.1408973321979; Mon, 25 Aug 2014 06:28:41 -0700 (PDT) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by mx.google.com with ESMTPS id he4si55878217wjc.100.2014.08.25.06.28.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 06:28:41 -0700 (PDT) Received-SPF: pass (google.com: domain of eric.auger@linaro.org designates 209.85.212.172 as permitted sender) client-ip=209.85.212.172; Received: by mail-wi0-f172.google.com with SMTP id n3so2534436wiv.11 for ; Mon, 25 Aug 2014 06:28:41 -0700 (PDT) X-Received: by 10.180.99.34 with SMTP id en2mr15785357wib.34.1408973321475; Mon, 25 Aug 2014 06:28:41 -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 co6sm100101595wjb.31.2014.08.25.06.28.39 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Aug 2014 06:28: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 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 3/9] VFIO: platform: handler tests whether the IRQ is forwarded Date: Mon, 25 Aug 2014 15:27:38 +0200 Message-Id: <1408973264-30384-4-git-send-email-eric.auger@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408973264-30384-1-git-send-email-eric.auger@linaro.org> References: <1408973264-30384-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.174 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; }